Code Room
System designMedium
Question
Design a coupon/promotion engine for an e-commerce checkout serving ~3,000 carts/sec at peak (flash sales). Promotions vary: percentage off, fixed amount, BOGO, free shipping, first-order-only, and stackable vs exclusive rules. Constraints: total redemption caps (e.g. 'first 10,000 uses') and per-user caps must be enforced exactly even under a flash-sale stampede, evaluation must add <20ms to checkout, and applying multiple eligible promos must pick the best legal combination. Read-heavy on the catalog, contended on the cap counters.
What a strong answer looks like
Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.
Learn the concepts
Loading whiteboard…
Run or narrate your approach, then ask the coach.