Skip to content

Movie Ticket Booking (LLD) — Detailed#

classDiagram
  direction TB

  class Theater {
    +id
    +name
    +city
    +halls: List~Hall~
  }
  class Hall {
    +id
    +name
    +rows
    +shows: List~Show~
  }
  class Movie {
    +id
    +title
    +duration
    +genre
    +lang
    +rating
  }
  class Show {
    +id
    +movie: Movie
    +start
    +end
    +hall: Hall
    +seats: List~ShowSeat~
    +pricing: PricingPolicy
  }
  class Seat {
    +id
    +row
    +col
    +type
  }
  class ShowSeat {
    +show: Show
    +seat: Seat
    +state: SeatState
    +heldBy
    +heldUntil
  }
  class SeatState {
    <<enumeration>>
    AVAILABLE
    HELD
    BOOKED
  }

  class User
  class Booking {
    +id
    +user: User
    +show: Show
    +seats: List~ShowSeat~
    +totals
    +status: BookingState
    +idempotencyKey
  }
  class BookingState {
    <<enumeration>>
    PENDING
    PAYMENT_INIT
    CONFIRMED
    CANCELLED
    FAILED
  }
  class PaymentService
  class PricingPolicy {
    <<interface>>
    +price(seat, show) Money
  }
  class HoldService {
    +hold(seats, user, ttl)
    +release(seats)
  }
  class BookingSaga

  Theater *-- Hall
  Hall *-- Show
  Show *-- "many" Seat
  Show *-- "many" ShowSeat
  Show --> PricingPolicy
  User -- Booking
  Booking *-- "many" ShowSeat
  Booking --> BookingState
  ShowSeat --> SeatState
  BookingSaga ..> HoldService
  BookingSaga ..> PaymentService

Glossary & fundamentals#

Concepts referenced in this design. Each row links to its canonical page; the tag column shows whether it is a high-level (HLD) or low-level (LLD) concept.

Tag Concept What it is Page
HLD Idempotency & retries safe re-execution, backoff + jitter idempotency-retries