Here’s a detailed prompt for generating a MERN Stack Hotel Booking Web App with User & Admin Roles:
Project Title: Hotel Booking Web App
Description:
Create a full-stack hotel booking web application using MERN Stack (MongoDB, Express, React, Node.js). The app should allow users to browse hotels, view details, make bookings, and manage their reservations. Admins should be able to add, edit, and delete hotels, manage users, and view bookings.
/api/users
)| Method | Endpoint | Description | Access |
|--------|--------------|----------------------|---------|
| POST | /signup
| Register a new user | Public |
| POST | /login
| Login & get JWT token | Public |
| GET | /profile
| Get user profile | Private |
/api/hotels
)| Method | Endpoint | Description | Access |
|--------|-----------|----------------------|---------|
| GET | /
| Get all hotels | Public |
| GET | /:id
| Get hotel by ID | Public |
| POST | /
| Add a new hotel | Admin |
| PUT | /:id
| Edit hotel details | Admin |
| DELETE | /:id
| Delete a hotel | Admin |
/api/bookings
)| Method | Endpoint | Description | Access |
|--------|-----------|----------------------|---------|
| POST | /
| Create a booking | Private |
| GET | /my
| Get user bookings | Private |
| GET | /all
| Get all bookings (Admin) | Admin |
Set up the Backend
User
, Hotel
, Booking
)Develop the Frontend
Deploy
A fully functional hotel booking web app where users can search & book hotels, while admins can manage the system.
Do you want the complete code implementation for this? 🚀
I'll help you create a hotel booking web application using the MERN stack with user and admin roles. Let's start by setting up the project structure and implementing the core features.
We'll organize our project with a client (React) and server (Node.js/Express) folder structure:
Now let's set up the backend server with Express, MongoDB, and authentication:
Please make sure to add the following environment variables to your project: