There are many online portals where you can book tickets for movies and live events. Some famous examples are bookmyshow and ticketmaster.
Prerequisites:
System design introduction : 3 principles of distributed system, 5 step guide for System design.
System design concepts & components : Horizontal scaling, Database, Architectural patterns, Caching, Message queues
Functional requirements
The user should be able to see the list of cities -> choose a city -> see the list of theatres in that city -> choose a theatre -> see the shows running in that theatre -> choose a show -> see the seating layout along with already booked and available seats -> reserve a seat -> make payment within stipulated time -> the seat is booked and we receive confirmation via email or sms.
We can also view the ratings and comments for the movie.
Non-functional requirements
1. The system should always be available
2. The system should be responsive. The user experience should be smooth.
We primarily have 2 types of data here
Let us consider that the interviewer did not ask for any calculations. So we do not need to perform any calculations.
As an exercise consider you are the interviewer. What calculation would you ask?
We have 2 approaches to design the system.
In the first diagram our app server is doing too many things. It is responsible for calling the apis of PVR or Inox, it is also responsible to handle the payments and notify the users. Let us use single responsibility principle and break down our app server.
Architectural pattern to use?
A mix of SOA and microservices.
This microservice based system has many advantages.
Let us revisit our non-functional requirements