Inspiration

35% of Amazon's revenue comes from recommendations (McKinsey) - yet most e-commerce platforms still rely on batch processing that updates user profiles overnight.

I experienced this frustration firsthand: I'd spend an hour browsing laptops on a shopping site, only to return the next day and see recommendations for kitchen appliances I viewed last week. The disconnect felt broken.

The technology to fix this exists - Kafka for real-time streaming, Flink for continuous aggregation, Vertex AI for intelligent recommendations - but combining them into a cohesive personalization engine hadn't been done well. CartIQ is my attempt to bring Amazon-level personalization to everyone, updating in seconds instead of hours.

I wanted to build something that understands your intent as you shop, not hours later. Real-time streaming makes this possible, but combining it with modern AI for natural language product discovery hadn't been done well.

What it does

CartIQ is an AI-powered e-commerce platform that personalizes in real-time:

  • Instant Personalization: Browse electronics → homepage immediately reflects electronics
  • AI Shopping Assistant: Ask "Samsung phones under 30000 with good camera" and get relevant results
  • Context-Aware AI: Knows what you browsed, what's in your cart, and your price preferences - updated continuously
  • Fast Suggestions: Personalized product recommendations in ~560ms
  • Natural Conversations: AI chat responds in 2-3 seconds with contextually relevant products

How we built it

Real-Time Pipeline (Confluent Cloud)

  • Kafka topics capture every interaction: page views, product browsing, cart actions, AI queries, orders
  • Flink SQL with materialized tables continuously aggregates behavior into user profiles
  • No batch windows—profiles update instantly as events arrive

AI Pipeline (Google Cloud)

  • Vertex AI Embeddings (text-embedding-004) for semantic search
  • Vertex AI Vector Search for fast ANN retrieval
  • Vertex AI Ranking API for cross-encoder reranking
  • Gemini 2.0 Flash with function calling for natural language understanding

Hybrid Search

  • Vector search + full-text search + category/brand filtering
  • Results merged and reranked for optimal relevance

Challenges we ran into

Flink JOIN complexity: Tumbling windows caused retraction issues. Solved with materialized tables using changelog.mode = 'upsert' for clean upsert semantics.

Cold start problem: New users have no data. Implemented trending products fallback with instant transition to personalized results after first interaction.

Latency optimization: Initial pipeline took 2+ seconds. Parallelized embeddings, used deployed Vector Search indexes, and optimized prompts to hit ~560ms.

Read more about our technical challenges

Accomplishments that we're proud of

  • ~560ms end-to-end latency for personalized AI responses
  • Zero-delay personalization using continuous Flink materialization
  • Hybrid search handling both structured queries ("phones under 30000") and open ended queries ("waterproof shoes")
  • Clean integration between Confluent streaming and Google Cloud AI

What we learned

  • Materialized tables with upsert mode outperform windowed aggregations for real-time personalization
  • 4-way hybrid search (vector + full-text + category + brand) with score fusion delivers better results than any single retrieval method
  • Cross-encoder reranking significantly improves relevance over pure vector similarity
  • Gemini function calling enables structured extraction without complex prompt engineering

What's next for CartIQ

  • Collaborative filtering using Flink stream processing
  • Real-time inventory streaming to prevent out-of-stock recommendations
  • A/B testing framework for measuring recommendation quality

Built With

Share this project:

Updates