Learning on Web Dev Open is free for all.

Interview Prep · System DesignDesign a ride-hailing service
← System Design

Design a ride-hailing service

Hard50 minFree, no account

Geospatial indexing, a matching problem, and state that changes every four seconds.


The question

Design the core of Uber: a rider requests a ride, a nearby driver is matched, and both track the trip.

Drivers report their location every four seconds whether or not they have a passenger.

Functional
  • Drivers publish location continuously.
  • A rider requests a ride from A to B and is matched with one driver.
  • Both see the other's live position during the trip.
  • Fare calculated at the end.
Non-functional
  • 5M active drivers; location every 4s → ~1.2M writes/sec.
  • Match within a few seconds.
  • One driver is never assigned two rides.
  • Location data is useless after a few seconds.
50:00Commit to an answer before you open the solution. Reading it first teaches you to recognise good answers, which is not the skill being tested.

Stuck?

0 of 3 hints taken

The worked solution

written by a person · not a grade

Score yourself

0 of 5 marked
  • Separated ephemeral location from durable trip state and justified it25
  • Named a geospatial index, handled neighbour cells and density skew25
  • Offered rather than assigned, with a deadline and a fallback20
  • Closed the two-riders-one-driver race atomically20
  • Switched to a direct channel once the trip started10

We run no AI here and nothing on this page grades you. The score is yours, and the useful number is the one you get on the same problem a month from now, cold.

kept in this browser only