Bookingly is a modern Spring Boot-based RESTful Hotel Booking and Management System built to streamline hotel management and enhance user booking experiences. With features like dynamic pricing, secure JWT authentication, role-based access, and Stripe payment integration, it offers a complete backend solution for a hotel booking and management platform.
- Overview
- Tech Stack
- Modules
- User Roles
- Authentication & Authorization
- Hotel Browsing & Booking (GUEST)
- Admin Functionality (HOTEL_MANAGER)
- Room & Inventory Management
- Payment Flow (Stripe)
- Guest Management
- Dynamic Pricing
- Scheduled Tasks
- API Endpoints
BookingEase enables users to:
- 🔍 Search and book hotels
- 🧾 Manage bookings and guest details
- 💳 Make secure payments via Stripe
- 📈 Experience dynamic pricing based on real-time strategies
- 🔐 Login with Google OAuth2 or traditional JWT
- Java 21
- Spring Boot
- Spring Security (JWT + OAuth2)
- Stripe API (for payments)
- PostgreSQL (database)
- Lombok
- Scheduled Tasks (for background operations)
- Authentication Module
- Hotel Management Module
- Room & Inventory Module
- Booking Module
- Guest Management Module
- Pricing Module
- Stripe Webhook Listener
- Scheduled Task Executor
- Sign up / Login
- Search and book hotels
- Manage bookings and guests
- Create and manage hotels & rooms
- View bookings and generate reports
- Activate/deactivate hotel listings
- JWT-based access token with refresh token
- Google OAuth2 login support for easy user access
- Secure cookie storage for refresh tokens
Endpoints:
POST /auth/signup- Register new guestPOST /auth/login- Login and receive tokensPOST /auth/refresh- Refresh access tokenGET /oauth2/authorize/google– Redirect to Google for loginGET /oauth2/callback– Callback handler for Google login
GET /hotels/searchAll- Paginated hotel listGET /hotels/search- Filtered hotel searchGET /hotels/info/{hotelId}- Get hotel detailsPOST /bookings/init- Initialize bookingPOST /bookings/{bookingId}/addGuests- Add guests to bookingPOST /bookings/{bookingId}/payments- Start payment sessionPOST /bookings/{bookingId}/cancel- Cancel a bookingGET /bookings/{bookingId}/status- Check booking status
POST /admin/hotels- Create new hotelPUT /admin/hotels/{id}- Update hotel detailsPATCH /admin/hotels/activate/{id}- Activate or deactivate hotelGET /admin/hotels/{id}/bookings- View all bookingsGET /admin/hotels/{id}/reports- Generate booking reports
POST /admin/hotels/{hotelId}/rooms- Add room to hotelPUT /admin/hotels/{hotelId}/rooms/{roomId}- Update room detailsPATCH /admin/inventory/rooms/{roomId}- Update room inventoryGET /admin/inventory/rooms/{roomId}- View room inventory
- Initiate payment -
POST /bookings/{id}/payments - Stripe Checkout session created
- Stripe sends event →
POST /webhook/payment - Booking status updated to
CONFIRMED - Refunds handled via Stripe on cancellations
GET /users/guests– List guestsPOST /users/guests– Add guestPUT /users/guests/{id}– Update guestDELETE /users/guests/{id}– Delete guest
Implemented using the Decorator Pattern with multiple strategies:
BasePricingStrategy– Default base priceSurgePricingStrategy– Increases during high demandOccupancyPricingStrategy– Adjusts based on availabilityUrgencyPricingStrategy– Increases near check-in dateHolidayPricingStrategy– Premium pricing on holidays
PricingStrategy strategy = new BasePricingStrategy();
strategy = new SurgePricingStrategy(strategy);
strategy = new OccupancyPricingStrategy(strategy);
strategy = new UrgencyPricingStrategy(strategy);
strategy = new HolidayPricingStrategy(strategy);
BigDecimal finalPrice = strategy.calculatePrice(inventory);@Scheduled(cron = "0 */15 * * * *") // every 15 mins
public void expireBooking() {
// logic to expire unpaid bookings
}@Scheduled(cron = "0 0 * * * *") // every hour
public void updatePrices() {
// logic to update dynamic pricing
}