Skip to content

Build an complete `Hotel-Room-Booking-System` projects using React.js, Next.js, Redux.js, Node.js, Express.js, MongoDB, Tailwind-CSS & And-Design.

License

Notifications You must be signed in to change notification settings

SamiurRahmanMukul/Hotel-Room-Booking-System

Repository files navigation

Facebook Instagram Twitter LinkedIn Github

Frontend Screenshot

πŸ–οΈ Beach Resort | Hotel Room Booking System

A comprehensive full-stack hotel room booking and management system built with modern web technologies. This application provides a complete solution for hotel room reservations, user management, and administrative operations.

🌐 Live Demo

✨ Experience the Application Live ✨

Application Link Description
πŸ–₯️ Admin Panel πŸš€ Launch Admin Panel Complete management dashboard for administrators.
🌟 Frontend App πŸš€ Launch Frontend Beautiful user interface for room booking.

πŸ“‹ Table of Contents

✨ Features

πŸ” Authentication & Authorization

  • User Registration/Login with email verification
  • JWT-based authentication with access and refresh tokens
  • Password reset functionality with secure token system
  • Role-based access control (Admin/User)
  • Account status management (Active/Blocked/Verified)

🏠 Room Management

  • Room CRUD operations with image uploads
  • Room categorization (Single, Couple, Family, Presidential)
  • Room status tracking (Available, Unavailable, Booked)
  • Featured rooms highlighting
  • Advanced room filtering and search capabilities
  • Room capacity and pricing management

πŸ“… Booking System

  • Date-based booking with validation
  • Booking status management (Pending, Approved, Cancelled, etc.)
  • Booking history for users
  • Admin booking management panel
  • Automatic room status updates

⭐ Review System

  • Room reviews and ratings (1-5 stars)
  • User review management
  • Review editing and deletion
  • Average rating calculations

πŸ‘€ User Management

  • User profile management with avatar uploads
  • Admin dashboard with comprehensive statistics
  • User role management
  • Account blocking/unblocking

πŸ“Š Admin Dashboard

  • Real-time statistics (Users, Rooms, Bookings)
  • Data visualization with charts and counters
  • User and booking management
  • Room inventory management

πŸ› οΈ Technology Stack

Backend

  • Node.js - Runtime environment
  • Express.js - Web framework
  • MongoDB - NoSQL database
  • Mongoose - MongoDB object modeling
  • JWT - Authentication tokens
  • Bcrypt.js - Password hashing
  • Multer - File upload handling
  • SendGrid - Email service
  • Winston - Logging
  • Morgan - HTTP request logging
  • Helmet - Security headers
  • CORS - Cross-origin resource sharing
  • Express Rate Limit - API rate limiting

Frontend (Client)

  • Next.js 13 - React framework with SSR
  • React 18 - UI library
  • Redux Toolkit - State management
  • Ant Design - UI component library
  • Styled Components - CSS-in-JS styling
  • Axios - HTTP client
  • Day.js - Date manipulation
  • React Icons - Icon components

Admin Panel

  • React 18 - UI library
  • Redux Toolkit - State management
  • Ant Design - UI component library
  • Tailwind CSS - Utility-first CSS framework
  • React Router Dom - Client-side routing
  • React CountUp - Animated counters
  • JWT Decode - Token decoding

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend      β”‚    β”‚   Admin Panel   β”‚    β”‚    Backend      β”‚
β”‚   (Next.js)     β”‚    β”‚   (React.js)    β”‚    β”‚   (Node.js)     β”‚
β”‚                 β”‚    β”‚                 β”‚    β”‚                 β”‚
β”‚ β€’ User Interfaceβ”‚    β”‚ β€’ Admin Dashboardβ”‚   β”‚ β€’ REST API      β”‚
β”‚ β€’ Room Booking  │◄──►│ β€’ Management    │◄──►│ β€’ Authenticationβ”‚
β”‚ β€’ User Profile  β”‚    β”‚ β€’ Analytics     β”‚    β”‚ β€’ Business Logicβ”‚
β”‚ β€’ Reviews       β”‚    β”‚ β€’ CRUD Operationsβ”‚   β”‚ β€’ File Upload   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                        β”‚
                                                        β–Ό
                                               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                               β”‚    MongoDB      β”‚
                                               β”‚                 β”‚
                                               β”‚ β€’ Users         β”‚
                                               β”‚ β€’ Rooms         β”‚
                                               β”‚ β€’ Bookings      β”‚
                                               β”‚ β€’ Reviews       β”‚
                                               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“Š Database Schema

User Model

{
  userName: String (unique),
  fullName: String,
  email: String (unique),
  phone: String,
  password: String (hashed),
  avatar: String,
  gender: Enum ['male', 'female'],
  dob: Date,
  address: String,
  role: Enum ['admin', 'user'],
  verified: Boolean,
  status: Enum ['register', 'login', 'logout', 'blocked']
}

Room Model

{
  room_name: String (unique),
  room_slug: String,
  room_type: Enum ['single', 'couple', 'family', 'presidential'],
  room_price: Number,
  room_size: Number,
  room_capacity: Number,
  allow_pets: Boolean,
  provide_breakfast: Boolean,
  featured_room: Boolean,
  room_description: String,
  extra_facilities: [String],
  room_images: [{ url: String }],
  room_status: Enum ['available', 'unavailable', 'booked'],
  created_by: ObjectId (ref: Users)
}

Booking Model

{
  room_id: ObjectId (ref: Rooms),
  booking_dates: [Date],
  booking_status: Enum ['pending', 'cancel', 'approved', 'rejected', 'in-reviews', 'completed'],
  booking_by: ObjectId (ref: Users),
  reviews: ObjectId (ref: Reviews)
}

Review Model

{
  user_id: ObjectId (ref: Users),
  room_id: ObjectId (ref: Rooms),
  booking_id: ObjectId (ref: Bookings),
  rating: Number (1-5),
  message: String
}

πŸ“š API Documentation

Authentication Routes

POST /api/v1/auth/registration          - User registration
POST /api/v1/auth/login                 - User login
POST /api/v1/auth/logout                - User logout
POST /api/v1/auth/forgot-password       - Request password reset
POST /api/v1/auth/reset-password/:token - Reset password
POST /api/v1/auth/change-password       - Change password
POST /api/v1/auth/verify-email/:token   - Verify email
GET  /api/v1/auth/refresh-token         - Refresh JWT token

Room Routes

GET    /api/v1/all-rooms-list                   - Get all rooms
GET    /api/v1/get-room-by-id-or-slug-name/:id  - Get room details
GET    /api/v1/featured-rooms-list              - Get featured rooms
POST   /api/v1/create-room                      - Create room (Admin)
PUT    /api/v1/edit-room/:id                    - Edit room (Admin)
DELETE /api/v1/delete-room/:id                  - Delete room (Admin)

Booking Routes

POST /api/v1/placed-booking-order/:id     - Place booking order
GET  /api/v1/get-user-booking-orders      - Get user bookings
PUT  /api/v1/cancel-booking-order/:id     - Cancel booking
GET  /api/v1/get-all-booking-orders       - Get all bookings (Admin)
PUT  /api/v1/updated-booking-order/:id    - Update booking (Admin)

User Routes

GET    /api/v1/get-user           - Get current user
GET    /api/v1/get-user/:id       - Get user by ID (Admin)
PUT    /api/v1/update-user        - Update user profile
PUT    /api/v1/avatar-update      - Update user avatar
DELETE /api/v1/delete-user        - Delete current user
DELETE /api/v1/delete-user/:id    - Delete user by ID (Admin)
GET    /api/v1/all-users-list     - Get all users (Admin)
PUT    /api/v1/blocked-user/:id   - Block user (Admin)
PUT    /api/v1/unblocked-user/:id - Unblock user (Admin)

Review Routes

POST /api/v1/room-review-add/:id            - Add room review
GET  /api/v1/get-room-reviews-list/:room_id - Get room reviews
PUT  /api/v1/edit-room-review/:review_id    - Edit review

πŸš€ Installation & Setup

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB (local or cloud)
  • npm or yarn package manager

1. Clone the Repository

git clone https://github.com/SamiurRahmanMukul/Hotel-Room-Booking-System.git
cd Hotel-Room-Booking-System

2. Backend Setup

cd backend
npm install

Create .env file in backend directory with your configuration values.

3. Frontend Setup

cd frontend
npm install

Create .env.local file in frontend directory with your API configuration.

4. Admin Panel Setup

cd admin-panel
npm install

Create .env file in admin-panel directory with your API configuration.

5. Start the Applications

Start Backend Server

cd backend
npm run dev  # Development mode
npm start    # Production mode

Start Frontend Application

cd frontend
npm run dev  # Runs on http://localhost:3034

Start Admin Panel

cd admin-panel
npm start    # Runs on http://localhost:3033

πŸ“– Usage

For End Users (Frontend)

  1. Register/Login: Create account or login with existing credentials
  2. Browse Rooms: View available rooms with filters and search
  3. Book Rooms: Select dates and book available rooms
  4. Manage Bookings: View, track, and cancel bookings
  5. Leave Reviews: Rate and review booked rooms
  6. Profile Management: Update personal information and avatar

For Administrators (Admin Panel)

  1. Dashboard: View system statistics and analytics
  2. User Management: Manage user accounts, roles, and status
  3. Room Management: Add, edit, delete, and manage room inventory
  4. Booking Management: Oversee all bookings and update statuses
  5. Review Moderation: Monitor and manage user reviews

πŸ”’ Security Features

  • JWT Authentication with access and refresh tokens
  • Password hashing using bcrypt
  • Input validation and sanitization
  • Rate limiting to prevent abuse
  • CORS configuration for secure cross-origin requests
  • Helmet for security headers
  • File upload restrictions and validation
  • Environment variable protection

πŸ“± Responsive Design

All applications are fully responsive and optimized for:

  • Desktop computers
  • Tablets
  • Mobile devices
  • Various screen sizes and orientations

πŸ›‘οΈ Testing

Backend Testing

cd backend
npm test        # Run tests
npm run coverage # Run tests with coverage

Linting

# Backend
cd backend && npm run lint

# Frontend
cd frontend && npm run lint

# Admin Panel
cd admin-panel && npm run lint

πŸš€ Deployment

Backend Deployment

  • Deploy to platforms like Heroku, Railway, or AWS
  • Ensure MongoDB connection (MongoDB Atlas recommended)
  • Set production environment variables
  • Configure CORS for production domains

Frontend Deployment

  • Deploy to Vercel, Netlify, or similar platforms
  • Update API URLs for production
  • Configure environment variables

Admin Panel Deployment

  • Build and deploy to static hosting platforms
  • Update API configurations for production

πŸ‘₯ Contributing

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

πŸ“„ License

This project is licensed under the ISC License - see the LICENSE file for details.

πŸ‘¨β€πŸ’» Author

Md. Samiur Rahman (Mukul)

πŸ™ Acknowledgments

  • Express.js team for the robust web framework
  • MongoDB team for the flexible database solution
  • React and Next.js teams for the powerful frontend frameworks
  • Ant Design team for the comprehensive UI component library
  • All open-source contributors who made this project possible

⭐ If you found this project helpful, please give it a star! ⭐