
π Food Delivery & QSR Β· State Machine
Every status of a food delivery order, from placed to delivered, including restaurant rejection, no rider and customer cancellation.
Drawing diagramβ¦
State machine for a food order: Placed, Paid, Sent to Restaurant, Accepted (or Rejected / Auto-cancelled if no response in 3 minutes, both refunded), Preparing, Rider Assigned (or Rider Search Timeout, retried), Ready for Pickup, Picked Up, Delivered. Customer cancellation is free before Preparing and charged after.
stateDiagram-v2 [*] --> Placed Placed --> Paid Paid --> SentToRestaurant SentToRestaurant --> Accepted SentToRestaurant --> Rejected: Restaurant declines SentToRestaurant --> AutoCancelled: No response in 3 min Accepted --> Preparing Accepted --> CancelledFree: Customer cancels Preparing --> RiderAssigned Preparing --> RiderSearchTimeout RiderSearchTimeout --> RiderAssigned: Retry Preparing --> CancelledCharged: Customer cancels RiderAssigned --> ReadyForPickup ReadyForPickup --> PickedUp PickedUp --> Delivered Rejected --> Refunded AutoCancelled --> Refunded CancelledFree --> Refunded Delivered --> [*] Refunded --> [*] CancelledCharged --> [*]
A 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.
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.