44. Design Ride-Hailing with Surge Pricing (Uber / Rapido)
1
The interview prompt2
44.1 What do you ask first?3
44.2 How big is this, really?4
44.3 What are the doors?5
44.4 What do we store?6
44.5 What does the whole system look like?7
44.6 How are location updates handled?8
44.7 How does matching work?9
44.8 How does surge pricing work?10
44.9 How does the trip state machine work?11
44.10 What would you say in the last five minutes?12
Score yourself13
Variations to practise14
Sources15
Code lab44. Design Ride-Hailing with Surge Pricing (Uber / Rapido)
Sources
3 min read+10 XP
Source notes
- Geospatial cells, H3 and driver indexes: see Chapter 18 and its source notes (Uber's H3).
- Atomic assignment and idempotent events: Chapters 17 and 24. Real-time connections: Chapter 21.
- Driver counts, ride volumes, update intervals, speeds, fare constants and surge formula are interview assumptions agreed in Step 1, not any company's real pricing. Arithmetic computed 2026-10-08.
- Driver index with stale expiry, ETA vs straight-line ranking, atomic dispatch, smoothed and capped surge, idempotent trip states and fares: tested 2026-10-08 (
code/ch44_ride_hailing.py, all checks pass).