BookMyShow System Design
Difficulty: MEDIUMCategory: LLDFrequency: 1Asked On 2025-02-05
Problem Statement
Design the core backend system of BookMyShow (or similar movie/venue ticket booking platforms). The system should allow users to search for movies, browse theaters, select seats, and book tickets in a concurrent and scalable manner.
Functional Requirements
1.User Management
•Users should be able to sign up, log in, and manage profiles.
•Maintain booking history per user.
2.Movie & Show Management
•Movies have metadata (title, language, genre, duration, cast, rating).
•Shows are scheduled for a movie at a specific theater, screen, and time.
3.Theater & Seat Management
•Each theater contains multiple screens.
•Each screen has a fixed seating layout (rows, seats, categories like Silver, Gold, Platinum).
•System must support real-time seat availability tracking.
4.Booking & Payments
•Users can select seats and book tickets.
•Handle concurrency → if multiple users try to book the same seat at the same time, only one should succeed.
•Integrate with Payment Gateway (mocked in design).
5.Notifications
•Notify users of booking confirmation via email/SMS.
6.Cancellations & Refunds
•Users can cancel tickets before showtime.
•Trigger refund workflow.
Non-Functional Requirements
•Scalability → Millions of users booking simultaneously.
•Concurrency Handling → Prevent double-booking of seats.
•Extensibility → Should support concerts, sports events in future.
•Fault-Tolerance → If payment fails, seat must be released.
•Low Latency → Fast seat availability updates.
Design Hints (OOP + Patterns)
•Core Classes/Entities:
•User, Movie, Theater, Screen, Show, Seat, Booking, Payment.
•Key Relationships:
•A Theater → multiple Screens.
•A Screen → multiple Shows.
•A Show → seats + bookings.
•A Booking → user, show, seats, payment status.
•Concurrency Control:
•Use locking (optimistic/pessimistic) or seat reservation with expiry.
•Design Patterns:
•Observer Pattern → Notifications.
•Factory Pattern → Payment gateways.
•Singleton → Central booking service.
✅ Example:
"Design the LLD for BookMyShow. Define classes for movies, theaters, screens, shows, seats, users, and bookings. Show how the system handles seat availability, concurrent booking requests, payments, and notifications. Discuss trade-offs in concurrency handling and scalability."