Project 15
Food delivery platform
Order coordination, dispatch
Brief
A three-sided marketplace: customers order from restaurants, restaurants accept and prepare, couriers deliver — one long-running distributed workflow across independent parties.
Targets
100k orders/hour at mealtime peaks · order placement p99 < 1 s · every order reaches a terminal state (no stuck orders) · restaurant tablets tolerate going offline.
Must cover
- Geospatial lookup for courier dispatch (→ 210).
- Order compensation — every forward step has a designed undo (→ 139).
- Restaurant acceptance — the accept/reject/timeout flow after payment authorization (P).
- Courier reassignment — re-dispatch when a courier cancels or goes dark (P).
Design challenges
- The order saga in full (→ 139, 122): payment authorized → restaurant accepts → courier assigned → picked up → delivered, with compensations at every stage (restaurant rejects after payment; no courier found; customer cancels mid-preparation). Orchestration vs. choreography — chosen and defended.
- Restaurant availability: menu and hours staleness vs. rejection rate (→ 129).
- Courier dispatch (→ 210): batching nearby orders, offer timeouts, re-dispatch — Project 14's matching with preparation-time prediction as an input.
- Stuck-order detection: timers and watchdogs on every non-terminal state (→ 121; → 202 — ahead, Part 12).
- Three parties, three views: per-party BFFs over shared order truth (→ 148).
- Mealtime spikes: pre-scaling vs. autoscaling lag; queues where latency allows (→ 95, 110).
Out of scope
Pricing and promotions engine; courier earnings and payouts (→ Projects 8–9).