Design a shopping cart service for an e-commerce platform that allows users to add, update, and remove items, and proceed to checkout.
Scale requirements: - 50 million registered users - 5 million daily active shoppers - Average cart has 8 items - Cart data must persist across sessions and devices - 99.9% availability
Areas to cover: 1. Cart storage and data model 2. Guest cart vs authenticated cart merging 3. Price and availability validation 4. Cart expiration and cleanup 5. Transition from cart to checkout
Constraints: - Cart must sync across mobile app and web - Handle concurrent updates (e.g., two tabs modifying the same cart) - Items in cart do not reserve inventory (reservation happens at checkout) - Cart should survive service restarts
How to approach it
- Hint 1
Start with the data model: what does a cart look like, where is it stored, and how do you handle guest users who later log in? Think about merging strategies.
- Hint 2
Consider the consistency model: if a user updates their cart from two devices simultaneously, how do you resolve conflicts? Last-write-wins, or something smarter?
- Hint 3
Think about the boundary between cart and checkout: at what point do you validate prices, check inventory, and lock in the order? What happens if a price changes while an item is in the cart?
Ready to answer it out loud?
Record your answer in 1:30 and Preptile scores it 1–10 with specifics — what landed, what you skipped, and what to say next time.
Practising needs an invite code. Join the waitlist and we’ll send you one.