Ride Sharing (Uber)

Match riders with nearby drivers, track trips through their lifecycle, and price them.

Hard50 minDriver matchingTrip state machinePricing strategy

Design a ride-sharing service like Uber or Ola: riders request trips, the system matches nearby drivers, and trips move through a lifecycle to payment and ratings. The LLD focus is on driver matching, the trip state machine, pricing strategies, and race conditions when multiple riders want the same driver.

Requirements

Functional

  • Riders request a ride with pickup, drop, and vehicle type (Bike, Auto, Mini, Sedan).
  • Show a fare estimate before confirming (base + distance + time, with surge).
  • Match the request to a nearby available driver; driver accepts or declines within 15 seconds; on decline/timeout, try the next driver.
  • Trip lifecycle: REQUESTED -> DRIVER_ASSIGNED -> DRIVER_ARRIVED -> IN_PROGRESS -> COMPLETED, plus CANCELLED (by rider or driver).
  • Drivers go online/offline and stream location updates.
  • Payment on completion (wallet, card, cash); mutual ratings.

Non-functional

  • A driver must never be assigned to two trips at once.
  • Matching should feel instant (< a few seconds) in dense areas.
  • Location updates are high-volume; nearby-driver lookup must be efficient.
  • Matching and pricing algorithms are swappable per city.

Try it first

Set a timer, sketch your own design on paper, then compare it with the reference walkthrough.

50:00

Complete & continue

Defend it out loud

The AI interviewer will probe your design for Ride Sharing (Uber) and score it.

Mock interview