Code Room
System designMedium
Question
Design a coupon/voucher service for an online store. Each coupon has a code, a discount, an expiry date, and a max number of redemptions (sometimes one per customer, sometimes a global cap of, say, 1,000 uses). At checkout the store calls the service to validate and redeem a code. Cover the data model, how validation and redemption work, and how you prevent a limited coupon from being over-redeemed during a sale rush.
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.