All problems

Shopping Cart

Read on every page view, written on every click, and it can never lose an item.

medium~20 min Pro Simulator · +110 ptsTheory +34 pts
The build

Keep carts readable and writable through checkout hour without ever losing one.

Reads and writes are both hot — every product view rereads the cart, every add-to-cart writes it. Carts can't be dropped, so the cache in front of the store and the size of the API fleet both matter: one keeps checkout hour fast, the other keeps a dead instance from taking carts down with it.

Components in play

  • Storefront LBSpreads cart traffic across the service fleet.
  • Cart serviceHandles cart reads and writes for every shopper session.
  • Cart cacheHolds live carts in memory so most reads skip the store.
  • Cart storeDurable source of truth — no cart may be lost.

Graded on these SLOs

  • ≥ 98.00%Cart ops succeed
  • ≤ 90 msCart op p99
  • ≥ 9.0k rpsSustain checkout hour
  • ≤ 90%Fleet headroom
  • ≤ 7Lean footprint
Base 9,000 rps46s run 3 scripted failures

The brief

Design the cart service behind an online store. Every product page rereads the current cart and every add-to-cart writes it, so the mix is both read- and write-heavy — and unlike most caches here, this one backs a session-critical write path: a dropped cart write is a lost sale, not a stale read. Keep it fast and correct through checkout hour.

Functional

  • Add, update, and remove items from a cart
  • Read the current cart on every page view
  • Persist the cart across a session

Non-functional

  • Mixed read/write, both hot — unlike a typical read-heavy cache problem
  • Session-critical — a cart write must never silently fail
  • Stays fast and available through a checkout-hour traffic spike

Warm-up: design decisions

Optional theory to prime the calls a senior engineer would make before you build.

Pro

Solving is a Pro feature

Unlock the on-canvas AI design coach, per-run design reviews, the chaos simulator and all 12 problems for $15/month.

  • AI design coach on your canvas — pins failure points & over-engineering
  • Honest AI design review on every run
  • All 12 problems + unlimited chaos simulator
  • Points, levels & leaderboard
Get started