dilshan.dev
Full-Stack2024Featured Architecture

OmniStore Distributed E-Commerce

Event-driven microservices architecture with real-time inventory and Stripe billing.

Peak Throughput10k+ req/sec
Checkout Cache Latency< 45ms
Inventory Consistency100%
Payment IdempotencyGuaranteed

System Overview & Motivation

OmniStore is a high-throughput, event-driven commerce and inventory platform engineered to handle peak traffic spikes during major release events. Designed around an asynchronous microservices architecture, it coordinates order processing, real-time stock reservations, Stripe payment reconciliation, and customer notifications via Apache Kafka event streaming.

Key Architectural Highlights

  • Event-driven architecture with Apache Kafka ensuring exactly-once order event handling
  • Next.js App Router storefront with optimistic UI updates and instant cache invalidation
  • Distributed Redis locking preventing inventory overselling during concurrent checkout rushes
  • Stripe webhook idempotent processing pipeline with automatic exponential backoff retries
  • PostgreSQL transactional guarantees with multi-master read replicas

Technical Architecture & Data Pipeline

The frontend is a server-rendered Next.js application that communicates with a Node.js API gateway. Orders dispatch events onto Kafka topics. Separate worker services handle inventory allocation, Stripe billing intents, and email dispatch independently, ensuring no bottleneck impacts checkout latency.

Production Challenges & Edge Cases Solved

Race conditions during flash sales where thousands of buyers attempt to purchase limited inventory simultaneously. Solved by implementing Redlock distributed mutex locks and atomic database decrement operations.

Technology Stack & Dependencies

Frontend & UI

Next.js App RouterReact 19TypeScriptVanilla CSS

Backend & Gateway

Node.jsExpressRESTZod

Data & Event Bus

PostgreSQLApache KafkaRedisPrisma