SevyDevy

Design a cab booking app (low-level design)

PremiumLow-level designMedium

  • Driver matching
  • State machine
  • Strategy pattern

Quick answer

This low-level design interview question asks you to design a cab booking app (low-level design). Aim for a design that is modelled as clear classes, interfaces and relationships that can handle new requirements without a rewrite. Interviewers want to see how you name responsibilities, keep classes small and reason about change.

The problem

Cab booking app low level design, in the style of Uber or Ola: build the object model for riders, drivers, fare estimates, ride requests, matching, trips and ratings. The hard parts are exactly one driver per request when two accept at once, a trip state machine, and fare rules with surge.

A rider enters a pickup and a drop location, sees a fare estimate for each vehicle category, and requests a ride. The system offers the request to nearby available drivers; the first to accept gets the trip. The driver arrives, starts the trip, ends it, and the rider pays the final fare. Both sides rate each other. Riders and drivers can cancel under rules.

What must a cab booking app (low-level design) do?

  • Matching: Offer the request to the 5 nearest available drivers of that category within 3 km, one at a time for 15 seconds each, or to all at once; the first accept wins.
  • Trip lifecycle: REQUESTED, DRIVER_ASSIGNED, DRIVER_ARRIVED, IN_PROGRESS, COMPLETED, and CANCELLED_BY_RIDER, CANCELLED_BY_DRIVER, EXPIRED.
6 more requirementsUnlock to see all

How well must it do it?

  • Correct under concurrency: Two drivers accepting the same request at the same time must result in exactly one assignment; a driver on a trip must never be offered another.
  • Fast matching: Finding nearby drivers must not scan every driver in the city.
2 more requirementsUnlock to see all

What scale should you design for?

Use these numbers in your estimates.

The scale numbers unlock with this questionUnlock

Key concepts

  • Driver matching
  • State machine
  • Strategy pattern
  • Fare calculation
  • Surge pricing
  • Observer pattern

How you’ll practise

6 short steps · save and come back any time
  1. Requirements
  2. Core objects
  3. Class relationships
  4. Key flows
  5. Extensibility
  6. Wrap-up

Lala, personalized to you, gives a hint when you ask and reviews your design when you are ready.

What do interviewers look for?

In any low-level design round.

  • Lists the use cases before writing classes
  • Gives each class one clear responsibility
  • Uses interfaces where behaviour is likely to change
  • Applies a design pattern only when it solves a real problem
  • Handles edge cases and invalid states explicitly
  • Walks through one use case end to end with the model

Questions people ask about this interview question

Which design type is this question?
It is a low-level design question. You design a cab booking app (low-level design) and explain your choices the way you would in an interview.
Is this question asked at entry level?
It is marked Medium. Entry-level engineers can practise it, but it expects you to reason about requirements and trade-offs, not only list components.
What should I cover first?
Start with the use cases and the core entities, then the responsibilities of each one. Agree on scope with the interviewer before you design anything.
Can I practise it for free?
It is a premium question. Sign up and unlock it once for 10 credits; it then stays unlocked. When you finish, Lala, your personalized AI mentor, can review your design for 30 credits.

Related questions

Updated · Written by the SevyDevy team

Premium questionSign up free, then unlock it