Design a ride-hailing app like Uber / Ola
Design the matching part of a ride-hailing service. A rider requests a ride from where they are standing; the system finds a nearby driver, offers them the trip, and confirms the match. Drivers move continuously and can decline.
About this problem
“Design a ride-hailing app like Uber / Ola” is a hard-level problem in the matching under time pressure family. Two sides need to find each other, and one of them is a human who is waiting.
The key challenge: A person is standing on a street with a phone in their hand. There is no cooking time and no processing window to hide latency inside. Few problems in this app have less slack.
Time budgets: Match: ~10 seconds, and every second is visible.
The worked solution for Ride matching goes through why those budgets shape the design, stage by stage.
Before you start
You will work this in five timed stages. Here is what each one asks you to think about. None of it is the answer; the answers unlock in the workspace below once you have written your own.
- Stage 1 · Requirements · 5 min
- What is the one thing about this product that makes it different from a marketplace with no time pressure?
- Is one driver offered at a time, or several at once? That changes correctness, not just UX.
- Say the write:read ratio for location updates. It is surprising.
- Stage 2 · Actors and lifecycle · 6 min
- The system makes several silent decisions per request. Name them.
- What if nobody accepts at all? That is not an edge case, it happens constantly.
- What if the driver accepts and then the rider cancels in the same second?
- Stage 3 · Numbers · 6 min
- Drivers ping every 4 seconds. How many pings per second is that?
- How many ride requests per second, compared to pings?
- Do you need to store the location history? Ask what it is for.
- Stage 4 · High-level design · 12 min
- Latitude and longitude are two dimensions. Indexes sort on one. How do you bridge that?
- What holds the live positions, physically?
- Where does the trip state machine live, and who owns it?
- Stage 5 · Deep dive and tradeoffs · 14 min
- The offer protocol is where riders are lost. Go deep there.
- What happens at surge time when demand triples in fifteen minutes?
- What is the precise correctness guarantee on accept?
Work it through
Five stages, gated. You write your answer for each stage before its model answer unlocks. That is the core of the method.
Done all five? The diagrams, numbers, trade-offs and follow-ups for this problem are on the worked solution page, to check your own design against.
How it is really built
Write your own answer first. Then read how teams who run this at scale describe it. Their constraints were real, and the write-ups often say what their choices cost.
- H3 — indexing the globe ↗Uber's open-source hexagonal grid, an alternative to geohash cells for this kind of lookup.