← Back to All Questions
Medium~40 minE-Commerce

Design Backend for Free Burger Distribution

GoogleDeliverooDoorDashUber Eats

πŸ“ Problem Description

Design a backend system for a promotional app that distributes 6 million free burger vouchers in one hour. Handle extreme traffic spikes and prevent fraud.

πŸ‘€ Use Cases

1.
User wants to claims voucher so that receives unique voucher code
2.
System wants to detects fraud so that blocks duplicate claims
3.
Restaurant wants to redeems voucher so that voucher marked as used

βœ… Functional Requirements

  • β€’Users can claim one free burger voucher
  • β€’Limit of 6 million vouchers total
  • β€’One voucher per user/device
  • β€’Voucher redeemable at restaurant
  • β€’Real-time counter of remaining vouchers

⚑ Non-Functional Requirements

  • β€’Handle millions of concurrent users
  • β€’No over-allocation (exactly 6M vouchers)
  • β€’Sub-second claim confirmation
  • β€’Prevent fraud (bots, duplicate claims)
  • β€’System must not crash under load

⚠️ Constraints & Assumptions

  • β€’Exactly 6,000,000 vouchers total; system must not over-allocate under any race condition
  • β€’One voucher per user/device (plus IP-based heuristics) with strong anti-bot protection
  • β€’Claim confirmation should be sub-second at peak (target P99 < 500ms)
  • β€’Voucher codes must be unique, non-guessable, and redeemable exactly once (idempotent redemption)
  • β€’High write spike for claims (100K+/sec); reads for remaining count can be approximate but must not allow oversell
  • β€’Graceful degradation: if fraud checks slow down, fail closed (don’t allocate) or shed load (429/503)

πŸ“Š Capacity Estimation

⚑ QPS
Claims: 100K/sec peak, Reads: 1M/sec
πŸ“ Assumptions
  • β€’ 6 million vouchers in 1 hour = 1,667/sec average
  • β€’ Peak can be 100x average = 167K/sec
  • β€’ 10 million users attempting to claim

πŸ’‘ Key Concepts

CRITICAL
Atomic Counter
Use Redis DECR for exactly 6M voucher allocation
HIGH
Rate Limiting
Prevent abuse and bot attacks during high traffic
HIGH
Fraud Detection
Device fingerprinting to prevent duplicate claims

πŸ’‘ Interview Tips

  • πŸ’‘Start with the key challenge: handling the traffic spike
  • πŸ’‘Emphasize atomic operations for the counter
  • πŸ’‘Discuss fraud prevention strategies early
  • πŸ’‘Be prepared to discuss graceful degradation
  • πŸ’‘Know the numbers: 6M vouchers, 1 hour, ~100K claims/min at peak