RoomSync is a backend-based Hotel Reservation & Management System developed using Spring Boot and MongoDB. The project focuses on managing hotel rooms, customers, and bookings through REST APIs while demonstrating CRUD operations, entity relationships, business logic, and exception handling.
com.roomsync
├── controller
│ RoomController
│ CustomerController
│ BookingController
│
├── service
│ RoomService
│ CustomerService
│ BookingService
│
├── repository
│ RoomRepository
│ CustomerRepository
│ BookingRepository
│
├── model
│ Room
│ Customer
│ Booking
│
├── exception
│ ResourceNotFoundException
│ RoomNotAvailableException
│ BookingOperationException
│ GlobalExceptionHandler
│
└── RoomSyncApplication
- roomNumber
- roomType
- price
- status
- name
- phone
Booking
├── customerId
├── roomId
├── checkInDate
├── checkOutDate
└── bookingStatus
Customer
↓
Creates Booking
↓
Booking references Room
↓
Room becomes BOOKED
↓
Customer Check-In
↓
Room becomes OCCUPIED
↓
Customer Check-Out
↓
Room becomes AVAILABLE
AVAILABLE
↓
Create Booking
↓
BOOKED
↓
Check In
↓
OCCUPIED
↓
Check Out
↓
AVAILABLE
CREATE BOOKING
↓
CONFIRMED
↓
CHECKED_IN
↓
CHECKED_OUT
CHECKED_OUT → CANCELLED
CHECKED_OUT → CHECKED_IN
CANCELLED → CHECKED_IN
CONFIRMED → CHECKED_OUT
If:
Room Status = BOOKED
or
Room Status = OCCUPIED
Then:
Room is not available
This prevents a room from being assigned to multiple active bookings.
| Module | Create | Get All | Get By Id | Update | Delete / Cancel |
|---|---|---|---|---|---|
| Room | ✅ | ✅ | ✅ | ✅ | ✅ |
| Customer | ✅ | ✅ | ✅ | ✅ | ✅ |
| Booking | ✅ | ✅ | ✅ | ✅ | ✅ |
- Create Booking
- Update Booking
- Cancel Booking
- Check-In
- Check-Out
- Room Status Management
- Date Validation
- Global Exception Handling
Example:
public List<Booking> getAllBookings() {
return bookingRepository.findAll();
}This method retrieves all booking records and is useful for hotel administration and booking management.
Global exception handling is implemented using @ControllerAdvice.
| Status Code | Description |
|---|---|
| 404 | Resource not found |
| 409 | Room unavailable |
| 400 | Invalid booking operation |
| 500 | Unexpected server error |
if (!booking.getBookingStatus())Issue: getBookingStatus() returns a String, not a boolean.
Fix: Compared the booking status using defined constants.
During Check-In, room status was updated to OCCUPIED but booking status was not updated.
Fix:
Booking Status → CHECKED_IN
Room Status → OCCUPIED
During Check-Out, room status was updated to AVAILABLE but booking status was not updated.
Fix:
Booking Status → CHECKED_OUT
Room Status → AVAILABLE
Booking dates were not validated.
Example:
Check-In : 25 Jun 2026
Check-Out : 20 Jun 2026
Fix:
if (!checkOutDate.isAfter(checkInDate))This ensures the check-out date is always after the check-in date.
Double Booking Prevention
A room cannot be booked if its status is already:
BOOKED
or
OCCUPIED
This prevents multiple active bookings for the same room.
- Authentication & Authorization
- Payment Integration
- Admin Dashboard
- Room Availability Search
- Booking Reports & Analytics
Shashank Kumar
RoomSync - Hotel Reservation & Management System