Design a Movie Ticket Booking System

Medium
Real World SystemsObserverFactorySingleton

Problem Statement

Design a movie ticket booking system (like BookMyShow or Fandango) that allows users to:

  • Browse movies and showtimes
  • Select seats from a seat map
  • Book and cancel tickets
  • Handle concurrent booking (prevent double-booking)

Design Requirements

Key Entities:

  • Movie — Title, genre, duration, rating
  • Theater — Screens, location
  • Screen — Physical screen with seating layout
  • Show — A movie at a theater at a specific time
  • Seat — Individual seat with row/column/type (Normal, Premium, VIP)
  • Booking — Ties user, show, and seats together
  • Payment — Handles payment processing

Key Behaviors:

  • searchShows(movie, date) → list of shows
  • getSeatMap(showId) → 2D grid of seats
  • bookSeats(showId, seatIds, userId) → Booking or throws if unavailable
  • cancelBooking(bookingId) → releases seats

!Constraints

- A screen has 10–300 seats arranged in rows - Seat types: Normal ($10), Premium ($15), VIP ($25) - A booking can have 1–10 seats - Seats must be locked during payment (max 10 min hold) - Two users cannot book the same seat for the same show - Cancellation is allowed up to 2 hours before show time
Output

Run your code to see output here.