We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
System Design and AI Engineering, by Roni Das. 984 interactive lessons.
Start LearningSystem design interview guide
in this guide
7 parts open to everyone · 3 with a free account · 3 with the course
You can read 7 of 13 parts. A free account opens the deep dive; the course opens all of it.
Interviewers reach for Design Swiggy because a generic three-tier diagram falls apart immediately. You have three independent actors (customer, restaurant, delivery partner) whose actions interleave, a geospatial layer that has to answer 'can this restaurant serve this address' in single-digit milliseconds, and an assignment problem that is a real optimization (cost minimization under capacity and time-window constraints), not a lookup. On top of that, the traffic profile is extreme: 70-80% of a day's orders arrive in two narrow windows, so the candidate has to talk about peak provisioning, batching for efficiency, and graceful degradation when a city's kitchens are all slammed at 8:30 PM. It separates people who have only memorized a CDN diagram from people who can reason about a live multi-party system.
This page is the free part.
₹1,111 in India$25 everywhere elseonce, for the whole course
The System Design course covers the Swiggy design across a run of lessons, not one page. These 4 alone are about 132 minutes of step-by-step reading, 1 of them with code you run in the browser, all with a quiz.
Always clarify these in the first 5 minutes of the interview. Do not start drawing boxes until both lists are agreed.
This guide is built on these 6 lessons. Each one teaches one piece of the Swiggy design above, step by step.
Lifetime access for ₹1,111 in India or $25 elsewhere. Interactive diagrams, quizzes, and 20 capstone projects to practise on.
This one question is not enough for the interview.
Each question has why it is asked, a full answer, what the interviewer listens for, the follow-ups, the common mistakes and a diagram (268 diagrams in all). A PDF you keep, junior to staff level.
Two courses by the author of this page:
770 lessons · 18 free to read
₹1,111 in India · $25 elsewhere, once
Get System DesignYou own this course
214 lessons · 10 free to read
₹1,333 in India · $35 elsewhere, once
Get Generative AI and Agentic AIYou own this course
Save your progress and get the interview checklist PDF
Swiggy serves 200,000+ restaurants across 580+ cities with a fleet of 390,000+ delivery partners, and dinner alone drove 215 million orders in 2024, roughly 29% more than lunch, with demand packed into two 90-minute windows a day.
Designing Swiggy means solving three coupled problems at once: serviceability (which restaurants can even reach this customer), dispatch (which delivery partner picks up which order, often batched), and a three-party order state machine that survives a restaurant rejecting an order, a partner going offline mid-trip, or a payment webhook arriving late. The hard part is that almost all of the load lands in two short meal peaks, so the system is sized for 4-5x its average and idle the rest of the day.
Where it shows up
Commonly asked at Swiggy, Zomato, Zepto, Uber, DoorDash, Grab, Rapido, Meesho, and most Indian product companies (Flipkart, PhonePe, Razorpay) for SDE2 and SDE3 rounds. It is the canonical hyperlocal logistics / geospatial matching problem for the Indian market, and a favorite because the lunch/dinner peak concentration forces a real capacity conversation.
Spec sheetSwiggy
worked through below, with the maths
The hard parts of this design are taught step by step in the System Design course: Geospatial Indexing, Server-Sent Events (SSE) and Pub/Sub Pattern.
Design a multi-channel notification system - push, email, SMS with priority queues, fan-out, and delivery guarantees.
How traffic actually gets spread across many servers, and what breaks when it does not.
Why some operations are safe to retry and others charge you twice, and how to make everything safe.
Mutual exclusion across network boundaries. Redlock, ZooKeeper locks, and why they're harder than you think.
all part of
System Design Masterclass
770 lessons · about 287 hours · 18 free to read
₹1,111in India, by UPI
$25everywhere else, by PayPal
You own this course
Continue with Design a Notification Systempay once,
yours for life
Live from the course bench
Real interview questions, live diagrams and measured lab results, pulled at random from the lessons. A new set every time you come back.
Show your math. Pulling numbers from thin air signals you have not thought about the load.
Daily orders
~6-7M/day
Reported public figures put Swiggy food delivery in the low single-digit millions of orders per day in 2024. Use ~6M as a round working number for capacity math; an interviewer cares about the method, not the exact figure.
Peak orders per second
~600-700 OPS
If 70% of ~6M daily orders land in roughly 3 hours of combined lunch+dinner peak, that is ~4.2M orders / ~10,800 s ≈ 390 OPS average across the peak, and bursts inside the peak push the instantaneous rate to ~600-700 OPS. Average over a full day is only ~70 OPS, which is the whole point: provision for the peak, not the mean.
Active delivery partners (peak concurrent)
~150K-200K
390,000+ total partners; peak concurrency around 40-50% during dinner. Each emits a location ping every 4-5 seconds while on an active trip or idle-but-online.
Location pings per second (peak)
~35K-45K/s
~180K online partners / 4.5 s ping interval. Written to an in-memory geo index, never to the durable order store at full fidelity.
Serviceability + listing reads
~50K-100K reads/s at peak
Every home-screen open and address change triggers a point-in-polygon serviceability check plus a restaurant-list fetch. This dwarfs order writes (~600 OPS) by two orders of magnitude, so it is the read path that must be cached aggressively.
Restaurants / cities
200K+ restaurants, 580+ cities
Public 2024 figures. Drives the size of the serviceability polygon index and the per-city sharding strategy.
Mentally split Swiggy into four planes that talk through an event backbone (Kafka), because conflating them makes the design hard to follow. Plane 1 is the discovery / read path. A customer opens the app, the client sends a delivery lat/lng, and the Serviceability service answers 'which restaurants can reach you.' This is a point-in-polygon problem: cities are carved into delivery zones (polygons), and doing a raw PIP check against thousands of polygons per request would be too slow, so Swiggy builds a GeoHash index where each polygon is registered against the GeoHash cells it overlaps. At request time you compute the customer's GeoHash key, fetch the small candidate set of overlapping zones from memory, run the precise PIP only on those, and return the eligible restaurants. The catalog (menus, prices, ratings) is served from a search/listing store (think ElasticSearch + a heavy read cache) because this path runs at 50K-100K reads/s and must stay under 100 ms. Plane 2 is order placement and the state machine. The customer places an order; an Order service writes the order durably (Aurora/Postgres-class transactional store, sharded by city), captures payment idempotently, and emits an order.placed event. The restaurant's partner tablet, connected over a push channel, receives the order and accepts or rejects. Every transition (placed -> confirmed -> preparing -> ready -> picked_up -> on_the_way -> delivered, plus rejected/canceled/refunded branches) is a guarded finite-state-machine step persisted atomically, with each change appended to an order_events log for audit. This is the strongly-consistent core; it cannot be eventually consistent or you get double charges and lost orders. Plane 3 is dispatch, the hardest and most interesting part. Assignment does NOT fire greedily the instant an order is placed. The system waits until the order is close to ready (so the partner arrives just as the food is, minimizing both customer wait and partner idle time), pools the orders that are ready-to-assign in a city zone with the partners available nearby, and solves a Mixed-Integer Program every few seconds: a cost matrix of (partner x batch) where the objective minimizes total wait/cost across the zone, subject to capacity (a partner's bag/load limit), uniqueness (one batch to exactly one partner), and time windows (arrive after food is ready, before it gets cold). Batching, combining two orders from one restaurant going to nearby drops, or two nearby restaurants to nearby drops, is what makes peak economics work; it is a small Vehicle Routing Problem inside each batch. The ETA shown to the customer comes from a separate ML model (Swiggy's is a multi-output network that jointly predicts assignment delay, first-mile, kitchen wait, and last-mile). Plane 4 is live tracking. Once a partner is on a trip, their app pings location every few seconds into an in-memory geo store; a tracking service streams that to the customer app over WebSocket/push and recomputes ETA. Pings are never written at full fidelity to the order DB, they live in Redis-class memory and a downsampled trace goes to the data lake for analytics. Across all four planes, Kafka carries the events (order placed, accepted, assigned, picked up, delivered) that fan out to notifications, surge computation, analytics, and the partner-payout pipeline. In a real interview, sketch this on the whiteboard before diving into any single box.
In a real interview, sketch this on the whiteboard before diving into any single box.
Walk through each service. The interviewer wants to hear what each one owns, not just the names.
Answers 'which restaurants can deliver to this address' in under 100 ms. Cities are modeled as delivery zone polygons; a GeoHash index registers each polygon against the cells it overlaps so a request resolves to a tiny candidate set, then runs precise point-in-polygon only on those. Also computes road-distance (not straight-line) from restaurant to drop to decide eligibility and base delivery fee.
Serves restaurant lists, menus, prices, photos, and ratings. Read-heavy (50K-100K reads/s at peak), backed by ElasticSearch for search/filter and an aggressive cache (Redis/CDN) for the home feed. Personalization and ranking layered on top. Decoupled from the transactional order store.
The strongly-consistent core. Persists the order, captures payment idempotently, and enforces the finite state machine across all three actors. Each transition is atomic and appended to an immutable order_events log. Sharded by city; this is where double-charge and lost-order bugs live, so it gets the strictest consistency guarantees.
Push connection (long-lived socket / FCM fallback) to the restaurant tablet. Delivers new orders, collects accept/reject, and surfaces prep-time signals (the orders-placed vs orders-prepared ratio that feeds kitchen-stress into the ETA model). A reject triggers customer notification and refund flow.
Runs the optimization. Pools ready-to-assign orders and nearby available partners per zone and solves a Mixed-Integer Program every few seconds, cost matrix over (partner x batch), minimizing total cost/wait under capacity, uniqueness, and time-window constraints. Owns just-in-time assignment timing and order batching (a small VRP per batch).
In-memory store of every online partner's live position, keyed by GeoHash/H3 cell so proximity queries are cheap. Ingests 35K-45K pings/s at peak via Kafka. Feeds both dispatch (find nearby idle partners) and tracking. Never durably persisted at full fidelity.
ML model that predicts the five legs of delivery time, O2A (order-to-assignment), first-mile, kitchen wait, last-mile, totaling order-to-reach, jointly via a multi-input/multi-output network. Features: restaurant type, item count/complexity, live kitchen stress, partner availability in the zone, historical road speeds, live GPS. Optimizes not just MAE but the rate of jarring ETA 'bumps' shown to the customer.
Streams partner location and live ETA to the customer app over WebSocket/push at 4-5 s cadence. Reads from the in-memory geo index, not the order DB. Handles GPS gaps and partner disconnects by holding the last known position and widening the ETA.
A streaming job (Flink-class) aggregates demand (orders in a zone) vs supply (available partners in a zone) per minute per GeoHash cell, publishes a smoothed, clamped delivery-fee multiplier to a cache, and the order service reads it at checkout. Locked in at order time so the customer pays what they agreed to.
Kafka carries order.placed, .confirmed, .assigned, .picked_up, .delivered events that fan out to push notifications (customer + restaurant + partner), surge computation, partner-payout accrual, and the analytics lake. Decouples slow side-effects from the synchronous order path.
restaurants. Listing/discovery data. Lives in the catalog store + search index, heavily cached. geohash and zone_id let serviceability narrow the candidate set fast. is_online flips…
Every table for Swiggy, its keys, and which store fits it and why.
Serviceability: answering 'can this restaurant reach me' in under 100 ms. This is the home-screen hot path and runs at 50K-100K reads/s, far above order writes, so it must be fast and cacheable. Cities are carved into delivery zone polygons…
6 deep dives on the parts that break at scale: Serviceability: answering 'can this restaurant reach me' in under 100 ms; Just-in-time dispatch and the assignment optimization; Order batching and the Vehicle Routing Problem inside it.
GeoHash polygon index vs raw point-in-polygon vs PostGIS. Raw PIP against every zone is simplest but O(zones) per request and too slow at 50K-100K reads/s. PostGIS with a spatial index works but adds DB load on the hottest read…
7 decisions an interviewer expects you to defend, each with the alternative and why it loses here.
At dinner peak, the assignment solver for a large zone starts taking longer than its few-second cadence. What do you do?
4 follow-up questions with model answers, the interview scorecard for this question, and a mock interview on Design Swiggy with the AI tutor.
Swiggy's engineering blog (Swiggy Bytes) documents most of this directly. Their serviceability platform really does use a GeoHash index over delivery-zone polygons with a point-in-polygon resolution step, computing actual road distance rather than straight-line. Dispatch is framed as a Mixed-Integer Program: a cost matrix matching delivery partners to batches, minimizing total wait/cost subject to capacity, uniqueness, and time-window constraints, re-solved every few seconds, with order batching modeled as a small Vehicle Routing Problem. The ETA system decomposes delivery time as Max(assignment_delay + first_mile, prep_time) + last_mile and predicts five legs (O2A, first-mile, kitchen wait, last-mile, order-to-reach) jointly via a multi-input/multi-output neural network that evolved from gradient-boosted trees; it optimizes for both MAE and the rate of jarring ETA 'bumps.' The backbone is Kafka, with transactional data in an Aurora/Postgres-class store and catalog/search in ElasticSearch. Scale figures cited (200K+ restaurants, 580+ cities, 390K+ delivery partners, dinner ~29% above lunch with ~215M dinner orders in 2024) are from Swiggy's own 2024 year-in-review and press. Order-per-second numbers here are estimates derived from public daily-order figures and the peak-concentration assumption, treat them as back-of-envelope, which is exactly what an interviewer wants you to show.
Sources
If any of these topics are fuzzy, the interviewer will catch it. Each lesson is 15 to 60 minutes with diagrams, code, and a quiz.
Design a Notification System
capstone / capstone
Load Balancing
foundation / core fundamentals
Idempotency
foundation / core fundamentals
Distributed Locks
advanced / distributed systems core
Cache-Aside Pattern
foundation / caching strategies
High Availability
advanced / reliability resilience
Rate Limiting for Resilience
advanced / reliability resilience
28 walkthroughs of the products Indian interviewers ask about, each with the real scale numbers, the architecture and the trade-offs that company had to make.
interview readiness
Three questions from this guide. Answer them without scrolling up, the way you would have to in the room.
India: UPI, cards or netbanking through Razorpay. Elsewhere: card or PayPal. Download at once from My packs.
NEWSystem Design Hands-On
Postgres Sharding: Complete Hands-On (PgBouncer + Citus). 2 h 36 min and 20 chapters: one PostgreSQL loaded until it breaks, then four shards behind a router you write, PgBouncer and Citus, with the 139-page slide deck. The first 15 minutes are free to watch.
Free PDF · 79 pages
25 real tech interview questions, answered in full
Five from each of our AI, GenAI, Inference, Maths for ML and Forward Deployed packs. Each with a diagram and a model answer. Free by email.
free tool
Check these numbers yourself
Put in your own guesses for Swiggy and see requests per second, storage, bandwidth and servers, with every sum written out.
Open the Capacity EstimatorIt is really nice and good Please join the course