42. Design E-commerce Cart and Checkout (Amazon / Flipkart)
1
The interview prompt2
42.1 What do you ask first?3
42.2 How big is this, really?4
42.3 What are the doors?5
42.4 What do we store?6
42.5 What does the whole system look like?7
42.6 How is the cart stored?8
42.7 How do you reserve inventory?9
42.8 How do you make order creation idempotent?10
42.9 How does the payment hand-off work?11
42.10 How does the checkout saga work?12
42.11 What would you say in the last five minutes?13
Score yourself14
Variations to practise15
Sources16
Code lab42. Design E-commerce Cart and Checkout (Amazon / Flipkart)
Variations to practise
3 min read+10 XP
Chapters used
Approach (1), Estimation (2), Consistency (16), Transactions, locking and sagas (17), Message queues (22), Pub/sub and outbox (23), APIs, idempotency and webhooks (24), Rate limiting (25), Failures (29), Notifications (33), Flash sales (43).
Try these variations
Each is a common follow-up. Answer in two minutes, then check the sketch.
- "Items come from three warehouses." → Reserve per warehouse; the order splits into shipments; the saga releases each hold separately on failure.
- "Add a wallet plus card split payment." → Two payment steps in the saga: debit wallet, charge card; on card failure, refund the wallet.
- "Price drops after the order." → A separate price-protection job that issues credits; never edit the order's price_paid.
- "Sale day: 10× normal traffic." → Pre-scale (Chapter 41), bucket hot stock, waiting room for the flash items (Chapter 43), and a second payment gateway.