
π Food Delivery & QSR Β· Sequence
Everything that happens between a customer tapping Place Order and the food arriving: payment, restaurant acceptance, rider assignment, pickup and delivery.
Drawing diagramβ¦
Food order sequence: the customer places the order and pays, the order service sends it to the restaurant app. If the restaurant accepts, it starts preparing and the dispatch service assigns the nearest rider, who goes to the restaurant, picks up the order and delivers it; the customer sees live status at each step. If the restaurant rejects, the customer is refunded automatically.
sequenceDiagram
actor C as Customer
participant O as Order Service
participant P as Payment Service
participant R as Restaurant App
participant D as Dispatch Service
participant Rd as Rider App
C->>O: Place order
O->>P: Charge Rs 480
P-->>O: Paid
O->>R: New order
alt Restaurant accepts
R-->>O: Accepted, 15 min
O-->>C: Preparing your food
O->>D: Find rider
D->>Rd: Pickup request
Rd-->>D: Accepted
O-->>C: Rider assigned
Rd->>R: Arrive and pick up
Rd->>O: Picked up
O-->>C: On the way (live map)
Rd->>C: Deliver
Rd->>O: Delivered
else Restaurant rejects
R-->>O: Rejected
O->>P: Refund
O-->>C: Order cancelled, refund started
endA Swiggy/Zomato-style food delivery platform: customer, restaurant and rider apps, and the services that match orders, riders and payments.
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.
A cloud kitchen that runs several virtual brands: orders from aggregators, a kitchen display system, inventory and dispatch.