Location & mobility · Advanced
Food delivery dispatch
Three-sided marketplace where a batch optimizer assigns couriers using ML prep and travel-time predictions.
Every part, and why it is there
Customer app
Places orders and watches the courier on a map. Cares about one thing: food arrives hot and on time.
Courier app
Couriers report location, accept or decline offers and mark pickups. They are independent and can say no, which the dispatcher must expect.
Restaurant tablets
Restaurants confirm orders and mark them ready. Prep time is the big unknown in every delivery.
API gateway
One API surface for three very different apps, with separate auth and quotas for each.
Order service
Creates and tracks orders through placed → confirmed → picked up → delivered, and publishes every change.
Orders DB
Durable order records and status history.
Order events
New orders and “food ready” signals land here. Dispatch, ETAs and analytics all read the same feed.
Courier location service
PUT /dashers/:id/location takes frequent pings and keeps each courier’s latest position and status current.
Merchant service
Handles order confirmation and ready signals from restaurants and updates the order.
Dispatch optimizer
Every few seconds it looks at all open orders and free couriers in a region and solves one assignment problem, rather than greedily grabbing the nearest courier per order.
Prep & travel-time models
Predicts when food will be ready, how long the drive takes and how likely a courier is to accept. The optimizer is only as good as these estimates.
Courier state & location
Live courier positions and whether each one is free, carrying an order, or waiting at a store. In memory because it changes constantly.
Offer push
Sends the chosen courier their offer; a decline puts the order back into the next round.
APNs / FCM
Platform push services that wake the courier’s phone.
Asked in interviews at
- meta
- uber
- twilio
- amazon
Concepts used here
- Geohash: Build a short code like xn76fg for any spot on Earth, so “ramen near me” becomes “codes that start with xn76fg”, one read on an ordinary database index.
Learn more
- System Design of Doordash: Geo-Hashing and WebSockets for Location Based Services (Gaurav Sen)
- Design Uber Eats | System Design Interview (with Senior Netflix Engineer, Ex-Microsoft) (Aced (formerly Exponent))
- Using ML and optimization to solve DoorDash's dispatch problem (DoorDash Engineering)
- Next-generation optimization for Dasher dispatch at DoorDash (DoorDash Engineering)
- Iterating real-time assignment algorithms through experimentation (DoorDash Engineering)