A robust backend system for a movie reservation service built with Node.js, Express, and MongoDB.
Movie Reservation System is a robust backend solution for managing cinema ticket bookings. Built with Node.js and MongoDB, it offers user authentication, movie and showtime management, seat reservation, and an admin dashboard. This system provides a secure and efficient API for handling movie theater operations, from user registration to ticket cancellation.
- User authentication and authorization (JWT)
- User roles (admin and regular user)
- Movie management (CRUD operations)
- Showtime scheduling
- Seat reservation system
- Reservation management for users
- Admin dashboard for overall system management
- Secure API with proper error handling
-
Clone the repository
-
Install dependencies:
npm install
- Create a
.env
file in the root directory with the following content:
PORT=3000
MONGODB_URI=mongodb://localhost:27017/movie_reservation_system
JWT_SECRET=your_jwt_secret_here
- Adjust the values according to your environment.
To start the server: npm start
The server will start running at http://localhost:3000
(or the port you specified in the .env file).
POST /api/auth/register
: Register a new userPOST /api/auth/login
: Login user
GET /api/movies
: Get all moviesPOST /api/movies
: Create a new movie (Admin only)PUT /api/movies/:id
: Update a movie (Admin only)DELETE /api/movies/:id
: Delete a movie (Admin only)
GET /api/showtimes
: Get all showtimesPOST /api/showtimes
: Create a new showtime (Admin only)PUT /api/showtimes/:id
: Update a showtime (Admin only)DELETE /api/showtimes/:id
: Delete a showtime (Admin only)
POST /api/reservations
: Create a new reservationGET /api/reservations/user
: Get user's reservationsDELETE /api/reservations/:id
: Cancel a reservationGET /api/reservations/all
: Get all reservations (Admin only)
To test the API endpoints, you can use Postman or any other API testing tool. Make sure to include the JWT token in the Authorization header for protected routes.
Example:
Authorization: Bearer <your_jwt_token>
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License with an Attribution Clause - see the LICENSE file for details.