sydepsystem design atlas

Food Delivery Platform

Coordinate order, restaurant prep, and courier assignment end to end.

AdvancedCommerce
Customer AppClientAPI GatewayNetworkingOrder State MachineComputeRestaurant AppClientCourier AppClientOrder StoreStorageStatus UpdatesMessaging

An order flows through a state machine spanning restaurant acceptance, prep time, and courier dispatch, with each state transition pushed to the customer in real time so they can track progress.

When to use it

  • A single order lifecycle spans multiple independent parties (customer, restaurant, courier)
  • Customers expect live status updates across the whole fulfilment journey

Trade-offs

  • Courier assignment and restaurant prep timing are both real-world unknowns the system can only estimate
  • State machine must handle cancellations and reassignments at every stage gracefully

Components used

Mobile AppAPI GatewayWorkflow OrchestratorThird-party ClientDocument DatabaseNotification Service

How it works

  • Three independent parties — customer, restaurant and courier — must be coordinated with no shared clock or database.
  • The order progresses through an explicit state machine, and each transition emits an event that updates the other parties' views in real time.
  • Courier assignment is deliberately delayed until the food is nearly ready, so the courier is not left waiting and the estimate stays accurate.

Used in the wild

  • Meal delivery marketplaces.
  • Grocery and convenience fulfilment with picker and driver roles.
  • Any three-sided logistics flow with live tracking.

Good to know

  • The delivery estimate is the hardest part of the product and mostly a prediction problem — kitchen prep time, courier availability and traffic all vary independently.
  • Restaurants routinely accept orders and then cannot fulfil them, so the state machine needs a rejection path at every stage rather than only at the start.