Commerce, payments and delivery · senior
Case study: live order tracking (Swiggy / Zomato)
A strong order-tracking design renders a server-driven order state machine, receives updates by push with a polling fallback, animates the rider marker between location points without re-rendering the screen, catches up after the app returns from the background, and always shows how fresh the data is.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- Order states come from the server: placed → accepted → preparing → picked_up → arriving → delivered (or cancelled); ignore stale or out-of-order updates by sequence number; ETA comes from the server.
- Transport: push (SSE/WebSocket on web; FCM/APNs plus a socket in the app) with a polling fallback and backoff. Uber built its RAMEN push platform because polls were about 80% of gateway traffic and drained batteries.
- Location every few seconds: interpolate and animate the marker between points with requestAnimationFrame; update the map imperatively, not by re-rendering a React tree per tick; throttle.
- Resume: when the app or tab comes back, fetch a snapshot first, then subscribe (catch-up); heartbeats detect dead connections.
- Staleness: 'Updated 30 s ago', an offline banner, and a Retry; the last known state stays visible in lifts and basements.
- Cost: lazy-load the map SDK; a static map image on low-end devices; cache tiles.
- Dinner peak (about 1M active orders): push fan-out, adaptive update rates (faster when 'arriving'), jitter on reconnects; notifications for state changes (ongoing notifications/live activities in the app).
- Accessibility and privacy: a text timeline equivalent of the map; rider location only during the active order; masked phone numbers.
The red pen
Common traps: mistake → fix
Mistake: Compute ETA on the client
Fix: inconsistent with the server and support teams.
Mistake: Re-render the whole map component on each location ping
Fix: jank and battery drain.
Mistake: Poll every second
Fix: load, data and battery cost.
Mistake: Hide that data is stale
Fix: users think the rider stopped.
Easy to hard
Questions interviewers ask, easy to hard
- Design the order-tracking screen for a food delivery app.
- How do location updates reach the customer?
- The app was in the background for 10 minutes. What happens when it opens?
- Dinner peak has a million active orders. What changes?
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.