Dev Skills

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.

  1. 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.
  2. 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?
  3. 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.
  4. 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?
  5. 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?
Prefer to read first? The worked solution, end to end →

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.

Loading your progress…

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.

Before you leave
Try this problem again in a week without reading anything. Comparing what you write then with what you wrote today shows you what stuck.
Stuck, or new to this?Read the full worked solutionAll five stages end to end, with the diagrams and the costs, written out the way you would say it. Best read after you have had a go.Read it →

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.