Portfolio Logo

Gerald Bahati.

Full-Stack Software Engineer

contact

Based in Nairobi, Kenya

make contact

Accessibility

Mon – Fri: 9:00 - 18:00

Async communication via Email

Legal

Imprint
Data protection

©2026 Gerald Bahati | All rights reserved.

All ProjectsBack to Overview
Next ProjectModern Dashboard

Would you like to be featured here as well?

Feel free to use the contact form or other contact options.

Projekt anfragen

Webline Store

ProjectsWebline Store
Webline Store

AI-powered e-commerce at the edge

Overview

A production-grade e-commerce storefront built with Next.js 16 and deployed on Cloudflare's edge infrastructure. Features AI-powered product recommendations, multi-currency pricing (USD/KES), and a resilient microservices architecture.

Architecture

LayerTechnology
FrontendNext.js 16, React 19, Tailwind CSS 4
BackendHono + oRPC (type-safe RPC) on Cloudflare Workers
DatabaseCloudflare D1 (SQLite) + Drizzle ORM
AI/MLWorkers AI (BGE embeddings) + Vectorize
CachingMulti-layer: Edge KV, Next.js Cache, TanStack Query
PaymentsStripe + M-Pesa (Daraja API)

Hybrid Recommendation Engine

The recommendation system combines three AI strategies:

Content-Based Filtering

  • 768-dimensional vector embeddings using Cloudflare Workers AI (BGE model)
  • Semantic similarity computation for product relationships
  • Pre-computed similarity matrices updated nightly

Collaborative Filtering

  • User behavior tracking (views, cart additions, purchases)
  • "Frequently bought together" and "Customers also viewed" patterns
  • Event-driven updates via Cloudflare Queues

Context-Aware Scoring

Weights dynamically adjust based on user location:

ContextContentCollaborativeUser Pref
Product Page60%30%10%
Homepage20%30%50%
Cart0%70%30%

Customer:

Webline Technologies Ltd.

Period:

6 months

Performance:

Full-Stack DevelopmentAI/ML IntegrationE-commerce PlatformPayment IntegrationEdge Computing

Features:

AI-Powered RecommendationsMulti-Currency Pricing (USD/KES)Real-time Cart SynchronizationStripe & M-Pesa PaymentsEdge-First Architecture25+ Database Tables

Primary Blue

Success Green

Warning Amber

Dark Gray

Challenge: Personalized Recommendations at Scale

The Problem

Building a recommendation system that delivers personalized product suggestions in real-time while handling thousands of concurrent users—without the cost and complexity of traditional ML infrastructure.

The Solution

Implemented a hybrid AI pipeline running entirely on Cloudflare's edge:

  • Embedding Generation: Nightly batch job using Workers AI (BGE model) to generate 768-dimensional vectors for all products
  • Pre-computed Similarities: Top 50 similar products per item stored in D1, eliminating real-time computation
  • Context-Aware Scoring: Algorithm adjusts weights based on page context (product page favors content similarity, cart favors collaborative filtering)
  • Sub-50ms Response: All recommendation queries served from edge cache with background revalidation

Challenge: Multi-Currency E-commerce

The Problem

Supporting both international (USD) and local Kenyan (KES) customers with accurate pricing, while handling currency-specific payment methods.

The Solution

Designed a dual-pricing schema with intelligent fallback:

  • Base Currency: All products priced in USD as the canonical price
  • KES Override: Optional local price that takes precedence when set
  • Payment Routing: Automatic gateway selection (Stripe for USD, M-Pesa for KES) based on user preference
  • Transaction Integrity: Atomic order creation with price locking to prevent race conditions

Challenge: Real-Time Cart Synchronization

The Problem

Users expect seamless cart experiences across devices and sessions, including merging anonymous carts when they sign in.

The Solution

Implemented event-driven cart architecture:

  • Dual Identity Support: Carts track both userId (authenticated) and anonymousId (cookie-based)
  • Smart Merging: On authentication, anonymous cart items merge into user cart with conflict resolution
  • Real-Time Updates: Cloudflare Queues process cart events asynchronously
  • Abandoned Cart Detection: Scheduled job (every 30 minutes) identifies stale carts for recovery emails
Webline Store - AI-powered e-commerce platform
Product Details page component
Order history component
Cart summary component

Gerald transformed our e-commerce vision into a reality that exceeded all expectations. The AI-powered recommendation engine he built has noticeably increased our customer engagement, and the seamless integration of both Stripe and M-Pesa payments opened our platform to both international and local Kenyan customers. His attention to performance—achieving sub-50ms response times on our edge infrastructure—shows a level of technical excellence that's rare to find.

Patrick Gitau

Chief Executive Officer · Webline Technologies Ltd.

Tap to visit
Check it out!
Click to visit
Webline Store - AI-powered e-commerce platform
Engagement Increase
Cache Hit Rate
Uptime SLA