BookMyShow System Design

Difficulty: MEDIUMCategory: HLDFrequency: 1Asked On 2025-06-13

Problem Statement

Design a scalable ticket booking platform (like BookMyShow) that allows users to search for movies/events, check availability, book seats, and make payments. The system should handle high concurrency, real-time seat availability, and reliability.


Functional Requirements (FR)


User Management

•Users can register/login.
•Maintain user profiles, booking history, and preferences.


Event/Movie Management

•Admins can add/update movies, events, shows, and theaters.
•Maintain show schedules with seat layouts and pricing.


Search & Discovery

•Search movies/events by location, date, genre, or popularity.
•Filter by theaters, timings, or language.


Booking & Seat Selection


•Show real-time seat availability.
•Reserve seats temporarily while payment is in process.
•Confirm booking once payment is successful.
•Handle cancellations and refunds.


Payment Handling


•Integrate with payment gateways for card, UPI, or wallet payments.
•Secure payment processing.


Notifications


•Send booking confirmations via email, SMS, or app notifications.
•Notify users about cancellations, reschedules, or upcoming shows.


Non-Functional Requirements (NFR)


•Scalability: Handle millions of users, concurrent bookings, and multiple shows simultaneously.
•Consistency: Ensure real-time seat availability without double-booking.
•Availability: High uptime, especially during peak showtimes or popular releases.
•Low Latency: Fast search and booking experience.
•Security: Secure authentication, authorization, and payment handling.


Suggested Components / System Architecture


Client Application

•Web/mobile app for browsing shows, booking tickets, and making payments.

API Gateway

•Entry point for client requests, handles routing and authentication.

User Service

•Manages user accounts, booking history, and preferences.

Movie/Event Service

•Stores information about movies, events, theaters, shows, and seat layouts.

Booking Service

•Handles seat reservation, booking confirmation, and cancellations.
•Implements locking mechanisms to prevent double booking.

Payment Service

•Integrates with external payment gateways.
•Handles payment verification and refund processing.

Notification Service

•Sends emails, SMS, or push notifications for booking status.

Database Layer

•Relational DB: Store user profiles, shows, bookings, and transactions.
•In-Memory DB (Redis/ Memcached): Store real-time seat availability and caching for quick lookups.
1.Analytics & Recommendation (Optional)
•Track user behavior, show popularity, and provide personalized recommendations.


Data Flow (High-Level)


1.User searches for a movie/event → Movie Service returns results.
2.User selects show and seats → Booking Service checks real-time seat availability (from cache).
3.Seat reservation locked temporarily → User makes payment → Payment Service validates transaction.
4.Booking confirmed → Update Database & Cache, notify user via Notification Service.
5.Optional analytics recorded for recommendations and reporting.


Key Design Considerations


•Concurrency Handling: Use distributed locks or atomic operations to prevent double booking.
•Caching: Use Redis or similar for fast seat availability lookup.
•Scalability: Horizontal scaling for user, booking, and payment services.
•Reliability: Ensure bookings are persisted and payment failures handled gracefully.
•Extensibility: Support other event types like concerts, plays, or sports events.


Solution

Comments