Design an online shopping cart
I was asked this
No reports yet. Sign in to say where you were asked it.
A system design interview question asked in Uber's system design round, last asked May 2026. It tests e-commerce, sessions and consistency.
Design the cart service for an on-demand delivery or shopping app. A user's cart lives across devices and sessions; they add and remove items, change quantities and options; prices and promotions are applied correctly; and checkout turns the cart into an order exactly once.
Requirements
- Functional: create a cart for a user and store; add, remove and update items and their options; view the cart with current prices and promotions; check out into an order; close the cart after checkout; expire abandoned carts.
- Non-functional: correctness above all at checkout (no double orders, no stale prices); low latency and high availability for cart edits; several devices may edit the same cart at once; scale up to around 10 million concurrent orders.
Clarifying questions
- One cart per user, or one per user and store?
- Are prices locked when an item is added, or recomputed at checkout?
- Can two devices edit different items at the same time without conflict?
- How long do abandoned carts live?
- Must signed-out (guest) carts merge into the account at sign-in?
What a strong answer covers
- A data model: cart header (user, store, status, version) and cart items, with indexes for "active cart by user and store" and "items by cart".
- Optimistic concurrency: a version on the cart header and conditional writes; finer-grained per-item versions when two devices edit different items.
- Pricing and promotions computed by a pricing service on read and again at checkout.
- Exactly-once checkout: a status transition from active to checked out with a condition, an idempotency key, and the order created in the same transaction or through an outbox.
- Rough load estimates from the concurrent-order figure, partitioning by user, caching of reads, expiry jobs.
- Validation at checkout (item availability, options, prices changed) and clear messages to the user.
Follow-ups
- The user taps Checkout twice on two devices.
- A promotion ends while items are in the cart.
- Several people share one group cart and order together.
- The pricing service is slow or down. What does the cart show?
Where it's asked
- Uber · System design · Last asked May 202660 min · Whiteboard and discussion
What it tests
e-commerce · sessions · consistency
Sign in to see the worked answer
The full answer, chapter by chapter, with what interviewers expect at each level. New accounts get 5 credits: each one unlocks a question for good.
What the labs asked this week
A weekly email of what OpenAI, Anthropic and the other top AI labs asked engineers, round by round.
