CloudSketch AI Logo
FeaturesTemplatesPricingEnterpriseAboutContactLog in
πŸŒ™β˜€οΈ
Log inStart free
Home/Templates/System Design Interview Classics

πŸ“ System Design Interview Classics Β· Sequence

Movie Ticket Booking (BookMyShow-style)

How seat booking avoids double-selling: seats are locked for a few minutes during payment, and released if payment fails or times out.

More System Design Interview Classics templates

Drawing diagram…

What this diagram shows

  • Seats are locked in Redis with a 10-minute expiry
  • The booking is confirmed only after payment succeeds
  • Expired locks free the seats automatically

Prompt used

Seat booking sequence: the user picks a show and seats in the app. The booking service tries to lock the seats in Redis with a 10-minute expiry; if any seat is already locked it asks the user to choose again. It creates a pending booking in the database and sends the user to the payment gateway. On payment success the booking is confirmed, seats are marked sold and an e-ticket is sent. On failure or timeout the lock expires and seats become free.

Mermaid code
sequenceDiagram
  actor U as User
  participant APP as App
  participant BS as Booking Service
  participant R as Redis Seat Locks
  participant DB as Booking DB
  participant PG as Payment Gateway
  participant N as Notification Service
  U->>APP: Choose show and seats
  APP->>BS: Book seats A5, A6
  BS->>R: Lock A5, A6 for 10 minutes
  alt Seats free
    R-->>BS: Locked
    BS->>DB: Create pending booking
    BS-->>APP: Go to payment
    APP->>PG: Pay
    alt Payment success
      PG-->>BS: Success webhook
      BS->>DB: Confirm booking, mark seats sold
      BS->>N: Send e-ticket
      N-->>U: E-ticket by SMS and email
    else Failure or timeout
      PG-->>BS: Failed
      BS->>DB: Cancel booking
      Note over R: Lock expires, seats free again
    end
  else Already locked
    R-->>BS: A5 taken
    BS-->>APP: Pick other seats
  end

Related templates

C4 ArchitectureProSystem Design Interview Classics

URL Shortener System Design

The classic interview design for a service like bit.ly: short code generation, fast redirects from a cache, and click analytics processed separately.

SequenceSystem Design Interview Classics

Chat App Message Delivery (WhatsApp-style)

How a one-to-one chat message is delivered in a WhatsApp-style system, with sent, delivered and read ticks, and push notifications when the receiver is offline.

Data FlowSystem Design Interview Classics

Social News Feed (Twitter-style)

How posts reach followers' feeds: fan-out on write for normal users, fan-out on read for celebrities, and a ranked feed built from a cache.

C4 ArchitectureProSystem Design Interview Classics

Ride Matching System (Uber-style)

The core of a ride-hailing app: drivers stream their locations, a geo index finds nearby drivers, and a matching service offers the trip to the best one.

FlowchartSystem Design Interview Classics

API Rate Limiter (Token Bucket)

How a token bucket rate limiter decides whether to let an API request through, using Redis so all servers share the same counts.

DeploymentProSystem Design Interview Classics

Notification Service Design

A notification system that sends email, SMS and push messages at scale: one API, a queue per channel, user preferences, and retries.