Every online driver streams a GPS point every few seconds into a geo index sharded by map cell. A ride request finds nearby drivers in that index, ranks them by real road ETA, and offers the trip to one driver at a time. A trip service runs the ride's state machine, a stream processor turns supply and demand into surge prices, and payment happens asynchronously when the trip ends.
Functional requirements
- Riders and drivers sign up; drivers are verified (licence, vehicle)
- Riders see nearby cars and an upfront fare estimate
- Request a ride and get matched to a nearby driver within seconds
- Live tracking of the driver before pickup and during the trip, with ETA
- Trip lifecycle: requested → matched → arrived → in progress → completed / cancelled
- Automatic payment, receipts and two-way ratings
Non-functional requirements
- Matching in a few seconds; location updates reflected within ~1 s
- Never assign one driver to two riders at once
- Highly available per city: one region's outage shouldn't stop others
- Payments are exactly-once and auditable
- Handles rush-hour and event spikes several times the average
Extensions
- Shared rides (pooling) that match riders heading the same way.
- Scheduled rides booked in advance.
- Fraud detection on GPS spoofing and payment patterns.
- Machine-learned ETAs trained on location history.
- Food delivery reusing the same dispatch and tracking platform.