Movie ticket booking web application with MERN stack (MongoDB, Express, React, NodeJS) & Tailwind CSS
Demo: https://cinema-booking-client.vercel.app/
The purpose of this project is to improve my full-stack web development skills, learning front-end technologies like React and Tailwind CSS, and backend technologies like Node.js, Express, and MongoDB.
- React v18.2.0
- React Router Dom v6.14.2
- React Hook Form v7.45.4
- Tailwind CSS v3.3.3
- Vite v4.4.8
- NodeJS
- Mongoose v7.4.2
- Express v4.18.2
- MongoDB
- And more...
There are 3 roles on this website with corresponding permissions:
Role | Permisson / Feature |
---|---|
👀 Viewer (Not logged in) | 1. View released showtimes by choosing from - Movie in home page - Cinema's theater in cinema page - Cinema's schedule in schedule page 2. View released showtimes for today and the future 3. View seats for released showtimes on the showtime page |
👤 User | 1. All Viewer permissions 2. Purchase tickets on the showtime page 3. View purchased tickets on the ticket page |
👑 Admin | 1. All User permissions 2. View all showtimes for any date 3. Manage cinemas 4. Manage theaters - View theater's row, column, seats information 5. Manage showtimes - Search & filter & sort showtimes - View details of booked seats 6. Manage movies 7. Manage user & admin |
Viewer have access to these pages for viewing released showtimes.
Home page
- Select a movie
- Select a date by either typing it into the input or selecting from the calendar to view showtimes
- Optionally, select a cinema to filter
- Click on a showtime to view seats
Cinema page
- Select a cinema
- Select a date to view its theaters and showtimes
- Click on a showtime to view seats
Schedule page
- Select a cinema
- Select a date to view its schedule for each theater
- Click on a showtime to view seats
Showtime page
- View available seats (white boxes) and unavailable seats (gray boxes)
- Viewer will be redirected to the login page if they click "Purchase"
User have all viewer permission. Including, the ability to purchase and view their own tickets
Register / Login
- To create an user account, fill in a username, email, and password, then click "Register"
- To log in, fill in username and password, then click "Login"
Showtime page / Purchase tickets
- Select available seats
- Click the "Purchase" button and confirm to purchase tickets
Admin have all permission.
Create an admin account
- Register a new user.
- Access MongoDB and locate the user's data.
- Update the user's role to
admin
. - The user will now become admin.
Note: After obtaining the first admin account, this user can assign admin roles to others using the User page.
Home page
- Admin can view theater's row, column, seats information.
- Admin can view all showtimes for any date
Cinema page
Add a new cinema
- Type the cinema's name.
- Click the "Add" button
Edit a cinema's name
- Click the "Edit" button
- Enter the new cinema name and click "Save"
Delete a cinema
- Click the "Delete" button and confirm by clicking "OK"
Add a theater to the cinema
- Fill the letter of the last row and the number of the last column seat, then click "Add"
Delete the last added theater
- Click the "Delete" button at the bottom of the page
Add showtimes
-
Select a movie
-
Fill in the following values:
- Showtime: Movie start time
- Repeat: For example, 1 means the showtime is added for today only, while 4 mean the showtime is added for today and the next 3 days.
- Release now: Check to release this showtime for viewers and users to view or book
Auto increase
- Showtime: Check to automatically update the showtime value based on the ending time of this showtime, along with a specified gap. This is useful when adding consecutive movies, ensuring appropriate spacing between showtimes.
- Date: Check to enable automatic increase of showtime to the next day if it exceeds 24 hours
- Gap: The minimum duration between movie showtimes
Rounding
- 5-min: Round up the auto-increased showtime value to the nearest 5 minutes, e.g., 12:21 -> 12:25
- 10-min: Round up the auto-increased showtime value to the nearest 10 minutes, e.g., 12:21 -> 12:30
-
Click the "Add" button
- The new showtimes will added to the theater. An eye-slash icon indicates that this showtime is not yet released
Showtime page
- View details of booked seats
- Release, unrelease, or delete the showtime by clicking the button in the top-right corner
Movie page
Add a movie
- Fill in the movie name, URL of the poster, and the length in hours (optional) and minutes. Then, click "Add" to add the movie.
Delete a movie
- Click the "Delete" button and confirm by clicking "OK"
Search page
- Filter & sort showtime and select to release / unreleased / delete them
- Click a "View" button to view seats
User page
- View usernames, email addresses, roles, and tickets of users.
- Click the "View Tickets" button to see a user's purchased tickets.
- Click the "Set Admin" or "Set User" button to change the user's role.
- Click the "Delete" button to delete the account.
- Download the code
- Create .env file in /server
PORT=8080
DATABASE=<your MongoDB connection string URI>
JWT_SECRET=<any random JWT secret>
JWT_EXPIRE=30d
JWT_COOKIE_EXPIRE=30
- Start server side
cd server
npm install
npm start
- Start client side
cd client
npm install
npm run dev