Design a Ride Sharing Platform
Design Uber or Lyft. The core challenges are real-time location tracking, geo-indexed driver matching, dynamic pricing, and the trip state machine that coordinates rider, driver, and payment simultaneously.
What you will learn
- Design a geo-index that finds nearby drivers in sub-second time at massive scale
- Model the trip lifecycle as a state machine and handle partial failures at each transition
- Build a real-time location tracking system that updates millions of driver positions per second
- Explain how supply-demand imbalance triggers dynamic pricing and how that signal propagates
Uber coordinates three parties — rider, driver, and payment processor — in real time, across uncertain networks, with hard latency requirements. The surface problem (match a rider to a nearby driver) hides a web of real-time systems: a geo-index serving 200K location updates/second, a trip state machine that must survive partial failures, dynamic surge pricing that reacts to supply/demand imbalance in real time, and an earnings/payment reconciliation that runs after every trip.
Functional requirements:
- Riders request trips with pickup and destination
- System matches rider to a nearby available driver (< 500ms)
- Driver sees real-time navigation; rider sees driver ETA and live location
- Trip moves through states: requested → accepted → en route → in progress → completed
- Dynamic pricing based on local supply/demand
- Payment processed at trip end
Non-functional requirements:
- Driver location updated every 5 seconds
- Matching latency < 500ms
- Trip state is durable — survives app crashes on either side
- ETA accuracy within 10% of actual time
- High availability — a rider can't be stranded by a system outage
Create a free account to read the full chapter — advanced chapters, progress tracking, and quizzes are free with sign-up.