Uber Design | Expertifie - sulabh84/SystemDesign GitHub Wiki
Functional Requirement
- Rider
- Request for a ride -> provide destination
- see near most driver
- ETA of the driver, ETA to their destination
- Ratings
- Payments -> Out of scope
- History
- Driver
- Driver should be notified about the ride, should be able to accept or reject and confirmation
- Location of the customer and share their live location
- start and end the ride
- Ratings
Non Functional requirement
- High availability
- Low latency
- Real time location of the driver and the rider
- ETAs should be real time
- Consistency -> its okay if drivers location on the app is not consistent with their current location. Delay of few secs is fine
- Consistency required for booking the ride
Estimations
- QPS
- Capacity
High Level Design
- APIs
- Registration Apis -> Driver, Rider (HTTP)
- Login Apis -> Driver, Rider (HTTP)
- Request Ride -> Rider (HTTP with BOSH)
- Accept Ride -> Driver
- Web sockets are always established with the driver so that requests for the rides can be sent to the driver, alternative is to do long polling for the driver
- Web socket connection established for rider as well as driver once the ride is accepted (Rider with server, Driver with server)
- Share live location of both rider and driver
- Show the ETAs to the driver/rider
- When driver is arriving
- During the ride
- Start ride, End Ride
- AddRatings -> Driver, Rider (HTTP)
- GetRideHistory -> Driver, Rider (HTTP)
Database Design
- Rider
- RiderId
- RiderName
- Contact Details
- CreationTimeStamp
- OverAllRating
- Driver
- DriverId
- DriverName
- Contact Details
- CreationTimestamp
- Car details
- OverAllRating
- Ride
- RideId
- DriverId
- RiderId
- RideTime
- PaymentDetails
- RideDuration
- CreationTimestamp
- Source
- Destination
- RideStatus
- Rating from Rider to Driver
- Rating from Driver to Rider
Questions
- What is surge price?