failover
← All labs

Medium · 12 steps · ~75 min

Design a food delivery app

Browse, order, track, all at dinner-time peak.

Restaurant lists are read constantly while orders are comparatively rare but must never be lost. Everything spikes at dinner.

Same problem as SwiggyZomatoDoorDash

How it works

What you'll build

  1. The API and the data model for restaurants, orders and deliveries
  2. A system that answers 600 requests a second
  3. Cached menus within a budget
  4. A queue and workers that take orders through the dinner rush
  5. A CDN for a nationwide promotion and a limiter against scrapers
  6. A design that survives a cold cache, a lost worker and a lost primary

Steps

  1. 1Design the API
  2. 2Design the data model
  3. 3Handle 600 requests/sec
  4. 4Cache the menus for $900 a month
  5. 5Dinner rush: queue the orders at 25,000 requests/sec
  6. 6Friday night at 80,000 requests/sec for $2,200
  7. 7How do people find 'pizza near me'?
  8. 8Survive menu scrapers on $1,400
  9. 9Survive a cold menu cache
  10. 10Lose an order worker
  11. 11Lose the primary database
  12. 12Deep dive: tracking the courier live
Start the lab →