System Design Playbook
12 · System designs100 users → 100M+ users13 min read

Design Uber Eats (food delivery)

A three-sided marketplace: eaters, restaurants and couriers, each with their own app. The interesting parts are geo search over restaurants, an order state machine shared by three parties, and dispatching couriers so they arrive exactly when the food is ready.

In one sentence

Search restaurants with geo filters, keep each order in a state machine that publishes events, and dispatch couriers by predicted readiness, not just distance.

A reference design: it covers what an app like this needs and follows how these companies have described their systems publicly, simplified to be learnable.

Requirements

Functional

  • Find open restaurants that deliver to me
  • Order, pay, track in real time
  • Restaurants accept and mark orders ready
  • Couriers get offers and deliver

Non-functional

  • Menus and search: very read-heavy
  • Orders and payments: correct and durable
  • Updates in near real time for 3 parties
  • Peaks at lunch and dinner

Back-of-the-envelope estimates

MetricEstimate
Orders~10M / day, with dinner peaks ≈ 400 orders/s
Menu views~50 per order → 20K reads/s: cache them
Order events~10 state changes per order → 4K events/s
Courier pings1M couriers every 5 s → 200K location writes/s

API and data model

GET  /restaurants?lat=…&lng=…&cuisine=…       → [ restaurantCard ]
GET  /restaurants/:id/menu                    → menu (cached)
POST /orders   { restaurantId, items, address } → { orderId, eta }
POST /orders/:id/accept | /ready   (restaurant)
POST /deliveries/:id/pickup | /dropoff  (courier)

restaurants(id, name, location, delivery_radius, hours)
menu_items(id, restaurant_id, name, price, available)
orders(id, eater_id, restaurant_id, courier_id, status, total, city)

Architecture

Architecture
Scale
Follow a request
◱Eater app◱Restauranttablet◱Courier appGPS⇄API gateway⌕Search & catalogElasticsearch + geo⚙Order servicestate machine⚙Courier dispatch⚙ETA predictionprep + travel☰Order eventsKafka↻Notificationspush, SMS◎Paymentsauthorize → captureϟRedismenus, carts⛁PostgreSQLrestaurants, ordersϟCourierlocationsRedis GEO

Step by step · Place an order

  1. 01Opens the app at home
  2. 02GET /restaurants?near=…
  3. 03Geo + open-now + cuisine filters
  4. 04Menu from cache
  5. 05Creates the order: placed
  6. 06Authorizes the card (not charged yet)
  7. 07Order and items saved in one transaction
  8. 08OrderPlaced published
  9. 09New order rings on the tablet

At this scale · 1M users

An event-driven order pipeline

  • ▸Order service owns the state machine and publishes events
  • ▸Search with geo filters (Elasticsearch): open restaurants that deliver to you
  • ▸Courier dispatch times the pickup with the food being ready

Tap any box to see what it does.

Deep dive: dispatch is a timing problem

In ride hailing you want the closest driver now. In food delivery, a courier who arrives 10 minutes before the food is ready is wasted, and one who arrives late lets the food go cold. Dispatch combines predicted preparation time for that restaurant with predicted travel time and assigns the courier whose arrival matches.

  • Events, not calls: the order service publishes OrderPlaced, OrderReady, PickedUp; dispatch, notifications and analytics subscribe. Adding a new reaction doesn't touch the order service.
  • Batching: at scale, one courier picks up two orders from nearby restaurants going in the same direction.
  • Payments: authorize at checkout, capture after delivery (tips and adjustments change the amount).

How it changes with scale

Architecture
Scale
Follow a request
◱Eater app◱Restauranttablet◱Courier appGPS⚙App servermenus + orders◎Paymentsauthorize → capture⛁PostgreSQLrestaurants, orders

Step by step · Assign a courier

  1. 01Accepts: ready in ~15 min
  2. 02Assigns the nearest free courier
  3. 03Offer: pick up at 20:15

At this scale · 100 users

One app, three kinds of users

  • ▸Eaters, restaurants (a tablet web app) and couriers use the same backend
  • ▸Restaurants, menus and orders in PostgreSQL
  • ▸Courier assignment: the nearest available one

Tap any box to see what it does.

UsersWhat you runWhy it changes
100Monolith + PostgreSQL, manual or nearest-courier assignmentOne city, a handful of restaurants
10KRedis for menus, CDN for photos, push notifications workerMenu reads dominate; status must update without refreshing
1MSearch, order, dispatch services + Kafka eventsThree apps and many teams need independent services
100M+Sharded by city, ML ETAs, batched deliveriesCities are independent; efficiency per delivery is the business

Key takeaways

  • 01Menus and search are read-heavy: cache and use a geo-aware search index.
  • 02One service owns the order state machine; everyone else reacts to its events.
  • 03Dispatch by predicted readiness and travel time, not distance alone.
  • 04Shard by city: deliveries never cross cities.

Check your understanding

1 of 3

In a food delivery app like Uber Eats, who owns the order state machine?