Food Delivery App System Design (DoorDash / Uber Eats) for Interviews
5 views
"Design a food delivery platform" is a favorite system design prompt because it combines three distinct problems: browsing restaurants, placing orders reliably, and matching orders to couriers in real time. Here is a structure you can follow in a 45-minute interview.
Clarify requirements
Functional: customers search nearby restaurants and menus, place an order and pay, restaurants accept and prepare orders, couriers get assigned and deliver, and everyone sees live status and the courier's location. Non-functional: low-latency search, no lost or double-charged orders, location updates every few seconds, and peaks at lunch and dinner. Assume 20 million daily orders and 1 million active couriers at peak.
Core services
- Restaurant and menu service: stores restaurants, menus, prices, opening hours. Read heavy, so cache aggressively and push menu changes to a search index.
- Search service: geospatial search ("restaurants within 5 km delivering now"). Use geohash or S2 cells as index keys in Elasticsearch, combined with filters for cuisine, rating, and estimated delivery time.
- Order service: the source of truth for order state, stored in a relational database with an explicit state machine: CREATED, PAID, ACCEPTED, PREPARING, READY, PICKED_UP, DELIVERED, CANCELLED.
- Payment service: authorizes the card at checkout and captures after delivery, using idempotency keys so retries never double-charge.
- Courier location service: ingests GPS pings from courier apps.
- Dispatch service: matches ready orders with couriers.
- Notification service: pushes status updates to customers, restaurants, and couriers.
Location ingestion
One million couriers sending a ping every 4 seconds means about 250,000 writes per second. Do not write these to the main database. Send them through a message stream like Kafka, keep only the latest position per courier in an in-memory store (Redis with geo commands, partitioned by city), and archive history to cheap storage for analytics and ETA model training.
Dispatch and matching
A naive approach assigns the closest idle courier. Better: run matching in small batches every few seconds per region, scoring candidate courier-order pairs on pickup distance, when the food will be ready, the courier's current route (batching two orders from the same restaurant), and fairness. Mention that this is an assignment optimization problem and that partitioning by city keeps it tractable. Couriers can accept or decline; on decline or timeout, the order goes back into the next batch.
ETA prediction
ETAs combine prep time (learned per restaurant and time of day), travel time to the restaurant, and travel time to the customer using a routing engine with live traffic. Show the ETA at checkout and update it as events happen.
Reliability
Order creation and payment authorization must be consistent: use an outbox pattern so the order record and its "order created" event are committed together. Each downstream consumer is idempotent. If dispatch fails to find a courier within a threshold, escalate with incentives or notify the customer.
Scaling for peaks
Region-based sharding, autoscaling stateless services before mealtimes, and degrading gracefully (for example, pausing low-priority recommendations) all help.
Wrap up by walking through one order end to end. Practicing that narrative out loud makes a big difference. If you want support in the moment, Linkjob AI (https://linkjob.ai) provides real-time help during job interviews and technical interviews, helping you keep a clear structure when follow-up questions come quickly.