Interaction Between Components in a BookMyShow-like System

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

Problem Statement

Design the interactions between different components of a movie ticket booking platform (similar to BookMyShow). The focus is on how services communicate with each other to ensure a seamless user journey — from browsing movies to booking and payment.


Functional Requirements


1.<span></span>Movie Discovery & Search
2.<span></span>Users should be able to search movies by name, genre, language, city, and date.
3.<span></span>Show available theatres and timings for a selected movie.
4.<span></span>Seat Selection
5.<span></span>Display seat layout for a show.
6.<span></span>Allow users to select available seats.
7.<span></span>Handle concurrency so two users cannot book the same seat at the same time.
8.<span></span>Booking Flow
9.<span></span>Lock selected seats for a limited time while the user completes the payment.
10.<span></span>Release the seats if payment is not completed in time.
11.<span></span>Payment Integration
12.<span></span>Redirect users to payment service.
13.<span></span>On success, confirm booking and generate tickets.
14.<span></span>On failure/timeout, release locked seats.
15.<span></span>Notifications
16.<span></span>Send booking confirmation via email/SMS/push notification.


Core Components & Their Interactions


1.<span></span>User Service – Manages user accounts, profiles, and authentication.
2.<span></span>Movie/Show Service – Stores movie info, theatres, show timings.
3.<span></span>Seat Inventory Service – Manages seat layouts and availability.
4.<span></span>Booking Service – Orchestrates seat locking, booking, and ticket confirmation.
5.<span></span>Payment Service – Handles payment gateway interactions.
6.<span></span>Notification Service – Sends booking confirmation to users.


Example Workflow (Interactions)


1.<span></span>Search Flow
2.<span></span>User → Movie Service → Fetches movies & shows for city/date.
3.<span></span>Seat Selection Flow
4.<span></span>User selects show → Seat Inventory Service → Returns available seats.
5.<span></span>User picks seats → Seat Inventory locks seats for X minutes.
6.<span></span>Booking & Payment Flow
7.<span></span>Booking Service → Payment Service → External Gateway.
8.<span></span>On success: Booking Service confirms booking, marks seats as booked.
9.<span></span>On failure: Booking Service → Seat Inventory releases locked seats.
10.<span></span>Notification Flow
11.<span></span>Booking Service → Notification Service → Sends confirmation ticket to user.


Deliverables


1.<span></span>Clearly defined service responsibilities.
2.<span></span>Sequence diagrams showing interaction between services (e.g., seat booking flow).
3.<span></span>APIs between services (e.g., lockSeats, confirmBooking, releaseSeats).
4.<span></span>Handling of concurrency and failure scenarios.


Solution

Comments