This is a Hotel Management System built using Spring Boot for the backend and React for the frontend. The system supports user authentication, room bookings, and AWS S3 integration for image uploads.
- User Authentication with JWT
- Role-Based Access (Admin & Customer)
- Room Management (CRUD operations)
- Booking Management
- AWS S3 Integration for Image Uploads
- Java + Spring Boot
- Spring Security + JWT Authentication
- MySQL Database
- AWS S3 for Image Storage
- React
- Axios (for API calls)
git clone https://github.com/subhash-varun/Hotel-Management-Project.git
cd Hotel-Management-Project
Edit src/main/resources/application.properties
:
spring.datasource.url=jdbc:mysql://localhost:3306/hotel_db
spring.datasource.username=root
spring.datasource.password=yourpassword
aws.s3.access.key=your-aws-access-key
aws.s3.secret.key=your-aws-secret-key
aws.s3.bucket.name=your-bucket-name
aws.s3.region=ap-south-1
jwt.secret=your-secret-key
mvn clean install
mvn spring-boot:run
The backend will start at: http://localhost:4040
cd frontend
npm install
npm start
The frontend will start at: http://localhost:3000
This project uses JWT (JSON Web Token) for authentication.
POST /auth/register
{
"name": "Admin User",
"email": "admin@example.com",
"phoneNumber": "1234567890",
"password": "password123",
"role": "ADMIN"
}
{
"name": "Regular User",
"email": "user@example.com",
"phoneNumber": "1234567890",
"password": "password123"
}
Note: For regular users, the role field is optional and defaults to "USER".
[Rest of the content remains the same]
POST /auth/login
{
"email": "admin@gmail.com",
"password": "password123"
}
{
"token": "eyJhbGciOiJIUzI1NiIsInR5c..."
}
The token must be sent in the Authorization header for protected routes:
Authorization: Bearer <token>
Method | Endpoint | Description |
---|---|---|
POST | /auth/register | Register a new user |
POST | /auth/login | Login and get JWT token |
Method | Endpoint | Description |
---|---|---|
GET | /users/all | Get all users (Admin only) |
GET | /users/get-by-id/{id} | Get user by ID |
GET | /users/get-logged-in-profile-info | Get profile info of logged-in user |
GET | /users/get-user-bookings/{userId} | Get all bookings of a user |
DELETE | /users/delete/{id} | Delete user by ID |
Method | Endpoint | Description |
---|---|---|
POST | /rooms/add | Add a new room (Admin only) |
GET | /rooms/all | Get all rooms |
GET | /rooms/types | Get all room types |
GET | /rooms/room-by-id/{roomId} | Get details of a room by ID |
GET | /rooms/available-rooms-by-date-and-type | Get available rooms based on date and type |
PUT | /rooms/update/{roomId} | Update room details |
DELETE | /rooms/delete/{roomId} | Delete a room |
GET /rooms/available-rooms-by-date-and-type?checkInDate=2025-02-12&checkOutDate=2025-02-16&roomType=Single
Method | Endpoint | Description |
---|---|---|
POST | /bookings/book-room/{roomId}/{userId} | Book a room |
GET | /bookings/get-by-confirmation-code/{code} | Get booking details by confirmation code |
PUT | /bookings/cancel/{bookingId} | Cancel a booking |
GET | /bookings/all | Get all bookings (Admin only) |
POST /bookings/book-room/2/8
- Fork the repository
- Create a new branch (feature-new)
- Commit your changes
- Push to GitHub & create a Pull Request
Subhash Varun
GitHub: @subhash-varun