Skip to content

cazy8/Hotel-Management-System-Mern-Stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏨 Hotel Management System

MongoDB Express.js React Node.js JWT Selenium

A full-stack hotel management system with 6 integrated modules β€” room booking, customer portal, employee & payroll management, inventory tracking, and supplier management. Built with the MERN stack.

Features Β· Architecture Β· Tech Stack Β· Getting Started Β· API Reference Β· Screenshots


πŸ“‹ Table of Contents


πŸš€ Features

Customer Portal

Feature Description
User Registration Customer sign-up with name, email, phone, and password
Authentication Login system with email/password verification
Room Browsing Browse available rooms by type, capacity, and pricing
Room Booking Book rooms with guest details, check-in/out dates
Room Filtering Filter rooms by type (Single, Double, Superior), capacity, and price range

Admin Dashboard

Module Features
Room Management Add, view, update, and delete room listings with type, capacity, and pricing
Employee Management Complete employee CRUD with department, designation, and contact details
Payroll System Record and track salary payments with employee linkage
Inventory Management Track hotel inventory items with quantity, restock alerts, and history
Supplier Management Manage suppliers with contact info and full purchase history tracking
Booking Management View and manage all room bookings with guest information

Technical Highlights

  • JWT-based admin authentication with bcrypt password hashing
  • RESTful API design with modular Express route groups
  • PDF report generation using jsPDF with auto-table support
  • Responsive UI with Bootstrap 5 and styled-components
  • Selenium test suite with automated login flow testing

πŸ“Έ Screenshots

Customer Portal Room Browsing
Customer Portal Room Browsing
Admin Dashboard Management Panel
Admin Dashboard Management

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        CLIENT (React)                        β”‚
β”‚                      localhost:3000                           β”‚
β”‚                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚ Customer  β”‚  β”‚  Room    β”‚  β”‚ Employee β”‚  β”‚ Inventoryβ”‚    β”‚
β”‚  β”‚ Portal    β”‚  β”‚ Booking  β”‚  β”‚ Manager  β”‚  β”‚ Manager  β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜    β”‚
β”‚        β”‚            β”‚              β”‚              β”‚           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚ Supplier β”‚  β”‚  Admin   β”‚  β”‚Dashboard β”‚  β”‚  Auth    β”‚    β”‚
β”‚  β”‚ Manager  β”‚  β”‚  Login   β”‚  β”‚          β”‚  β”‚  System  β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                      Axios HTTP Client                        β”‚
β”‚                    (REST API Requests)                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚ HTTP (JSON)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     SERVER (Express.js)                        β”‚
β”‚                      localhost:5000                            β”‚
β”‚                                                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚                    Middleware Layer                       β”‚  β”‚
β”‚  β”‚  CORS β”‚ cookie-parser β”‚ express.json β”‚ JWT Verify       β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                             β”‚                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚/customer β”‚/booking  β”‚/room     β”‚/employeesβ”‚/inventoryβ”‚    β”‚
β”‚  β”‚/supplier β”‚/adminlog β”‚/supplier β”‚/paidsalarβ”‚          β”‚    β”‚
β”‚  β”‚          β”‚          β”‚ history  β”‚ ies      β”‚          β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                             β”‚                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚              Mongoose ODM (Schema + Models)              β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚ MongoDB Driver
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    MongoDB Atlas (Cloud)                       β”‚
β”‚                                                               β”‚
β”‚  Collections:                                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”‚
β”‚  β”‚customers β”‚ β”‚rooms     β”‚ β”‚bookings  β”‚ β”‚employees β”‚        β”‚
β”‚  β”‚adminloginβ”‚ β”‚inventory β”‚ β”‚suppliers β”‚ β”‚paidsalar β”‚        β”‚
β”‚  β”‚          β”‚ β”‚          β”‚ β”‚supplier  β”‚ β”‚ ies      β”‚        β”‚
β”‚  β”‚          β”‚ β”‚          β”‚ β”‚ history  β”‚ β”‚          β”‚        β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Tech Stack

Backend

Technology Version Role
Node.js β‰₯ 14 JavaScript runtime
Express.js 4.17 Web framework & REST API routing
Mongoose 8.19 MongoDB ODM with schema validation
MongoDB Atlas β€” Cloud-hosted NoSQL database
JWT 9.0 JSON Web Token authentication
bcrypt.js 2.4 Password hashing (salted)
cookie-parser 1.4 HTTP cookie handling
CORS 2.8 Cross-Origin Resource Sharing
dotenv 10.0 Environment variable management
nodemon 2.0 Hot-reload development server
concurrently 6.2 Run backend + frontend simultaneously

Frontend

Technology Version Role
React 17.0.2 UI component framework
React Router DOM 5.2 Client-side routing (Switch/Route)
Axios 0.21 HTTP client for API communication
Bootstrap 5.1 Responsive CSS framework
Bootstrap Icons 1.5 Icon library
styled-components 5.3 CSS-in-JS component styling
jsPDF + AutoTable 2.3 / 3.5 PDF report generation and export
React Icons 4.3 Icon components (FontAwesome, etc.)
validator 13.6 Input validation (email, phone)
SoloAlert 1.1 Custom alert/notification popups

Testing

Technology Role
Selenium WebDriver Browser automation for E2E tests
pytest Python test runner with fixtures
Chrome DevTools Screenshot capture on test pass/fail

πŸ“¦ Getting Started

Prerequisites

  • Node.js β‰₯ 14 and npm β‰₯ 6
  • MongoDB Atlas account (free tier works) or local MongoDB instance
  • Python 3.8+ (only for Selenium tests)

Installation

# Clone the repository
git clone https://github.com/cazy8/Hotel-Management-System-Mern-Stack.git
cd Hotel-Management-System-Mern-Stack

Backend Setup

cd backend
npm install

# Create environment file (see Environment Variables section)
cp .env.example .env
# Edit .env with your MongoDB URI and JWT secret

# Start backend server (with hot-reload)
npm run dev

Backend runs on http://localhost:5000

Frontend Setup

cd frontend
npm install

# Start React development server
npm start

Frontend runs on http://localhost:3000

Run Both Simultaneously

# From the backend directory
npm run dev
# This uses concurrently to launch both servers

πŸ” Environment Variables

Create a backend/.env file using the provided template:

cp backend/.env.example backend/.env
Variable Description Example
MONGO_CONNECT MongoDB Atlas connection string mongodb+srv://<user>:<pass>@cluster.mongodb.net/Hotel_DB
JWT_SECRET Secret key for signing JWT tokens Any random 64+ character string
PORT Backend server port (optional) 5000

Generate a Secure JWT Secret

node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"

⚠️ Never commit .env files to version control. The .gitignore is configured to exclude them.


πŸ“‘ API Reference

Authentication

Method Endpoint Description
POST /adminlogin/add Register new admin
GET /adminlogin/retrieve Get all admin records
POST /adminlogin/login Admin login

Customer Management

Method Endpoint Description
POST /customer/register Customer registration
POST /customer/login Customer login

Room Management

Method Endpoint Description
POST /room/add Add new room
GET /room/ Get all rooms
GET /room/:id Get room by ID
PUT /room/update/:id Update room details
DELETE /room/delete/:id Delete room

Room Booking

Method Endpoint Description
POST /booking/add Create new booking
GET /booking/ Get all bookings
GET /booking/:id Get booking by ID
DELETE /booking/delete/:id Cancel booking

Employee Management

Method Endpoint Description
POST /employees/add Add employee
GET /employees/ Get all employees
GET /employees/:id Get employee by ID
PUT /employees/update/:id Update employee
DELETE /employees/delete/:id Delete employee

Payroll

Method Endpoint Description
POST /paidsalaries/add Record salary payment
GET /paidsalaries/ Get all salary records

Inventory Management

Method Endpoint Description
POST /inventory/add Add inventory item
GET /inventory/ Get all inventory
GET /inventory/:id Get item by ID
PUT /inventory/update/:id Update item
DELETE /inventory/delete/:id Delete item

Supplier Management

Method Endpoint Description
POST /supplier/add Add supplier
GET /supplier/ Get all suppliers
GET /supplier/:id Get supplier by ID
PUT /supplier/update/:id Update supplier
DELETE /supplier/delete/:id Delete supplier
POST /supplierhistory/add Add supplier history record
GET /supplierhistory/ Get all history records

πŸ“ Project Structure

Hotel-Management-System-Mern-Stack/
β”‚
β”œβ”€β”€ backend/                          # Express.js API Server
β”‚   β”œβ”€β”€ server.js                     # Entry point β€” Express app, MongoDB connection, route mounting
β”‚   β”œβ”€β”€ package.json                  # Backend dependencies and scripts
β”‚   β”œβ”€β”€ .env.example                  # Environment variable template
β”‚   β”‚
β”‚   β”œβ”€β”€ models/                       # Mongoose schemas & models
β”‚   β”‚   β”œβ”€β”€ adminlogin.js             # Admin user schema (username, password, role)
β”‚   β”‚   β”œβ”€β”€ rooms.js                  # Room model
β”‚   β”‚   β”œβ”€β”€ customer/
β”‚   β”‚   β”‚   └── customerModel.js      # Customer schema (name, email, phone, password)
β”‚   β”‚   β”œβ”€β”€ room-booking/
β”‚   β”‚   β”‚   └── bookingModel.js       # Booking schema (guest info, room type, dates)
β”‚   β”‚   β”œβ”€β”€ emp-manager/
β”‚   β”‚   β”‚   β”œβ”€β”€ employees.js          # Employee schema (name, dept, designation, salary)
β”‚   β”‚   β”‚   └── paidsalaries.js       # Salary payment records
β”‚   β”‚   β”œβ”€β”€ employee-manager/
β”‚   β”‚   β”‚   └── roomModel.js          # Room schema (type, capacity, price, description)
β”‚   β”‚   β”œβ”€β”€ inventory-manager/
β”‚   β”‚   β”‚   └── inventoryModel.js     # Inventory schema (item, quantity, restock level)
β”‚   β”‚   └── supplier-manager/
β”‚   β”‚       β”œβ”€β”€ suppliermodel.js      # Supplier schema (name, contact, items supplied)
β”‚   β”‚       └── supplierhistorymodel.js # Supplier transaction history
β”‚   β”‚
β”‚   └── routes/                       # Express route handlers
β”‚       β”œβ”€β”€ adminlogin.js             # Admin auth routes (register, login, retrieve)
β”‚       β”œβ”€β”€ rooms.js                  # Room routes
β”‚       β”œβ”€β”€ customer/
β”‚       β”‚   └── customerRoute.js      # Customer registration & login
β”‚       β”œβ”€β”€ room-booking/
β”‚       β”‚   └── bookingRoute.js       # Booking CRUD
β”‚       β”œβ”€β”€ emp-manager/
β”‚       β”‚   β”œβ”€β”€ employees.js          # Employee CRUD
β”‚       β”‚   └── paidsalaries.js       # Salary records
β”‚       β”œβ”€β”€ employee-manager/
β”‚       β”‚   └── RoomRoute.js          # Room CRUD
β”‚       β”œβ”€β”€ inventory-manager/
β”‚       β”‚   └── inventoryRoute.js     # Inventory CRUD
β”‚       └── supplier-manager/
β”‚           β”œβ”€β”€ supplierRoute.js      # Supplier CRUD
β”‚           └── supplierhistoryRoute.js # Supplier history
β”‚
β”œβ”€β”€ frontend/                         # React Application
β”‚   β”œβ”€β”€ package.json                  # Frontend dependencies and scripts
β”‚   β”œβ”€β”€ public/
β”‚   β”‚   β”œβ”€β”€ index.html                # HTML entry point
β”‚   β”‚   β”œβ”€β”€ favicon.ico               # Browser tab icon
β”‚   β”‚   β”œβ”€β”€ cover.jpeg               # Hotel cover image
β”‚   β”‚   └── logo.png                  # Hotel logo
β”‚   β”‚
β”‚   └── src/
β”‚       β”œβ”€β”€ App.js                    # Root component β€” React Router configuration
β”‚       β”œβ”€β”€ index.js                  # ReactDOM entry point
β”‚       β”œβ”€β”€ App.css                   # Global styles
β”‚       β”œβ”€β”€ context.js                # React Context for room data
β”‚       β”œβ”€β”€ data.js                   # Static room data
β”‚       β”œβ”€β”€ Contentful.js             # Contentful CMS integration
β”‚       β”‚
β”‚       β”œβ”€β”€ components/
β”‚       β”‚   β”œβ”€β”€ auth/                 # Authentication
β”‚       β”‚   β”‚   β”œβ”€β”€ cusLogin.js       # Customer login form
β”‚       β”‚   β”‚   β”œβ”€β”€ CusRegister.js    # Customer registration form
β”‚       β”‚   β”‚   └── adminRegister.js  # Admin registration
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ room/                 # Room Management (Admin)
β”‚       β”‚   β”‚   β”œβ”€β”€ AddRoom.js        # Add new room form
β”‚       β”‚   β”‚   β”œβ”€β”€ ViewAllRooms.js   # Room listing table
β”‚       β”‚   β”‚   β”œβ”€β”€ ViewOneRoom.js    # Single room details + edit
β”‚       β”‚   β”‚   β”œβ”€β”€ RoomBookings.js   # Create booking form
β”‚       β”‚   β”‚   └── ViewAllRoomBookings.js # All bookings list
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ employee/             # Employee Management
β”‚       β”‚   β”‚   β”œβ”€β”€ AddEmployee.js    # Add employee form
β”‚       β”‚   β”‚   β”œβ”€β”€ ViewEmployee.js   # Employee listing
β”‚       β”‚   β”‚   β”œβ”€β”€ ViewOneEmployee.js # Employee details + edit
β”‚       β”‚   β”‚   β”œβ”€β”€ AddPaidSalary.js  # Record salary payment
β”‚       β”‚   β”‚   └── ViewPaidSalary.js # Salary payment history
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ inventory/            # Inventory Management
β”‚       β”‚   β”‚   β”œβ”€β”€ AddInventory.js   # Add inventory item
β”‚       β”‚   β”‚   β”œβ”€β”€ ViewAllInventory.js # Inventory listing
β”‚       β”‚   β”‚   β”œβ”€β”€ ViewOneInventory.js # Item details + edit
β”‚       β”‚   β”‚   └── RestockInventory.js # Restock existing items
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ supplier/             # Supplier Management
β”‚       β”‚   β”‚   β”œβ”€β”€ AddSupplier.js    # Add supplier form
β”‚       β”‚   β”‚   β”œβ”€β”€ ViewAllSuppliers.js # Supplier listing
β”‚       β”‚   β”‚   β”œβ”€β”€ ViewOneSupplier.js # Supplier details + edit
β”‚       β”‚   β”‚   β”œβ”€β”€ ViewAllSupplierHistoryRecords.js # Purchase history
β”‚       β”‚   β”‚   └── ViewOneSupplierHistoryRecords.js # Single record
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ layouts/              # Shared Layout Components
β”‚       β”‚   β”‚   β”œβ”€β”€ topnav.js         # Top navigation bar
β”‚       β”‚   β”‚   β”œβ”€β”€ Navbar.js         # Customer navigation
β”‚       β”‚   β”‚   β”œβ”€β”€ EMPsidenav.js     # Employee section sidebar
β”‚       β”‚   β”‚   β”œβ”€β”€ EmpDetailsSideNav.js # Employee details sidebar
β”‚       β”‚   β”‚   β”œβ”€β”€ Roomsidenav.js    # Room management sidebar
β”‚       β”‚   β”‚   β”œβ”€β”€ InventorySideNav.js # Inventory sidebar
β”‚       β”‚   β”‚   └── Supsidenav.js     # Supplier sidebar
β”‚       β”‚   β”‚
β”‚       β”‚   β”œβ”€β”€ Dashboard.js          # Admin dashboard overview
β”‚       β”‚   β”œβ”€β”€ Banner.js             # Hero banner component
β”‚       β”‚   β”œβ”€β”€ FeaturedRooms.js      # Featured rooms carousel
β”‚       β”‚   β”œβ”€β”€ Hero.js               # Hero section
β”‚       β”‚   β”œβ”€β”€ Navbar.js             # Main navigation
β”‚       β”‚   β”œβ”€β”€ Room.js               # Room card component
β”‚       β”‚   β”œβ”€β”€ RoomsContainer.js     # Room list container
β”‚       β”‚   β”œβ”€β”€ RoomsFilter.js        # Room filtering controls
β”‚       β”‚   β”œβ”€β”€ RoomsList.js          # Room grid layout
β”‚       β”‚   β”œβ”€β”€ Services.js           # Hotel services section
β”‚       β”‚   β”œβ”€β”€ StyledHero.js         # Styled hero with background
β”‚       β”‚   β”œβ”€β”€ Title.js              # Section title component
β”‚       β”‚   └── Loading.js            # Loading spinner
β”‚       β”‚
β”‚       β”œβ”€β”€ pages/                    # Page-level components
β”‚       β”‚   β”œβ”€β”€ Home.js               # Landing page
β”‚       β”‚   β”œβ”€β”€ Rooms.js              # All rooms page
β”‚       β”‚   β”œβ”€β”€ SingleRoom.js         # Individual room page
β”‚       β”‚   └── Error.js              # 404 error page
β”‚       β”‚
β”‚       └── images/                   # Static assets (room images, logos, GIFs)
β”‚
β”œβ”€β”€ frontend/tests/                   # E2E Test Suite
β”‚   └── selenium/python/
β”‚       β”œβ”€β”€ conftest.py               # pytest fixtures (driver, test user creation)
β”‚       β”œβ”€β”€ pytest.ini                # pytest configuration
β”‚       β”œβ”€β”€ requirements.txt          # Test dependencies (selenium, pytest)
β”‚       β”œβ”€β”€ test_cases.md             # Test case documentation
β”‚       └── tests/
β”‚           └── test_login.py         # Login flow tests (valid + invalid)
β”‚
β”œβ”€β”€ image.png                         # Screenshot β€” Customer portal
β”œβ”€β”€ image-1.png                       # Screenshot β€” Room browsing
β”œβ”€β”€ image-2.png                       # Screenshot β€” Admin dashboard
β”œβ”€β”€ image-3.png                       # Screenshot β€” Management panel
β”œβ”€β”€ .gitignore                        # Git ignore rules
β”œβ”€β”€ LICENSE                           # MIT License
└── README.md                         # This file

πŸ§ͺ Testing

Selenium E2E Tests

The project includes automated browser tests for the login workflow:

cd frontend/tests/selenium/python

# Install test dependencies
pip install -r requirements.txt

# Run tests (both servers must be running)
pytest tests/ -v

# Run in headless mode
HEADLESS=1 pytest tests/ -v
Test Case Description Expected Result
TC-001 Login with valid credentials Redirects to /rooms or /dashboard
TC-002 Login with invalid password Alert shown, stays on login page

Environment Variables for Tests

Variable Default Description
BASE_URL http://localhost:3000 Frontend URL
BACKEND_URL http://localhost:5000 Backend API URL
HEADLESS 0 Set to 1 for headless Chrome
SCREENSHOT_DIR ./screenshots Screenshot output directory

πŸ”’ Security

This project follows security best practices:

  • βœ… Environment Variables β€” All secrets (MongoDB URI, JWT key) stored in .env, never in source code
  • βœ… .gitignore configured β€” .env files excluded from version control
  • βœ… bcrypt password hashing β€” User passwords hashed with salt before storage
  • βœ… JWT authentication β€” Stateless token-based auth for admin routes
  • βœ… CORS restricted β€” Only localhost:3000 allowed in development
  • βœ… Clean git history β€” No credentials in commit history

Production Recommendations

Area Recommendation
Database Create restricted Atlas user (not admin), whitelist specific IPs
JWT Use RS256 algorithm with key rotation
HTTPS Enable TLS for all traffic in production
Rate Limiting Add express-rate-limit middleware
Input Validation Add server-side validation with express-validator
Helmet Add helmet middleware for security headers

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ‘€ Author

Harsh Gupta β€” @cazy8 Β· LinkedIn


πŸ“œ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


If you found this useful, consider giving it a ⭐

About

Full-stack Hotel Management System with 6 integrated modules -- rooms, bookings, employees, payroll, inventory & suppliers. MERN Stack with JWT auth, PDF exports, and Selenium E2E tests.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors