Sign in to keep reading
“Uber” is free with an account. Your progress and bookmarks follow you across devices.
Sign in to continueDesign Uber - This system design covers real-time location tracking, proximity-based driver matching, geo-spatial indexing with Redis GeoHash, and scalable ride-matching at scale.
“Uber” is free with an account. Your progress and bookmarks follow you across devices.
Sign in to continueThink Beyond the Happy Path
Could you answer these today? Tick what you already know.
Design a ride-sharing platform like Uber that allows riders to request rides, matches them with nearby drivers in real-time, and provides navigation for drivers. The system should:
What are interesting talk points or challenges in designing Uber compared to Design Yelp?
FR1 – Request Ride and Get Estimates
Rider should be able to request a ride with source/destination and get fare estimates.
FR2 – Match Nearby Driver
Rider should be able to match a nearby driver within a minimal wait time (< 30 seconds).
FR3 – Accept Ride and Navigate
Driver should be able to accept ride requests and navigate to the rider's location.
NFR1 – Low Latency Matching
The system should prioritize low-latency for ride matching to ensure quick response times for both driver and rider.
NFR2 – Strong Consistency
The system should ensure strong consistency on rider-driver matching. Specifically:
NFR3 – High Availability
The system should be highly available and minimize downtime, ensuring requests can be processed 24/7.
NFR4 – High Throughput
The system should be able to handle high throughput during peak hours or events.
Requirement Summary
| Functional Requirements (FRs) | |
|---|---|
| Name | Description |
| 1. Request Ride and Get Estimates | Rider requests a ride with source/destination and receives fare estimates. |
| 2. Match Nearby Driver | Match rider with nearby available driver within < 30 seconds. |
| 3. Accept Ride and Navigate | Driver accepts ride requests and gets navigation to rider location. |
| Non-Functional Requirements (NFRs) | |
|---|---|
| Name | Description |
| 1. Low Latency Matching | Quick response times for driver-rider matching. |
| 2. Strong Consistency | No double-booking: one driver per ride, one ride per driver. |
| 3. High Availability | System operational 24/7 with minimal downtime. |
| 4. High Throughput | Handle traffic spikes during peak hours and events. |
To tie these requirements together into a coherent architecture, we begin with the foundational building blocks of the system.
Ride — The Trip Request
A Ride represents a trip request from a rider. It tracks:
Swipe to see all columns
| Rides Table | |||
|---|---|---|---|
| Field | Type | Key | Description |
ride_id | UUID | PK | Unique ride identifier. |
rider_id | UUID | FK → users(user_id) | Who requested the ride. |
Driver — The Service Provider
A Driver represents a driver in the system. It tracks:
Swipe to see all columns
| Drivers Table | |||
|---|---|---|---|
| Field | Type | Key | Description |
driver_id | UUID | PK | Unique driver identifier. |
| name | TEXT | NOT NULL | Driver name. |
| status | |||
For designing Uber, some additional APIs are required. For example, APIs for drivers to report their real-time locations and status changes (picked up, dropped off etc).
Keep in mind that system design interview time is limited. It's recommended spending no more than 5-6 minutes on API design. Instead, focus on two key areas that will help you stand out:
So the suggested approaches are:
1. Rider requests a ride
POST /ride/cost --> <Ride_Information> (rideId, cost...)
{
riderId (or JWT token),
source, (raw address)
destination,
}
2. Rider accepts a ride
PATCH /ride/rider/accept --> 200 or <estimated waiting time to get a driver>
{
rideId
true (accept) / false (deny)
}
3. Driver accepts a ride request
PATCH /ride/driver/accept --> 200 or <navigation info to rider location>
{
rideId
true (accept) / false (deny)
}
driver_id |
| UUID |
| FK → drivers(driver_id), NULLABLE |
| Assigned driver. |
source_lat | FLOAT | NOT NULL | Pickup latitude. |
source_lng | FLOAT | NOT NULL | Pickup longitude. |
dest_lat | FLOAT | NOT NULL | Destination latitude. |
dest_lng | FLOAT | NOT NULL | Destination longitude. |
estimated_fare | DECIMAL | NOT NULL | Calculated fare estimate. |
actual_fare | DECIMAL | NULLABLE | Final fare after completion. |
| status | ENUM | NOT NULL | requested/matched/in_progress/completed/cancelled. |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT now() | Request timestamp. |
| ENUM |
| NOT NULL |
| online/offline/on_ride. |
vehicle_info | JSONB | NOT NULL | Vehicle details (model, plate, color). |
| rating | DECIMAL | NOT NULL DEFAULT 5.0 | Driver rating. |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT now() | Registration timestamp. |