← Questions

Design an online shopping cart

0
UberSystem designLast asked May 2026

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

What it tests

e-commerce · sessions · consistency

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing