
π Food Delivery & QSR Β· Sequence
How a food delivery platform picks a rider for an order: nearby riders, batching, acceptance and live tracking.
Drawing diagramβ¦
Rider assignment sequence: when the restaurant accepts an order, the dispatch service asks the location service for riders near the restaurant, scores them by distance, current load and estimated food-ready time, and offers the order to the best rider. If the rider declines or times out, it goes to the next one. After pickup, rider GPS updates stream to the tracking service and the customer app shows live location and ETA.
sequenceDiagram
participant R as Restaurant App
participant D as Dispatch Service
participant L as Location Service
participant RA as Rider App
participant T as Tracking Service
actor C as Customer App
R->>D: Order accepted, ready in 12 min
D->>L: Riders near restaurant
L-->>D: 5 riders with distance
D->>D: Score by distance, load, ready time
D->>RA: Offer order to rider 1
alt Rider declines or timeout
D->>RA: Offer to rider 2
end
RA-->>D: Accepted
RA->>R: Arrive and pick up
loop Every 5 seconds
RA->>T: GPS location
T-->>C: Live position and ETA
end
RA->>D: DeliveredA Swiggy/Zomato-style food delivery platform: customer, restaurant and rider apps, and the services that match orders, riders and payments.
Everything that happens between a customer tapping Place Order and the food arriving: payment, restaurant acceptance, rider assignment, pickup and delivery.
Every status of a food delivery order, from placed to delivered, including restaurant rejection, no rider and customer cancellation.
How orders from dine-in, takeaway and delivery apps flow through a restaurant kitchen display system to the pass and out.
A schema for a food delivery platform: restaurants, menus, items with add-ons, customers, orders, order items and riders.
How a food delivery platform scales for lunch and dinner peaks: pre-scaling, autoscaling services, sharded databases and a surge-protected dispatch.