β¨ Full-stack MERN Hotel Booking Engine! π¨ Search hotels, pick dates π & book rooms seamlessly. Powered by Node.js, Express, MongoDB Atlas, React & Tailwind CSS. Features JWT auth π, CRUD resources, date-availability logic & admin dashboard! β‘π
- Authentication & User Management: Secure sign-up, login, and session persistence powered by Clerk.
- Room Search & Availability: Real-time room availability verification based on selected check-in and check-out dates.
- Smart Booking Engine: Automated multi-night pricing calculation and guest management system.
- Automated Email Confirmations: Instant HTML email receipts sent to users upon successful reservation via Nodemailer SMTP.
- Media Cloud Management: Seamless image upload, handling, and fast distribution using Cloudinary and Multer.
- Hotel Owner Dashboard: Centralized management panel for tracking total revenue, reservation metrics, and active bookings.
- Responsive Dark UI: Fully responsive interface built with Tailwind CSS v4 and interactive notification alerts using React Hot Toast.
- Frontend: React 19, Vite, React Router DOM, Tailwind CSS v4, Axios, React Hot Toast, Clerk React
- Backend: Node.js, Express.js (v5), Mongoose ODM, Nodemailer, Cloudinary, Multer, Svix, Stripe SDK, CORS, Dotenv, Nodemon, Stripe
- Database: MongoDB Atlas
- Authentication: Clerk Express & Clerk React
- Version Control: Git, GitHub
- DevOps: Vercel
- ποΈ Full-Stack MERN Architecture β Seamless integration connecting a React 19 client to a Node.js & Express 5 REST API server.
- β‘ Axios API Integration β Clean client-side HTTP requests utilizing structured controllers for real-time frontend-backend communication.
- π Authentication & Access Control β Secure session management and role-based access handling powered by Clerk.
- π Real-Time Booking & Availability β Automated room availability checking for custom dates with multi-night price calculation.
- π§ Automated Email Confirmation β Dynamic HTML reservation receipts dispatched instantly via Nodemailer SMTP.
- πΌοΈ Cloud Media Pipeline β Seamless multi-image room uploads and asset delivery powered by Cloudinary and Multer.
- π Hotel Owner Analytics Dashboard β Centralized metrics overview tracking total bookings, occupancy, and cumulative revenue.
- ποΈ MongoDB & Mongoose Validation β Structured database schemas, data validation, and persistent cloud storage using MongoDB Atlas.
- π Dynamic Client-Side Routing β Multi-view navigation managed via React Router DOM for explore, room details, and dashboard views.
- π¨ Responsive Dark-Themed UI β Modern interface designed with Tailwind CSS v4 and interactive notification alerts via React Hot Toast.
- βοΈ Centralized Environment Vault β Secure management of sensitive configurations (
MONGODB_URI,CLERK_SECRET_KEY, Cloudinary, and Nodemailer) via.envintegration. - β‘ Developer Workflow β Accelerated development loop using Vite on the frontend and hot-reloading tooling on the backend.
- Node.js (v16 or higher)
- npm package manager
- Basic knowledge of JavaScript & MongoDB
This project integrates Stripe Checkout (Test Mode). Use the credentials below to test different payment workflows:
- Card Number:
4242 4242 4242 4242 - Expiry Date (MM / YY): Any future date (e.g.,
12 / 28) - CVC:
123 - Postal / ZIP Code:
54000(or any 5-digit postal code)
You can use the following dedicated card numbers to test error handling and status responses:
| Test Scenario | Card Number | Expected Behavior |
|---|---|---|
| Generic Card Decline | 4000 0000 0000 0002 |
Triggers a standard card decline error |
| Insufficient Funds | 4000 0000 0000 0010 |
Triggers an insufficient funds alert |
| Expired Card | 4000 0000 0000 0069 |
Triggers a card expiration validation error |
| Incorrect CVC | 4000 0000 0000 0127 |
Triggers a CVC verification failure |
Generated: 9/14/2026, 8:27:28 PM
Root Path: workspace\Hotel_Booking_MERN_App
βββ π client
β βββ π public
β β βββ πΌοΈ favicon.svg
β βββ π src
β β βββ π Routes
β β β βββ π OwnerRoutes
β β β β βββ π AddRoom.jsx
β β β β βββ π Dashboard.jsx
β β β β βββ π Layout.jsx
β β β β βββ π ListRooms.jsx
β β β βββ π AllRooms.jsx
β β β βββ π Home.jsx
β β β βββ π MyBookings.jsx
β β β βββ π RoomDetails.jsx
β β βββ π assets
β β β βββ πΌοΈ logo.svg
β β β βββ πΌοΈ starRatings.svg
β β βββ π components
β β β βββ π OwnerComponents
β β β β βββ π Navbar.jsx
β β β β βββ π Sidebar.jsx
β β β βββ π FeaturedDestination.jsx
β β β βββ π Footer.jsx
β β β βββ π Hero.jsx
β β β βββ π HotelCard.jsx
β β β βββ π HotelReg.jsx
β β β βββ π Loader.jsx
β β β βββ π Navbar.jsx
β β β βββ π Newsletter.jsx
β β β βββ π Offers.jsx
β β β βββ π RecommendedHotels.jsx
β β β βββ π Reviews.jsx
β β β βββ π Title.jsx
β β βββ π context
β β β βββ π AppContext.jsx
β β βββ π App.jsx
β β βββ π¨ index.css
β β βββ π main.jsx
β βββ π README.md
β βββ π eslint.config.js
β βββ π index.html
β βββ βοΈ package-lock.json
β βββ βοΈ package.json
β βββ βοΈ vercel.json
β βββ π vite.config.js
βββ π server
β βββ π configs
β β βββ π cloudinary.js
β β βββ π db.js
β β βββ π nodemailer.js
β βββ π controllers
β β βββ π bookingController.js
β β βββ π clerkWebhooks.js
β β βββ π stripeWebhooks.js
β β βββ π hotelController.js
β β βββ π roomController.js
β β βββ π userController.js
β βββ π middlewares
β β βββ π authMiddleware.js
β β βββ π uploadMidddleware.js
β βββ π models
β β βββ π UserModel.js
β β βββ π bookingModel.js
β β βββ π hotelModel.js
β β βββ π roomModel.js
β βββ π routes
β β βββ π bookingRoute.js
β β βββ π hotelRoutes.js
β β βββ π roomRoute.js
β β βββ π userRouter.js
β βββ βοΈ package-lock.json
β βββ βοΈ package.json
β βββ π server.js
β βββ βοΈ vercel.json
βββ βοΈ .gitignore
βββ π LICENSE
βββ π README.md
Before deploying, ensure your database access is open to Vercel:
- Go to MongoDB Atlas.
- Navigate to Network Access under Security.
- Click Add IP Address and select Allow Access from Anywhere (
0.0.0.0/0). - Save changes.
Set up your environment variables in Vercel before or after deployment:
- In your Vercel Project Dashboard, go to Settings β Environment Variables.
- Add your environment key-value pairs (e.g.,
MONGO_URL,JWT_SECRET,PORT). β οΈ Important Requirement:- Ensure Production, Preview, and Development targets are ALL CHECKED.
- DO NOT toggle on the "Sensitive" option for
MONGO_URLto prevent variable save/sync issues.
- Push your latest code to GitHub.
- Go to vercel.com and log in.
- Click "New Project".
- Connect your GitHub repository.
- Select/Connect the exact project root folder containing
package.json(to avoid nested directory deployment issues). - Configure Build Settings:
- Vercel automatically detects Vite/Node settings.
- Toggle the "Build Command" switch and manually type
npm run buildto override it (if using a build step).
- Ensure all Environment Variables (
MONGO_URL, etc.) are added under the project settings. - Click "Deploy".
π‘ Note: If you edit or update any Environment Variable after deploying, always go to the Deployments tab, click the three dots (
...) on the latest deployment, and select Redeploy to apply changes! & Make sure your project structure strictly follows the root layout:
Project_Folder/
βββ client/
βββ server/ vercel.jsonThis documentation provides a step-by-step guide to setting up a production-ready Frontend Workspace for a MERN stack application using React + Vite. It covers project initialization, dependency configuration, and local setupβpreparing the UI layer to seamlessly connect with an Express/Node.js backend.
Run the following command in your terminal:
npm init viteProceed? y
Project Name: name
Package Name: name
Select a framework: React
Select a variant: JavaScript
Select oxlintrc? Yes
Install with npm? Yes
If you want to pull this project and run it again locally, simply execute these commands:
# Navigate to the project folder
cd Project_dir
# create node_modules folder by running this command
npm i
# Start the local development server
npm run devRun this command inside your project directory to install npm pakages in pakages.json file:
npm i @clerk/react
npm i react-router-dom
npm i @tailwindcss/vite
npm i react-hot-toast
npm i axiosIt automatically Create package.json if not exists. Like
{
"name": "client",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"@clerk/react": "^6.14.3",
"@tailwindcss/vite": "^4.3.3",
"axios": "^1.19.0",
"react": "^19.2.8",
"react-dom": "^19.2.8",
"react-hot-toast": "^2.6.0",
"react-router-dom": "^7.18.2",
"tailwindcss": "^4.3.3"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@types/react": "^19.2.17",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^6.0.4",
"eslint": "^10.8.0",
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-react-refresh": "^0.5.3",
"globals": "^17.7.0",
"vite": "^8.2.0"
}
}
Note: Install packages when needed
npm install tailwindcss @tailwindcss/viteAdd plugin to vite.config.js:
import tailwindcss from "@tailwindcss/vite";
export default {
plugins: [tailwindcss()],
};Add to index.css:
@import "tailwindcss";Installed using the official React Router CLI as per reactrouter.com:
npx create-react-router@latest
cd my-project
npm run devOr add to an existing Vite project:
npm install react-router-domDownload and install the LTS version from Node.js Official Site. Verify installation in your terminal:
node -v
npm -v- Download MongoDB Community Server from MongoDB Download Center.
- Download MongoDB Shell (
mongosh) to run CLI database operations. - Start the local server daemon:
# Verify connection using mongosh CLI
mongoshInitialize your Node project inside any project directory:
npm initpackage name: (name)
version: (1.0.0)
description: may add β entry point: (server.js)β
test command: just enterβ
git repository: (https://github.com/username/repo_name.git)
keywords: may add
author: may add
license: (ISC) may be MIT for open source
type: (commonjs) recommended module
Is this OK? (yes)
If you want to pull this project and run it again locally, simply execute these commands:
# Navigate to the project folder
cd Project_dir
# create node_modules folder by running this command
npm i
# Start the local development server
npm startTo enable modern ES6 import/export syntax instead of require(), open package.json and add "type": "module":
{
"name": "node",
"version": "1.0.0",
"bugs": {
"url": "https://github.com/username/repo/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/username/repo.git"
},
"license": "ISC",
"author": "",
"type": "commonjs",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js" // add manually write "nodemon index.js" if installed
}
}
Run this command inside your project directory to install npm pakages in pakages.json file:
npm i express
npm i mongoose
npm i nodemon
npm i cors
npm i dotenv
npm i cloudinary
npm i svix
npm i multer
npm i @clerk/express
npm i stripe
bpm i nodemailerIt automatically Create package.json if not exists. Like
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js",
"dev": "nodemon server.js"
},
"keywords": [],
"type": "module",
"dependencies": {
"@clerk/express": "^2.1.61",
"cloudinary": "^2.10.1",
"cors": "^2.8.6",
"dotenv": "^17.4.2",
"express": "^5.2.1",
"mongoose": "^9.9.3",
"multer": "^2.2.0",
"nodemailer": "^10.0.9",
"nodemon": "^3.1.14",
"stripe": "^22.6.2",
"svix": "^2.0.0"
}
}
Note: Install packages when needed
- React Documentation β (Official docs for hooks, state management, and modern component architecture)
- Vite Guide β (Ultra-fast frontend build tool and local development server)
- React Router Documentation β (Client-side routing, page navigation, and dynamic loaders)
- Tailwind CSS Documentation β (Utility-first CSS framework for rapid UI and responsive styling)
- Clerk Documentation β (Complete user authentication, webhooks, and session management for React & Express)
- FastAPI Documentation β (Modern, high-performance Python framework for building REST APIs)
- PyJWT Documentation β (JSON Web Tokens for secure backend authentication and authorization)
- Multer Documentation β (Node.js middleware for handling
multipart/form-dataand file uploads) - Cloudinary Node.js SDK β (Cloud media management service for storing, optimizing, and transforming images)
- MongoDB Manual β (NoSQL document database, aggregation pipelines, and CRUD operations)
- PyMongo Documentation β (Official Python driver for MongoDB integration)
- NPM Documentation β (Node package manager for installing frontend dependencies)
- W3Schools Tutorials β (Quick reference guides for JavaScript, Web APIs, and Node.js)
- MDN Web Docs β (The gold standard documentation for HTML, CSS, JavaScript, and HTTP standards)
MehmoodCoder
- π GitHub: https://github.com/MehmoodCoder
- π Portfolio: My Portfolio Link
This project is open-source and available under the MIT License.
Contributions are welcome! If you'd like to improve the API, add new features, or optimize database queries, please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- β¨ Full-Stack MERN Integration: Connected React 19 frontend with Express 5/Node.js backend and MongoDB Atlas using Mongoose ODM.
- π Clerk Authentication Engine: Integrated Clerk authentication across frontend and backend for user session handling and role-based access.
- π Real-Time Reservation Logic: Implemented availability checking and dynamic multi-night cost calculation algorithms for room bookings.
- π§ Automated Nodemailer Workflows: Integrated SMTP mailer to automatically dispatch detailed HTML reservation confirmation emails upon booking.
- πΌοΈ Cloudinary Image Pipeline: Implemented multi-file upload middleware using Multer and Cloudinary for hotel room image management.
- π Hotel Analytics Dashboard: Built owner dashboard tracking real-time metrics, total booking counts, and total revenue aggregation.
- β‘ Axios API Integration: Configured structured API requests using Axios with bearer token authentication headers for all server communication.
- π¨ Responsive Dark UI: Designed a modern, fully responsive dark-themed interface built with Tailwind CSS v4 and instant feedback alerts via React Hot Toast.
- π οΈ Serverless Deployment Setup: Configured environment configurations and modular controllers optimized for Vercel serverless functions deployment.