Command Palette

Search for a command to run...

PHASE 12Advanced ~7 min· topic 18 of 39Level 4

System 12.18 — Food Delivery (HLD)

In one line

E-commerce + live geo tracking + delivery assignment — the order lifecycle with real-time tail.

0/39 · 0%

Think of it like this

The Swiggy/Zomato LLD from Phase 4, but now zoomed out to the whole city: matching thousands of live orders to thousands of delivery partners at once, in real time.

Key ideas

  1. 01

    Services: restaurant/catalog (menu, availability), ordering, payment, dispatch (delivery assignment), tracking, notification.

  2. 02

    Dispatch: runner pool with live positions; assignment score = ETA + load + rating; atomic claim per rider (12.15 trick).

  3. 03

    Order lifecycle with timeouts: every stage has SLA timers (prep 15min → escalate if exceeded).

  4. 04

    Live tracking: driver GPS → Kafka → redis geo → user sees ETA + map — the geo stream from Uber, now per-order.

  5. 05

    Scale: peak meal times 10x average — queue everything non-critical; restaurant availability cached with short TTL.

  6. 06

    Consistency: order state strong-ish (single order service writes); positions eventual; notifications async.

  7. 07

    Failures: driver cancels after pickup → reassignment + refund logic; restaurant rejects → auto-move to next candidate.

  8. 08

    Interview flow: present as commerce + dispatch + tracking; the dispatch atomic claim is the memorable detail.

Code & diagrams

FoodDeliveryArchitecturediagram

Three live, moving pieces (order, kitchen, delivery partner) all reading and writing one shared state.

Rendering diagram…

Explain without notes

01

Restaurant confirms a 45-min prep the system promised in 20 — trace the SLA computation and the compensation.

Practice

01

Design the dispatch scoring formula and the reassignment on driver-cancel-with-food.

Trade-offs

  • ↔

    Aggressive dispatch = lower delivery time + higher refund risk; balance with promised-time math.

Completion checklist

  • I can combine order lifecycle + dispatch + live tracking into one coherent design.

Back to phase