BookMyShow system design discussion

Difficulty: MEDIUMCategory: LLDFrequency: 1Asked On 2025-04-03

Problem Statement

Design the core backend system of BookMyShow (or any online movie/event ticket booking platform) that allows users to search movies/events, select showtimes, and book seats while ensuring consistency in seat allocation.


Functional Requirements (FR)


User Management


•Users can register/login with email/phone.
•Maintain user profile (name, contact info, payment methods, booking history).


Movie & Event Management


•Add/list movies/events by theater/city.
•Manage metadata (title, language, genre, duration, ratings).


Theater & Show Management


•Each theater has multiple screens.
•Each screen has multiple seats (different types: normal, recliner, premium).
•A show = movie + screen + time slot.
•Admins can add/remove shows.


Seat Booking


•Users can view available seats for a show.
•Select and block seats.
•Confirm booking with payment.
•Ensure no double-booking (seat concurrency handling).


Payment


•Integrate with external payment gateways.
•Maintain booking status (pending, confirmed, failed, refunded).


Notifications


•Send confirmation (SMS/email/notification) after successful booking.


Non-Functional Requirements (NFR)


•Consistency: No two users can book the same seat.
•Performance: Search and seat availability must be fast.
•Scalability: Handle high traffic (festivals, blockbuster releases).
•Reliability: Transactions must be atomic (either seat is booked or not).
•Extensibility: Should support not just movies but concerts, sports, events.


Core Entities & Attributes


•User: userId, name, email, phone, bookings[]
•Movie/Event: movieId, title, language, duration, genre, rating
•Theater: theaterId, name, location, screens[]
•Screen: screenId, name, seatLayout[]
•Seat: seatId, row, column, type, status (Available, Blocked, Booked)
•Show: showId, movieId, screenId, startTime, seatMap
•Booking: bookingId, userId, showId, seats[], status, paymentId
•Payment: paymentId, bookingId, amount, method, status


APIs / Operations


User APIs

•registerUser(name, email, phone)
•getUserBookings(userId)

Movie APIs

•listMovies(city, date)
•getMovieDetails(movieId)

Show APIs

•getShows(movieId, city, date)
•getSeatAvailability(showId)

Booking APIs

•blockSeats(showId, seatIds, userId)
•confirmBooking(bookingId, paymentDetails)
•cancelBooking(bookingId)

Payment APIs

•initiatePayment(bookingId, amount, method)
•verifyPayment(paymentId)


Key Challenges to Discuss


Concurrency in Seat Booking

•How to ensure no two users book the same seat? (locking, optimistic concurrency, seat-blocking with expiry).

Database Schema Design

•Relations between User, Movie, Show, Seat, Booking.

Trade-offs

•Strong consistency vs high availability in distributed seat booking.
•Pre-blocking seats vs booking directly.

Extensibility

•Supporting other event types (sports, concerts).
•Loyalty points, offers, coupons.


✅ This problem statement lets you cover core LLD aspects like class diagram (User, Booking, Show, Seat, Payment), services (BookingService, PaymentService, NotificationService), and trade-offs in seat allocation concurrency.

Solution

Comments