Design Bus Booking System
Difficulty: MEDIUMCategory: HLDFrequency: 1Asked On 2025-06-24
Problem Statement
Design a high-level architecture for an online Bus Booking System that allows users to search, book, and cancel bus tickets for intercity or intracity travel. The system should support multiple bus operators, multiple routes, and real-time seat availability.
Functional Requirements:
1.Search Buses:
•Users can search for available buses between source and destination on a specific date.
•Show departure time, duration, fare, and available seats.
2.View Seat Layout:
•Show real-time seat availability and allow seat selection.
3.Book Seat:
•Allow users to select seats and confirm booking.
•Prevent double booking using locking or transactional mechanisms.
4.Cancel Booking:
•Support full or partial ticket cancellation with refund calculation.
5.Manage Operators:
•Bus operators can register buses, define routes, schedules, and fares.
6.Notifications:
•Send confirmation messages (email/SMS) for bookings and cancellations.
Non-Functional Requirements:
•Scalability: Handle high traffic during holidays and weekends.
•Consistency: Ensure accurate seat availability under concurrency.
•Reliability: Ensure no bookings are lost or duplicated due to failures.
•Low Latency: Fast search and booking experience.
•Extensibility: Should support features like coupons, ratings, or multi-modal transport integration in future.
Scope of the Design:
•Identify major components (e.g., Search Service, Booking Service, Inventory Service).
•Define interactions, data flow, and database schema at a high level.
•Consider caching, queuing, rate limiting, and database sharding strategies if needed.