Lesson 2 of 16
42. Design E-commerce Cart and Checkout (Amazon / Flipkart)

42.1 What do you ask first?

3 min read+10 XP

Step 1: Requirements (5 minutes)

LetterCandidate asksInterviewer answers
Scope"Cart for guests and signed-in users? Coupons? Multiple sellers and warehouses? Which payment methods? Cash on delivery?""Both. Coupons yes. Many warehouses. Cards, UPI, wallets; cash on delivery too. Skip shipping logistics."
Count"How many orders?""A few million a day normally; on sale day, peaks of about 5,000 orders a second at opening."
Access pattern"Cart activity vs orders?""Carts change far more often than orders are placed; about 50 million active carts."
Latency"How fast should checkout feel?""A few seconds end to end, including payment."
Exactness"Can we oversell? Charge twice? Lose an order?""None of those."

Agreed requirements:

  • Functional (verbs): add and update cart items (guest and signed in), merge carts at login; review prices and offers at checkout; reserve stock; take payment; create the order; notify warehouses.
  • Non-functional (adjectives): cart fast and always available; checkout correct (no oversell, no double charge, no lost order), idempotent, resilient to payment delays and failures, scalable to sale-day peaks.

Interviewer pushback:

  • "Should the cart be strongly consistent?" → No. A cart is a wish list: it should never fail to accept an item, and slight staleness is fine. Correctness starts at checkout, where we re-check prices and stock.

Memory code: "Relaxed cart, strict checkout."