Design a Metro and Bus Booking Platform
Search public-transit journeys and book capacity across metro and bus services without overselling.
Problem statement
For this exercise, assume riders search dated metro and bus journeys, select one itinerary, place a short capacity hold, pay, and receive a ticket. Operators publish routes, trips, stops, fares, and capacity.
A trip may use open capacity rather than assigned seats; holds expire automatically, payment callbacks may be duplicated or delayed, and a sold-out trip must never be oversold. Design search, availability, holds, booking, payment reconciliation, ticket issuance, cancellation, and operator updates.
Exclude vehicle dispatch and real-time vehicle tracking.
What to build
- Operators publish versioned routes, stops, dated trips, fares, and capacity.
- Riders search eligible direct or transfer itineraries for a date.
- A rider holds capacity, pays, and receives one confirmed ticket without overselling.
- A rider cancels an eligible ticket and capacity is returned exactly once.
At scale
- Assume 30 million searches and two million booking attempts per day.
- Search targets p95 below 700 milliseconds; hold and booking commands target p95 below two seconds.
- A capacity hold lasts five minutes.
- Confirmed bookings must never exceed a trip's published capacity.