Saltbrook Outfitters asks you to run a flash sale of 2,000 jackets for 30,000 shoppers. Deliver the scope, a checkout rate, a checkout contract with idempotency, a stock table, the reservation and order path, a late-payment policy and a product-page availability choice.
How interviewers level this design
- Junior: reserves stock with an atomic update and keeps payment outside the database transaction.
- Mid-level: adds idempotent checkout, reservation expiry and an outbox for order events.
- Senior: handles late payments and reconciliation, hot-row contention and how stock is split across warehouses.
Saltbrook Outfitters runs a flash sale: 2,000 jackets, 30,000 shoppers in the first five minutes. Two promises collide. The shop must never sell more jackets than it has, and a shopper who reaches payment should not lose the jacket while typing a card number.
The usual answer is a short reservation. A checkout atomically moves a unit from available to reserved, payment happens outside the database transaction, and a confirmed payment turns the reservation into an order. Reservations that expire go back to available. You will size the checkout rate, design the API and stock table, draw the path with an outbox for order events, and decide what to do when a payment succeeds just after its reservation expired.
Reserve stock atomically, confirm after payment, release expired holds and resolve late payments.