The Node Hotel Application is a backend system built using Node.js, Express.js, and MongoDB.
It is designed to manage hotel staff (Persons) and Menu Items, along with JWT-based authentication for secure access.
- User Signup
- User Login
- View User Profile
- JWT-based secure authentication
- Add new staff members
- View all staff
- Filter staff by work type (chef, waiter, manager, etc.)
- Update staff details
- Delete staff records
- Add menu items
- View all menu items
- Filter menu items by taste (sweet, spicy, sour)
- Update menu items
- Delete menu items
Authentication is implemented using JSON Web Tokens (JWT).
- User signs up or logs in
- Server generates a JWT token
- Token is sent to the client
- Client sends token in the
Authorizationheader - Server verifies token using middleware for protected routes
- Node.js
- Express.js
- MongoDB
- Mongoose
- JWT (JSON Web Token)
node_Hotels/
│
├── models/ # Mongoose schemas
├── routers/ # API routes
├── db.js # Database connection
├── jwt.js # JWT utilities & middleware
├── server.js # Entry point
├── .gitignore
├── package.json
└── README.md
| Method | Endpoint | Description |
|---|---|---|
| POST | /person |
Add a new staff member |
| GET | /person |
Get all staff members |
| GET | /person/:workType |
Get staff by work type |
| PUT | /person/:id |
Update staff details |
| DELETE | /person/:id |
Delete a staff member |
| Method | Endpoint | Description |
|---|---|---|
| POST | /menu |
Add a menu item |
| GET | /menu |
Get all menu items |
| GET | /menu/:taste |
Get menu items by taste |
| PUT | /menu/:id |
Update menu item |
| DELETE | /menu/:id |
Delete menu item |
Represents hotel staff information.
Fields:
name(String) – Staff nameage(Number) – Staff agework(Enum) – Role (chef, waiter, manager)mobile(String) – Mobile numberemail(String) – Email (unique)address(String) – Addresssalary(Number) – Salary
Example:
{
"name": "John Doe",
"age": 30,
"work": "waiter",
"mobile": "123-456-7890",
"email": "john@example.com",
"address": "123 Main Street",
"salary": 30000
}Represents food and drink items.
Fields:
name(String) – Item nameprice(Number) – Item pricetaste(Enum) – Taste (sweet, spicy, sour)is_drink(Boolean) – Default:falseingredients(Array) – Default: empty arraynum_sales(Number) – Default:0
Example:
{
"name": "Spicy Chicken Curry",
"price": 12.99,
"taste": "spicy",
"is_drink": false,
"ingredients": ["chicken", "spices", "vegetables"],
"num_sales": 50
}git clone https://github.com/muskan-am/node_Hotels.gitcd node_Hotelsnpm installPORT=3000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secretnode server.jsServer will run at:
http://localhost:3000
- JWT-based authentication
- Protected routes using middleware
- Environment variables for sensitive data
- Role-based authorization (Admin / Staff)
- Pagination & search
- Swagger API documentation
- Frontend integration
Muskan Kesharwani
Backend Developer | Node.js | MongoDB
⭐ If you like this project, don’t forget to star the repository!