The whole course ▾

System Design · Mock interview 8 of 20

Design a food delivery app

Updated 22 Oct 2026 · By Akshay, software engineer, India · 9 min read

Design a food delivery app like Swiggy or Zomato.

Try it first

Before you read the interview, answer the question yourself. Give yourself 10 minutes: say your design out loud, or sketch it on paper. What would you ask? Which numbers matter? Which boxes, and what's the hard part? Then read on, and score yourself with the feedback at the end.

The video for this mock interview is coming soon.

New System Design videos go up at 6 pm. Subscribe on YouTube so you don't miss it.

Got a doubt? Ask in the comments under the video.Subscribe

Requirements

Requirements
Clarifying questions
->
Which apps? -> Customer, restaurant, rider
->
Scale? -> 1M orders a day, 100k riders
->
Payments? -> Online and cash
->
Speed? -> A rider within a minute
Functional requirements
Browse nearby restaurants and menus
Place and pay for an order
Restaurant accepts and cooks
Match a rider; track them live
Notify everyone at each step
Non-functional requirements
->
Browsing fast: under 200 ms
->
Orders never lost, never charged twice
->
Lunch and dinner peaks: 5 ×
->
Live tracking a few seconds behind
Out of scope
Ratings and reviews
Offers, coupons and ads
Restaurant and rider sign-up
interviewer
Hi. This is the last one, so let's make it a good one.
candidate
Let's do it. I'll draw as I go.
interviewer
Design a food delivery app, like Swiggy or Zomato.
candidate
Okay. That's really three apps in one: customers, restaurants and riders. Before I draw anything, let me narrow it down.
interviewer
Sure.
candidate
Which apps are in scope?
interviewer
All three. Customers order, restaurants accept and cook, riders deliver.
candidate
What scale?
interviewer
A million orders a day, fifty thousand restaurants, and a hundred thousand riders online at peak.
candidate
Payments?
interviewer
Online through a provider, plus cash on delivery.
candidate
And how fast must a rider be found?
interviewer
Within a minute of the restaurant accepting.
candidate
So, what it must do. Customers browse nearby restaurants and menus. They place an order, and pay. The restaurant accepts it, and cooks. A rider is matched, and the customer can track them live on a map. And everyone is notified at each step.
candidate
And how well. Browsing must be fast, under two hundred milliseconds. An order is never lost, and never charged twice. Lunch and dinner bring peaks about five times the average. And live tracking can be a few seconds behind, but no more.
interviewer
Good. Why so strict about browsing?
candidate
People decide in seconds. A slow menu is an order that goes to a competitor.
candidate
I'll leave out ratings and reviews, offers, coupons and ads, and restaurant and rider sign-up. Does that match what you had in mind?
interviewer
Yes. Start with the order flow, then the riders.

Estimation

Estimation
Back of the envelope
1M orders ÷ 100,000 s = 10/s; peak ~ 50/s
~20 browse requests per order: ~1,000/s, peak
5,000/s
100k riders ÷ 4 s = 25,000 GPS updates/s
Orders: ~1M rows a day, a few KB each
WHAT THE NUMBERS DECIDE
Orders:few,butmustbe
correct.Browsing:
read-heavy,cacheable.Rider
GPS:awrite-heavyfirehose.
candidate
Let me size it. I think the numbers will show three very different workloads.
interviewer
What load is this?
candidate
I'll size orders, browsing and rider locations separately.
candidate
A million orders a day is about ten a second, with a peak near fifty. Each order comes after maybe twenty requests of browsing and searching, so browsing is around a thousand requests a second, and five thousand at peak. A hundred thousand riders, each sending a position every four seconds, is twenty-five thousand location updates a second, all day. And the orders themselves are small: about a million rows a day.
candidate
So, three workloads. Orders are few, but every one involves money and has to be exactly right. Browsing is read-heavy and changes slowly, so it's perfect for caching. And rider GPS is a firehose of writes where only the latest value matters. Three different designs, inside one app.
interviewer
That's the right way to see it.

API and data

API and data
Restaurants
location, menu, open
hours
Orders
items, state, rider,
payment
Riders
status: free or busy
Live locations
in memory only
from
delivered
by
now at
Endpoints
1
GET /restaurants?near=… and
their menus
2
POST /orders + Idempotency-Key
3
Restaurant: accept, food ready
4
Rider socket: GPS, offers, pickup,
delivered
candidate
Next, the API, app by app, and the data underneath.
interviewer
What does the API look like?
candidate
I'll keep it short, app by app.
candidate
GET nearby restaurants, and each one's menu, with a cursor. POST slash orders, with an idempotency key, so a double-tapped Pay can't create two orders. The restaurant app can accept an order and mark the food ready. And each rider app holds a socket open, sending GPS and receiving offers, then marking pickup and delivery.
interviewer
Why a socket for riders, but not customers?
candidate
Riders send GPS all the time and need offers instantly. Customers only need live updates while an order is on its way, and they open a socket just for that.
candidate
Four kinds of data. Restaurants, with location, menus and opening hours: read constantly, changed rarely. Orders, with items, state, rider and payment: the precious data, in Postgres, sharded by customer. Riders, free or busy. And live locations, kept in memory only, because a position is worthless four seconds later.
interviewer
Why shard orders by customer?
candidate
Most reads are customers looking at their own orders, so each one stays on one shard.

High-level design

High-level design
Customer
app
API
gateway
Menu
service
nearby,
menus,
search
Redis
menus,
nearby
lists
browse
cache
first
Order
service
runs the
saga
Orders
DB
sharded by
customer
Payment
provider
Kafka
order
events
POST
/orders
1
state: created
2
charge,
with key
3
order paid
4
An order's states
1
Created -> paid
2
Restaurant accepted -> food ready
3
Rider assigned -> picked up
4
Delivered, or cancelled and refunded
TWO RISKS
Anordermustsurvive
failures,neverlostor
chargedtwice.Aridermust
befoundwithinaminute.
interviewer
Okay. Show me the design.
interviewer
Walk me through it, from opening the app to the food arriving.
candidate
Browsing first, because it's most of the traffic.
candidate
The customer app goes through the API gateway, which checks identity and rate limits, to the menu service. Nearby restaurants come from geohash cells, cached per cell. Menus come from Redis, so most browsing never touches a database. Dish search goes to Elasticsearch, kept in sync from the database. And photos come from a CDN.
interviewer
How much reaches the database?
candidate
With hit rates above ninety percent, a few hundred reads a second, even at peak.
candidate
Now the order. It reaches the order service, which saves it in the orders DB in state created, before calling anyone. It charges the card through the payment provider, passing the idempotency key along. Then it publishes order paid to Kafka, through an outbox. The restaurant app, notifications and analytics all react to that event, each at their own pace.
interviewer
What's the outbox for?
candidate
Saving the order and publishing the event must both happen, or neither. So I write the event into a table in the same transaction, and a relay publishes it to Kafka.
candidate
The order moves through a state machine, only forwards. Created, then paid. The restaurant accepts, and later marks the food ready. A rider is assigned, and the food is picked up. Then delivered, or, if anything fails, cancelled and refunded. Every change is saved and published, so every app follows the same truth.
interviewer
And support?
candidate
Support sees the same states, so every complaint is quick to answer.
interviewer
What are the hard parts?
candidate
Two. An order has to survive every failure along the way, a crash, a refusal, a timeout, without being lost or charged twice. And a rider has to be found within a minute, among a hundred thousand moving ones.
interviewer
Money first.

Deep dive: the order, end to end

Deep dive: the order, end to end
Choreography: events only
Each service reacts on its own
The flow is scattered
Undos are hard to follow
Orchestration: the order service
One place runs every step
Each step has a written undo
Easy to retry and to debug
THE CHOICE
Anorchestratedsaga:every
stepidempotent,everyundo
writteninadvance,cooking
onlyafterpayment.
interviewer
Let's start with the order.
interviewer
An order involves the payment provider, the restaurant and a rider. How do you keep it correct when one of them says no?
candidate
With a saga. But there are two ways to run one.
candidate
I could let each service react to events on its own: choreography. But then the order's story is scattered across services, and undoing it is hard to follow. Or the order service orchestrates the saga: it runs each step in turn, and each step has an undo written in advance. Restaurant refuses? Refund the payment, cancel the order, tell the customer. No rider found in time? Ask the restaurant to hold, widen the search, and as a last resort, cancel and refund.
interviewer
Which would you pick?
candidate
Let me explain my pick.
candidate
I'd orchestrate it. Every step is idempotent, because the orchestrator will retry. Every undo is written in advance. And the order matters: the card is charged before the restaurant starts cooking, because a refund is easy, and uncooking a biryani is impossible.
interviewer
And cash orders?
candidate
They skip the payment step, and are settled with the rider.
interviewer
The card was charged, but the order service crashed before recording the payment. Now what?
candidate
The order was saved as created before the charge, so it isn't lost. The provider's webhook arrives saying the payment succeeded, and moves it to paid. And if even the webhook is missed, the nightly reconciliation against the provider's report finds it. Three layers.
interviewer
Good.
interviewer
And if the restaurant never answers? The tablet is off, or the kitchen is swamped.
candidate
The accept step has a deadline, say five minutes, with a reminder call at three. If the deadline passes, the undos run: refund, cancel, and a notification with nearby alternatives. A step without a deadline is a customer waiting forever.

Deep dive: riders

Deep dive: riders
Matching, safely
1
Search the cell and its neighbours
2
Rank by time to the restaurant
3
Offer; 15 seconds to accept
4
Assign with a conditional write
WHY TIME THE OFFER?
Offersotheriderarrives
asthefoodisready:no
riderwaiting,nofood
goingcold.
High-level design
Customer
app
API
gateway
Menu
service
nearby,
menus,
search
Redis
menus,
nearby
lists
browse
cache
first
Order
service
runs the
saga
Orders
DB
sharded by
customer
Payment
provider
Kafka
order
events
POST
/orders
1
state: created
2
charge,
with key
3
order paid
4
Location
service
Geo
index
free
riders
per
cell
Rider
app
GPS every
4 s
update cell
food ready soon
offer
5
An order's states
1
Created -> paid
2
Restaurant accepted -> food ready
3
Rider assigned -> picked up
4
Delivered, or cancelled and refunded
TWO RISKS
Anordermustsurvive
failures,neverlostor
chargedtwice.Aridermust
befoundwithinaminute.
interviewer
Now, the riders.
interviewer
How do you find a rider within a minute, and show the customer that rider moving, live?
candidate
Let me add the rider side to the board.
candidate
Each rider app sends GPS every four seconds to the location service, which keeps a geo index in memory: the free riders in each cell. When an order's food will be ready soon, matching searches the restaurant's cell and its neighbours, ranks the riders by their time to reach the restaurant, and offers the order to the best one. Live positions reach the customer through pub/sub.
interviewer
Is that the same as the taxi design?
candidate
Very close. The difference is timing: a ride starts now, but food has a cooking time, so the match can wait for the right moment.
candidate
Four steps. Search the restaurant's cell and its neighbours. Rank the free riders by their time to the restaurant, and by when the food will be ready. Make an offer, with fifteen seconds to accept, then move to the next. And when a rider accepts, assign them with a conditional write: busy, only if still free. One rider, one order.
interviewer
What if two orders race for one rider?
candidate
The conditional write lets exactly one win. The other order just offers to its next rider.
interviewer
Why wait for the food, instead of grabbing the nearest rider straight away?
candidate
A rider who arrives fifteen minutes early isn't delivering anything else, and food that waits for a rider goes cold. Matching uses the kitchen's expected cooking time, so the rider and the food meet at the counter.
interviewer
At the lunch peak there are five times the orders, and not enough riders. What then?
candidate
I'd adapt in layers. Batch two orders from the same restaurant going the same way for one rider. Show longer delivery times honestly, before people order. Add a small busy-time fee, which also brings more riders online. And let restaurants pause new orders when the kitchen is overwhelmed.
interviewer
Degrading gracefully. Good.

Wrap-up

Wrap-up
Next steps
1
Better ETAs: roads and kitchen times
2
A new country: home regions
3
Watch order success and time to assign
4
Ratings, offers and ads
INTERVIEWER'S FEEDBACK
Strong:threeworkloads,three
designs,anorchestratedsaga,a
saferidermatch.Next:whatit
coststorun.Verdict:seniorhire.
interviewer
We're nearly done.
interviewer
What would you improve with more time?
candidate
A few things.
candidate
First, better ETAs, learned from road speeds and each kitchen's real cooking times. Second, launching in a new country, with its own home region. Third, I'd watch the order success rate, the time to assign a rider, and how accurate the ETAs are. And fourth, the features we left out: ratings, offers and ads.
interviewer
Which would you do first?
candidate
The watching. Those are the numbers customers feel on every order.
interviewer
Okay, let's stop there. That was really strong. You saw three workloads and gave each the design it needs: cached browsing, correct orders with a saga, and an in-memory firehose for riders, with a conditional write to keep matching safe. Every box had a reason. If I wanted more, I'd ask what it costs to run, but that's a question for the next level up. I'd say a hire, at senior level.
candidate
Thank you. That means a lot.
Interviewer's feedback

Strong: three workloads, three designs, an orchestrated saga, a safe rider match. Next: what it costs to run. Verdict: senior hire.

Score yourself

Interviewers score these seven things. Give your own attempt a tick for each one you did.

  • Asks before drawing. Agrees what the system does, and how well: scale, speed, consistency.
  • Turns users into requests a second and bytes a day, and says what the numbers decide.
  • A small, clear contract, and a data model that fits how the data is read.
  • A working path end to end before any detail. Every box has a reason.
  • Picks the hard parts, compares two options, and chooses one with a trade-off said out loud.
  • What breaks, what happens then, and how users notice. Retries, duplicates, limits.
  • Thinks out loud, checks in with the interviewer, and takes a hint without losing the thread.

0 of 7

Your progress stays on this device.
New System Design videos at 6 pm

Lessons on weekdays, the week's revision on Saturday, a mock interview on Sunday.