Skip to content

ARONAGENT/AirBnb_App_SpringBoot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏨 StayScape — Airbnb Hotel Management & Booking System

Spring Boot Java PostgreSQL React TypeScript Redis Stripe Docker Spring AI Visitors GitHub issues License

"The best way to predict the future is to implement it." — Alan Kay


📋 Overview

A robust, enterprise-grade hotel management and booking platform designed to handle 10,000+ hotels with optimized dynamic pricing strategies. This system implements a monolithic architecture featuring an advanced HotelMinPrice strategy that efficiently manages 900,000+ records (90 days × 10,000 hotels) for lightning-fast search operations.

Built with modern software engineering principles, this application showcases JWT authentication, role-based access control, real-time payment processing with Stripe webhooks, Decorator pattern for flexible pricing, comprehensive inventory management, intelligent cancellation policies, an AI-powered chatbot using RAG + pgvector, gamification with XP & leaderboards, real-time WebSocket communities, and a fully responsive React + TypeScript frontend.

🎯 Key Highlights

  • 🔐 Secure Authentication — JWT-based authentication with role-based access control (RBAC)
  • 💰 Dynamic Pricing Engine — Decorator pattern for seasonal, occupancy, holiday & custom strategies
  • 💳 Payment Integration — Stripe Checkout & webhook integration for real-time payment processing
  • 📊 Optimized Search — HotelMinPrice strategy for sub-15ms queries across massive datasets
  • Redis Caching — Sub-2ms repeated API calls with TTL-based cache eviction
  • 🤖 AI Chatbot (RAG) — Spring AI + pgvector cosine similarity for accurate hotel recommendations
  • 🎮 XP Gamification — Earn XP for bookings, reviews, and referrals; compete on leaderboards
  • 💬 Real-Time Communities — WebSocket + STOMP protocol for live travel community chat
  • 🏢 Inventory Management — Comprehensive room availability, booking, and admin management
  • 📝 API Documentation — Interactive Swagger UI for seamless API exploration
  • 🐳 Fully Containerised — Docker Compose setup for consistent deployment

✨ Features

Core Functionality

  • User Management — Complete user registration, authentication, and profile management
  • Hotel Operations — CRUD operations for hotels with manager-specific access control
  • Room Management — Dynamic room creation, updates, and inventory tracking
  • Booking System — End-to-end booking flow with availability checks and conflict resolution
  • Payment Processing — Secure payment handling via Stripe with webhook confirmation
  • Cancellation Management — Flexible cancellation policies with automated refund processing
  • Dynamic Pricing — Multiple pricing strategies using Decorator pattern
  • Reviews & Ratings — Verified-booking-only reviews with auto-updating average ratings
  • AI Chatbot — RAG-powered chatbot grounded in real hotel data using pgvector
  • Gamification — XP rewards for bookings, reviews, and referrals with a global leaderboard
  • Host Approval Workflow — Structured approval for managers with hotel activation gates
  • Email Notifications — Transactional emails for registration, booking, cancellation & refunds
  • Real-Time Chat — WebSocket communities for sharing travel tips and experiences

Technical Features

  • Scalable Architecture — Monolithic design optimised for 10,000+ hotels
  • Performance Optimisation — Efficient algorithms handling 900K+ price records (8–15 ms)
  • Real-time Updates — Webhook-based payment status synchronisation
  • Data Validation — Comprehensive input validation at all API endpoints
  • API Documentation — Auto-generated Swagger documentation
  • Error Handling — Graceful error handling with meaningful responses
  • Role-Based UI — Separate dashboards for Guest, User, Manager, and Admin roles

🔥 StayScape Interface

image

🖥️ Application Screenshots

Authentication

# Screenshot Description
1 image Login Page — Secure JWT-based authentication portal for all user roles
2 Handles Input Validation Input Validation — Robust request validation with descriptive error messages
3 image User Signup — User registration flow
4 Login the User to Get Access the Token API Login — JWT token generation on authentication

🔍 Hotel Search & Discovery

# Screenshot Description
5 image Hotel Search — City, date, and room-count based search powered by HotelMinPrice strategy with sub-15ms response times
6 image Hotel Details — Full hotel profile including amenities, ratings, room types, pricing, and availability calendar

📅 Booking

# Screenshot Description
7 image Booking Section — End-to-end booking flow covering reservation, guest addition, payment, and confirmation states
8 Payment Status Of Bookings Flow Payment Status — Booking payment status with Stripe integration
9 Stripe Payment Confirm Status Stripe Confirmation — Payment verification via Stripe webhook

🧭 Dashboards

# Screenshot Description
10 image Guest Dashboard — Discover hotels, explore search results, and access community features without a full account
11 image User Dashboard — Overview of active bookings, past stays, XP progress, reviews, and profile management
12 image Manager Dashboard — Hotel and room management, inventory view, pricing strategy controls, booking & revenue reports
13 image Admin Dashboard — Platform-wide oversight including host approvals, hotel activation, revenue analytics, and user management

💰 Dynamic Pricing

# Screenshot Description
14 image Dynamic Pricing Dashboard — Decorator-based pricing engine with seasonal, occupancy, holiday, and custom multipliers over a 90-day precomputed window. Managers create and assign strategies via the admin API
15 create Hotel By Hotel Manager Create Hotel — Hotel creation by manager
16 Update Hotel Info Put Mapping Update Hotel — Modify hotel details
17 Create Room for Hotel with id 1 Create Room — Room setup under a hotel
18 Update Hotel Room Info Update Room — Room modifications
19 Inventory View of Room Database Inventory View — Database-level inventory overview

🤖 AI Booking Interface

# Screenshot Description
20 image AI Booking Interface — Spring AI chatbot powered by RAG + pgvector. User queries are converted to embeddings, matched against hotel data using cosine similarity, and answered with LLM-generated responses grounded in real listings

🏆 Gamification & Leaderboard

# Screenshot Description
21 image Leaderboard — Global XP-based leaderboard ranking users by bookings, reviews, and referrals. Cached for performance and refreshed after each confirmed booking

Pending ...

💬 Communities

# Screenshot Description
23 Communities Dashboard Communities Dashboard — Real-time travel communities using WebSocket + STOMP. Users share tips and reviews; managers post live announcements. Messages arrive instantly without page reload

🗄️ Database & ER Diagram

# Screenshot Description
24 image
ER Diagram — Full database schema
25 Get Hotel By ID Get Hotel — Hotel detail retrieval

🎥 Video Demonstrations

Hotel Activation & Inventory Creation

Complete hotel activation process and annual inventory setup (365 days)

Activate.hotel.and.Create.a.Inventory.for.room.1.year.mp4

End-to-End Booking Flow

Full booking demonstration from search to Stripe payment confirmation

Bookings.Flow.of.Airbnb.App.mp4

Dynamic Pricing Workflow — Decorator Pattern

Every room's 90-day pricing update strategies in action

dynamic_pricing.mp4

🛠️ Technologies

Tech Stack

Technology Version Purpose
Java 17+ Core programming language
Spring Boot 3.x Application framework
Spring Security 6.x Authentication & authorisation
Spring Data JPA 3.x Data persistence layer
Spring AI Latest RAG chatbot & vector search
PostgreSQL 14+ Primary database
pgvector Latest Vector similarity search
Redis Latest Caching layer (sub-2ms hits)
Hibernate 6.x ORM framework
JWT Latest Token-based authentication
Stripe API Latest Payment processing
WebSocket / STOMP Latest Real-time community chat
React 18 Frontend framework
TypeScript 5.x Type-safe frontend
Swagger / OpenAPI 3.x API documentation
Docker / Compose Latest Containerised deployment
Maven 3.8+ Dependency management
Lombok Latest Boilerplate reduction
Jackson Latest JSON processing

Architecture Patterns

  • Monolithic Architecture — Unified deployment model optimised for scale
  • Repository Pattern — Data access abstraction
  • Decorator Pattern — Flexible, composable pricing strategies
  • Service Layer Pattern — Business logic separation
  • DTO Pattern — Data transfer optimisation
  • RAG Pattern — Retrieval-Augmented Generation for AI chatbot

📐 System Architecture

┌─────────────────────────────────────────────────────────────┐
│                     React + TypeScript Frontend              │
│   Search │ Booking │ Dashboard │ Leaderboard │ Community     │
└──────────────────────────┬──────────────────────────────────┘
                           │ REST / WebSocket
┌──────────────────────────▼──────────────────────────────────┐
│               Spring Boot Application (Monolith)             │
│  Auth │ Hotels │ Rooms │ Bookings │ Payments │ AI │ XP       │
└────┬──────────┬────────────┬───────────────┬────────────────┘
     │          │            │               │
┌────▼───┐  ┌──▼─────┐  ┌───▼──────┐  ┌────▼────────┐
│  PgSQL │  │ Redis  │  │  Stripe  │  │  Spring AI  │
│+pgvect.│  │ Cache  │  │ Webhooks │  │  + pgvector │
└────────┘  └────────┘  └──────────┘  └─────────────┘

🚀 Installation

Prerequisites

Ensure you have the following installed:

  • Java 17 or higher
  • Maven 3.8+
  • PostgreSQL 14+ with pgvector extension
  • Redis
  • Docker & Docker Compose (optional but recommended)
  • Git
  • Stripe Account (for payment processing)

Option A — Docker Compose (Recommended)

# Clone the repository
git clone https://github.com/ARONAGENT/AirBnb_App_SpringBoot.git
cd AirBnb_App_SpringBoot

# Start all services (Spring Boot + PostgreSQL + Redis)
docker-compose up --build

Option B — Manual Setup

  1. Clone the repository

    git clone https://github.com/ARONAGENT/AirBnb_App_SpringBoot.git
    cd AirBnb_App_SpringBoot
  2. Configure Database

    CREATE DATABASE airbnb_db;
    -- Enable pgvector extension
    CREATE EXTENSION IF NOT EXISTS vector;
  3. Configure Application Properties

    Update src/main/resources/application.properties:

    # Database Configuration
    spring.datasource.url=jdbc:postgresql://localhost:5432/airbnb_db
    spring.datasource.username=your_username
    spring.datasource.password=your_password
    
    # JWT Configuration
    jwt.secret=your_secret_key
    jwt.expiration=86400000
    
    # Redis Configuration
    spring.redis.host=localhost
    spring.redis.port=6379
    
    # Stripe Configuration
    stripe.api.key=your_stripe_secret_key
    stripe.webhook.secret=your_webhook_secret
    
    # Spring AI Configuration
    spring.ai.openai.api-key=your_openai_api_key
  4. Build and Run

    mvn clean install
    mvn spring-boot:run
  5. Access the Application

    • API Base URL: http://localhost:8080
    • Swagger UI: http://localhost:8080/swagger-ui.html
    • Frontend: http://localhost:3000 (run React app separately)

💻 API Reference

Authentication

POST /api/auth/signup          # Register user
POST /api/auth/login           # Login and receive JWT
POST /api/auth/refresh         # Refresh access token

Hotel Management

POST   /api/hotels             # Create hotel (Manager only)
GET    /api/hotels/{id}        # Get hotel by ID
PUT    /api/hotels/{id}        # Update hotel
DELETE /api/hotels/{id}        # Delete hotel
POST   /api/hotels/{id}/activate  # Activate hotel (Admin only)

Room Management

POST /api/hotels/{hotelId}/rooms   # Create room
PUT  /api/rooms/{id}               # Update room
GET  /api/rooms/inventory          # Get room inventory

Booking Management

POST /api/bookings                 # Create booking
GET  /api/bookings/{id}            # Get booking status
PUT  /api/bookings/{id}/cancel     # Cancel booking
GET  /api/bookings/my              # Get current user's bookings

Search

GET /api/search?city=&checkIn=&checkOut=&rooms=   # Hotel search

Payment

POST /api/payments/webhook         # Stripe webhook endpoint

Admin

GET  /api/admin/hosts/pending      # Pending host approvals
PUT  /api/admin/hosts/{id}/approve # Approve host
GET  /api/admin/reports            # Revenue and occupancy reports

AI Chatbot

POST /api/chat                     # Query the AI chatbot

Communities

GET  /api/communities              # List communities
POST /api/communities              # Create community
WS   /ws/chat                      # WebSocket endpoint (STOMP)

Reviews

POST /api/hotels/{id}/reviews      # Post a review (verified bookings only)
GET  /api/hotels/{id}/reviews      # Get hotel reviews
PUT  /api/reviews/{id}             # Edit your review
DELETE /api/reviews/{id}           # Delete your review

Leaderboard & XP

GET /api/leaderboard               # Global XP leaderboard
GET /api/users/me/xp               # Current user XP and stats

Example Request

User Registration:

POST /api/auth/signup
Content-Type: application/json

{
  "username": "john_doe",
  "email": "john@example.com",
  "password": "SecurePass123!",
  "role": "USER"
}

Hotel Search:

GET /api/search?city=Mumbai&checkIn=2025-08-01&checkOut=2025-08-05&rooms=2

For complete API documentation, visit Swagger UI after running the application at http://localhost:8080/swagger-ui.html.


🔑 Role-Based Access Control

Feature GUEST USER HOTEL_MANAGER ADMIN
Browse & Search Hotels
Create Booking
Post Reviews
Earn XP & Leaderboard
Join Communities
Manage Hotels & Rooms
Configure Pricing Strategy
Approve Host Requests
Activate Hotels
View Platform Reports

🏗️ Implemented Features In Detail

A. Hotel Search with HotelMinPrice

The search API takes city, dates, and room count and returns results using precomputed HotelMinPrice data. This bypasses real-time inventory aggregation and gives indexed lookups directly. Response times sit consistently around 8–15 ms, with hotel details, amenities, ratings, and minimum nightly price all returned in a single call.

B. End-to-End Booking with Stripe

Bookings move through reservation → guest addition → payment → confirmation states. Stripe Checkout handles PCI-compliant card processing, and webhook events update booking status automatically. Inventory is locked during the transaction to prevent double reservations, and the Stripe Refund API processes cancellation refunds without manual intervention.

C. Dynamic Pricing Engine

The pricing engine applies Decorator-based multipliers — seasonal, occupancy, holiday, and custom — over a 90-day precomputed window. Hotel managers can create and assign strategies through the admin API. Updates can be triggered manually or via the nightly scheduled job.

D. JWT Authentication and RBAC

Spring Security with JWT provides stateless auth across all protected endpoints. Users get an access token on login; refresh tokens are stored in cookies. Three roles supported: GUEST, USER, and HOTEL_MANAGER (plus ADMIN).

E. Redis Caching

Redis caches hotel search results, hotel details, and inventory data. TTL-based expiration keeps data consistent, and cache eviction fires automatically on updates. This cuts database load significantly and keeps repeated API calls under 2 ms.

F. XP Gamification and Leaderboard

Users earn XP for completed bookings, posted reviews, and referrals. XP totals and a list of visited places are tracked in the user profile. A global leaderboard ranks users by XP and travel activity, cached for fast access and refreshed after each confirmed booking.

G. Admin Panel

Hotel managers can create and manage hotels, rooms, and inventory entirely through admin APIs. Inventory is auto-generated for future dates. The admin panel also surfaces booking, revenue, and occupancy reports. All data can be updated live without a system restart.

H. Cancellation and Refund Management

Each hotel sets its own cancellation policy with refund percentages tied to days before check-in. When a booking is cancelled, the system calculates the refund amount automatically, calls the Stripe Refund API, and restores inventory to available state.

I. Reviews and Ratings

Only users with confirmed bookings can post reviews. Reviews include a star rating and comments, and authors can edit or delete their own entries. Per-hotel average ratings and review counts update automatically and feed into search ranking and recommendation logic.

J. Spring AI Chatbot with RAG and pgvector

The chatbot converts user queries into embeddings and matches them against stored hotel data using pgvector's cosine similarity search. Matched documents are added to the prompt context before the LLM generates a response, keeping answers accurate and grounded in real hotel data.

K. Host Approval, Custom Strategy & Hotel Activation

The platform incorporates a structured approval workflow for users applying to become hosts (managers), ensuring authenticity and quality standards are maintained. Once approved, managers can configure custom strategies such as dynamic pricing and personalised offerings. Hotels remain inactive until verified and approved by the platform authority.

L. Email Notifications

Transactional emails fire automatically for registration, login alerts, booking confirmation, cancellation, and refunds. Each email includes relevant booking details and is triggered by system events rather than scheduled polling.

M. Real-Time WebSocket Chat

Users can join travel communities and chat in real time using WebSocket with the STOMP protocol. Messages arrive instantly without page reload. Communities support sharing travel tips, reviews, and plans, adding a social layer to the booking experience.

N. React and TypeScript Frontend

The frontend is built in React 18 with TypeScript for type safety across all components. Pages cover search, booking, dashboard, leaderboard, community, and admin workflows. All UI communicates with REST APIs and the interface is fully responsive across modern browsers.

O. Intelligent Hotel Recommendations

The platform provides personalised hotel recommendations by analysing user reviews and past booking behaviour. By understanding user preferences, travel patterns, and feedback shared by other guests, the system suggests hotels that best match individual needs.

P. Community Interaction & Updates

Users and guests can post queries and share travel experiences in dedicated community forums, fostering a collaborative social space. Managers directly post real-time updates and announcements. The system enables interactive discussion, allowing users to reply to posts and engage with community managers directly.

Q. Docker and Deployment

The system is fully containerised using Docker and Docker Compose. Services include the Spring Boot backend, PostgreSQL with pgvector, and Redis. Container-based deployment ensures consistent behaviour across development, staging, and production environments.


🔮 Future Scope

A few enhancements are currently in progress:

  • Dedicated React pages for admin hotel management and user profile settings including avatar upload
  • Updated ER diagram reflecting the community module, XP system, and reviews in their final form
  • Comprehensive README covering local setup, architecture overview, full API reference, and Docker deployment instructions
  • Extended frontend with community creation flows, personalised recommendation pages, and enhanced admin analytics dashboards
  • Parallelised nightly pricing batch job using Spring's @Async and thread pool executors — cutting the full 10,000-hotel pricing update from ~33 minutes to under 5 minutes

🤝 Contributing

Contributions are currently not accepted as this is a proprietary project. However, feedback and suggestions are welcome!

If you find any bugs or have feature requests, please open an issue on GitHub.


📄 License

Copyright (c) 2025 ROHAN UKE

This project and its source code are the exclusive property of the author.
Unauthorized copying, modification, distribution, or commercial use is strictly prohibited.
Limited use is granted for learning, reviewing, and non-commercial demonstration purposes only.
No warranties are provided; use at your own risk.
For permissions beyond this notice, contact: your-rohanuke1@gmail.com

🙏 Acknowledgments

  • Spring Framework Team — For the incredible Spring Boot ecosystem
  • Stripe — For robust payment processing APIs
  • PostgreSQL & pgvector Community — For the reliable database and vector search extension
  • Redis — For fast in-memory caching
  • React & TypeScript — For the modern, type-safe frontend ecosystem
  • Spring AI — For the RAG pipeline and vector store integration
  • Open Source Community — For the countless libraries that made this project possible
  • Swagger / OpenAPI — For excellent API documentation capabilities

📚 References

  1. Talluri, K. T., & van Ryzin, G. J. (2004). The Theory and Practice of Revenue Management. Springer.
  2. Fowler, M., & Lewis, J. (2014). Microservices: A Definition of This New Architectural Term. martinfowler.com.
  3. Spring Framework. (2024). Spring AI Reference Documentation — RAG Pipeline and Vector Store Integration. https://docs.spring.io/spring-ai/reference/
  4. Spring Framework. (2024). Spring Boot 3.x Reference Documentation. https://docs.spring.io/spring-boot/
  5. Carlson, J. (2013). Redis in Action. Manning Publications.
  6. Hamari, J., Koivisto, J., & Sarsa, H. (2014). Does Gamification Work? HICSS, pp. 3025–3034.
  7. pgvector Contributors. (2024). Open-Source Vector Similarity Search for PostgreSQL. https://github.com/pgvector/pgvector
  8. Gamma, E., Helm, R., Johnson, R., & Vlissides, J. (1994). Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley.
  9. Spring Security Team. (2024). Spring Security 6.x — JWT Authentication and RBAC. https://docs.spring.io/spring-security/reference/
  10. Stripe Inc. (2024). Stripe Payments API, Checkout Sessions, and Webhooks Documentation. https://stripe.com/docs/webhooks
  11. React Documentation Team. (2024). React 18 — New Features and Concurrent Rendering. https://react.dev/
  12. Docker Inc. (2024). Docker and Docker Compose Documentation. https://docs.docker.com/

📞 Contact

For any inquiries, permissions, or collaboration opportunities:

GitHub Repository


Built with ❤️ by ARONAGENT

🌟 Star this repo if you find it helpful! ⭐

"Code is like humor. When you have to explain it, it's bad." — Cory House

About

A robust, enterprise-grade hotel management and booking platform designed to handle 10,000+ hotels with optimized dynamic pricing strategies. This system implements a monolithic architecture featuring advanced HotelMinPrice strategy that efficiently manages 900,000+ records (90 days × 10,000 hotels) for lightning-fast search operations.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors