A full-stack web application designed to streamline hotel room bookings and management. This system provides a clean, animated, and professional user interface for both guests and hotel owners, ensuring a seamless experience from browsing to booking.
This project is a comprehensive Hotel Rooms Management System built with the MERN stack (MySQL, Express, React, Node.js). It features a robust backend API that handles authentication, room availability, and booking transactions, along with a dynamic frontend for a smooth user experience.
-
Role-Based Access Control:
- Guests (Users): Can register, log in, browse available rooms, view room details, and book rooms for specific dates. They can also view their personal booking history.
- Hotel Owner (Admin): Has full access to a protected dashboard to manage all aspects of the hotel, including adding, editing, and deleting rooms, as well as viewing and removing all bookings.
-
Dynamic Booking System:
- Real-time price calculation based on the number of nights and guests.
- Professional date-overlap validation on the backend to prevent double-booking, ensuring data integrity with ACID-compliant transactions.
-
Interactive Admin Dashboard:
- Displays live statistics, including total rooms, number of active bookings, and monthly revenue.
- Provides full CRUD (Create, Read, Update, Delete) functionality for hotel rooms and bookings.
-
Frontend:
- React.js
- React Router
- React Bootstrap
- Axios
- Framer Motion (for animations)
- Lucide React (for icons)
-
Backend:
- Node.js
- Express.js
- MySQL2
- JSON Web Tokens (JWT) for authentication
- Bcrypt.js for password hashing
-
Database:
- MySQL
- Node.js and npm installed
- MySQL Server installed and running
-
Navigate to the
backenddirectory:cd backend -
Install dependencies:
npm install
-
Set up the database:
- Open your MySQL client (e.g., MySQL Workbench).
- Create a new database named
hotel_management. - Run the SQL script provided in the project to create the necessary tables and insert sample data.
-
Configure environment variables:
- Create a
.envfile in thebackenddirectory. - Add your database credentials and a JWT secret:
DB_HOST=localhost DB_USER=your_mysql_username DB_PASSWORD=your_mysql_password DB_NAME=hotel_management JWT_SECRET=your_super_secret_key
- Create a
-
Start the backend server:
node server.js
The server will be running on
http://localhost:5000.
-
Open a new terminal and navigate to the
frontenddirectory:cd frontend -
Install dependencies:
npm install
-
Start the frontend application:
npm start
The application will open in your browser at
http://localhost:3000.
- Admin/Owner:
- Username:
admin - Password:
1234567
- Username:
- User/Guest:
- You can register a new user account through the registration page.