# LLD Case Study: Movie Ticket Booking (BookMyShow)

> Design a seat booking system with cities, theatres, shows and seats, and handle temporary seat locks and concurrent bookings correctly. Free notes, key...

Canonical: https://www.internhack.in/roadmaps/tracks/system-design/lld-bookmyshow
Last updated: 2026-11-28

Design a seat booking system with cities, theatres, shows and seats, and handle temporary seat locks and concurrent bookings correctly.

Intermediate · about 5 hours · difficulty 4/5

Learn first: [LLD Case Study: Parking Lot](https://www.internhack.in/roadmaps/tracks/system-design/lld-parking-lot), [Relational Databases and SQL for Design](https://www.internhack.in/roadmaps/tracks/system-design/relational-databases)

Movie or event booking is a favourite LLD problem in India because its hard part, **two people trying to book the same seat**, is a real concurrency problem.

### Requirements

- Browse movies by city; list theatres and **shows** (a movie on a screen at a time).
- View the seat map with seat types (regular, premium, recliner) and prices.
- Select seats, hold them for a few minutes while the user pays, then confirm or release.
- Cancel bookings and refund per policy.

### Core model

City, Theatre, Screen, Seat (row, number, type), Movie, Show (movie, screen, start time, pricing), **ShowSeat** (seat status per show: AVAILABLE, LOCKED, BOOKED), Booking (user, show, seats, amount, status), Payment. Separating Seat from ShowSeat matters: the same physical seat has a different status for every show.

### Seat locking

1. User selects seats. The system **locks** them atomically for that show with an expiry (say 5 to 10 minutes).
2. Payment succeeds: seats move to BOOKED, booking confirmed.
3. Payment fails or times out: locks are released.

Implementation choices:

- **Database**: a conditional update (UPDATE show_seat SET status = 'LOCKED', locked_until = ... WHERE id IN (...) AND status = 'AVAILABLE') and check the row count; or SELECT ... FOR UPDATE inside a transaction.
- **Optimistic locking** with a version column.
- **In-memory lock service or Redis** with expiries, backed by a DB constraint as the source of truth.

All selected seats must lock together or none should.

### Patterns

Strategy for pricing (weekend, premium seats, dynamic pricing), State for booking status, Observer to push seat map updates to other viewers, Factory for payment methods.

### Pitfalls

- Checking availability and then booking in two separate steps (a race).
- Locks without expiry, leaving seats stuck when users abandon payment.
- Partial locks when one of four selected seats is taken.

You are ready to move on when you can explain and code an all-or-nothing seat lock with expiry that stays correct under 100 concurrent attempts on the same seats.

## Key concepts

- **Theatre, screen, show and seat model**
- **Seat vs ShowSeat status**
- **Temporary seat locks with expiry**
- **All-or-nothing locking**
- **Booking state machine**
- **Pricing strategy**
- **Live seat map updates**

## Mini project

Build a booking service with an in-memory or Postgres store: lock seats with expiry, confirm on payment, release on timeout. Write a test that fires 100 concurrent requests for the same 2 seats and asserts exactly one booking succeeds.

## Check yourself

Why should seat status live on a per-show entity rather than on the physical seat, and how do you release locks when a user closes the app mid-payment?

## Free resources

- [Awesome Low Level Design](https://github.com/ashishps1/awesome-low-level-design) (GitHub)
- [PostgreSQL explicit locking](https://www.postgresql.org/docs/current/explicit-locking.html) (PostgreSQL)
- [State pattern](https://refactoring.guru/design-patterns/state) (Refactoring.Guru)

Previous: [LLD Case Study: Parking Lot](https://www.internhack.in/roadmaps/tracks/system-design/lld-parking-lot) · Next: [LLD Case Study: Expense Sharing (Splitwise)](https://www.internhack.in/roadmaps/tracks/system-design/lld-splitwise)

## More in Low-Level Design (LLD) and Object-Oriented Design

- [OOP Principles and SOLID](https://www.internhack.in/roadmaps/tracks/system-design/oop-and-solid)
- [Design Patterns for LLD](https://www.internhack.in/roadmaps/tracks/system-design/design-patterns)
- [Approaching an LLD Problem: Requirements, Entities and UML](https://www.internhack.in/roadmaps/tracks/system-design/lld-approach-and-uml)
- [LLD Case Study: Parking Lot](https://www.internhack.in/roadmaps/tracks/system-design/lld-parking-lot)
- [LLD Case Study: Movie Ticket Booking (BookMyShow)](https://www.internhack.in/roadmaps/tracks/system-design/lld-bookmyshow)
- [LLD Case Study: Expense Sharing (Splitwise)](https://www.internhack.in/roadmaps/tracks/system-design/lld-splitwise)
- [The Machine Coding Round](https://www.internhack.in/roadmaps/tracks/system-design/machine-coding-round)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [System Design Roadmap](https://www.internhack.in/roadmaps/tracks/system-design)
