📝 Problem Description
Design a large-scale e-commerce platform like Amazon. Cover product catalog, search, cart, checkout, orders, inventory, recommendations, and seller integration. Handle flash sales, multi-warehouse fulfillment, and millions of concurrent users.
👤 Use Cases
1.
Buyer wants to searches for "wireless headphones" so that sees ranked results with filters (brand, price, rating)
2.
Buyer wants to views product detail page so that sees images, description, reviews, stock availability, delivery estimate
3.
Buyer wants to adds item to cart so that item reserved for 15 minutes, cart updated
4.
Buyer wants to applies coupon code so that discount calculated and applied to cart total
5.
Buyer wants to completes checkout so that payment processed, order confirmed, confirmation email sent
6.
Buyer wants to tracks order so that sees real-time status: picked → packed → shipped → out for delivery
7.
Buyer wants to returns item so that return label generated, refund initiated after receipt
8.
Seller wants to lists new product so that product indexed and appears in search within 5 minutes
9.
Seller wants to updates inventory so that stock levels synced across all channels
10.
System wants to detects low stock so that sends reorder alert to seller, updates product availability
✅ Functional Requirements
- •Product catalog with hierarchical categories, attributes, and variants (size, color)
- •Full-text search with filters (price, brand, rating, Prime eligible)
- •Shopping cart with real-time inventory validation
- •Multi-step checkout: address → shipping method → payment → confirmation
- •Multiple payment methods: credit card, PayPal, gift cards, buy now pay later
- •Order lifecycle: placed → processing → shipped → delivered with tracking
- •Returns and refunds with automated label generation
- •Product recommendations (also bought, also viewed, personalized)
- •Reviews and ratings with verified purchase badge
- •Seller portal: inventory management, order fulfillment, analytics
- •Wishlist and save for later functionality
- •Price alerts and back-in-stock notifications
- •Coupons, promotions, and bundle deals
⚡ Non-Functional Requirements
- •Handle 100M+ products with real-time inventory
- •Support 1M concurrent users, 10M during flash sales
- •Product page load < 200ms (CDN-cached)
- •Search latency < 100ms for 99th percentile
- •Cart operations < 50ms
- •Checkout completion < 3 seconds
- •99.99% availability (52 minutes downtime/year max)
- •Zero overselling - inventory consistency is critical
- •PCI DSS compliance for payment data
- •GDPR/CCPA compliance for user data
⚠️ Constraints & Assumptions
- •Inventory must be consistent across all channels (web, mobile, marketplace)
- •Flash sales cause 10-100x traffic spikes in seconds
- •Multiple fulfillment centers with different stock levels
- •Same product sold by multiple sellers at different prices
- •International shipping with customs, taxes, and currency conversion
- •Must support marketplace model (third-party sellers)
📊 Capacity Estimation
👥 Users
100M daily users, 1M concurrent
💾 Storage
100TB (products, orders, reviews)
⚡ QPS
Browse: 1M/sec, Checkout: 10K/sec
📐 Assumptions
- • 100M products
- • 100M daily active users
- • 10M orders per day
- • Average order: 3 items
💡 Key Concepts
CRITICAL
Inventory Reservation
Reserve stock on cart add, release on timeout.
CRITICAL
Distributed Transactions
Saga pattern for order → payment → inventory.
HIGH
Event Sourcing
Track all inventory changes as events.
HIGH
Read Replicas
Separate read/write for catalog browsing.
💡 Interview Tips
- 💡Start with requirements clarification: Is this marketplace (multi-seller) or single seller? Flash sales?
- 💡Draw the checkout flow first - it touches all major components
- 💡Emphasize inventory consistency - this is the hardest problem
- 💡Explain the tradeoff between cart reservation and checkout-time inventory check
- 💡Discuss the saga pattern for distributed transactions
- 💡Mention the separation of read path (browsing) vs write path (ordering)
- 💡Cover caching strategy with invalidation (CDN, Redis)
- 💡Address peak traffic handling (queueing, auto-scaling, graceful degradation)