Skip to content

About

A distributed airline reservation system built as a multi-module Maven project, utilizing Spring Cloud for dynamic discovery, routing, and │ centralized configuration.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

✈️ AirSagar - Enterprise Airline Booking Microservices Platform

Java Spring Boot Spring Cloud Docker MySQL

AirSagar is a production-grade, distributed microservices airline booking and flight operations system built with Java 17, Spring Boot 3, Spring Cloud Gateway, Netflix Eureka, and MySQL. It features 100+ REST APIs, real-time seat locking, dynamic fare structures, automated schedule generation, Razorpay payment gateway integration, and centralized exception handling.


📐 Microservices Architecture

                    +------------------------+
                    |  Client / Postman / UI |
                    +-----------+------------+
                                |
                                v (Port 8080)
                    +------------------------+
                    |      API Gateway       |
                    +-----------+------------+
                                |
        +-----------------------+-----------------------+
        |                       |                       |
        v (Port 5001)           v (Port 5002)           v (Port 5004)
 +--------------+        +--------------+        +--------------+
 | User Service |        |Airline Service|        |Location Service|
 +------+-------+        +------+-------+        +------+-------+
        |                       |                       |
        v                       v                       v
 (AirSagar_user_db)       (airline_db)       (AirSagar_location_db)

        |                       |                       |
        v (Port 5005)           v (Port 5006)           v (Port 5007)
 +--------------+        +--------------+        +--------------+
 | Flight Ops   |        |Pricing Service|        | Seat Service |
 +------+-------+        +------+-------+        +------+-------+
        |                       |                       |
        v                       v                       v
(AirSagar_flight_db)    (AirSagar_pricing_db)   (AirSagar_seat_db)

        |                       |
        v (Port 5003)           v (Port 5010)
 +--------------+        +--------------+
 |Booking Service|        |Payment Service|
 +------+-------+        +------+-------+
        |                       |
        v                       v
(AirSagar_booking_db)   (AirSagar_payment_db)

🌐 Microservice Topology & Port Mapping

Service Name Port Database Name Description
API Gateway 8080 N/A Centralized Entry Point, JWT Validation & Route Distribution
Eureka Server 8761 N/A Service Registry & Dynamic Load Balancing
User Service 5001 AirSagar_user_db Authentication (JWT), Signup, User Profiles & Role Management
Airline Service 5002 airline_db Airline Fleet & Aircraft Registration
Booking Service 5003 AirSagar_booking_db Passenger Ticket Booking, PNR Generation & Status Lifecycle
Location Service 5004 AirSagar_location_db Cities & Airport Catalog Management
Flight Ops Service 5005 AirSagar_flight_db Flight Routes, Operating Schedules & Instance Generation
Pricing Service 5006 AirSagar_pricing_db Cabin Fares & Baggage Policy Management
Seat Service 5007 AirSagar_seat_db Seat Maps, Cabin Layouts & Real-time Hold/Book Lock Engine
Payment Service 5010 AirSagar_payment_db Razorpay Order Creation, Signature Verification & Confirmation

✨ Key Features & Technical Highlights

  • 🔒 Security & Role-Based Access (RBAC): JWT authentication (ROLE_SYSTEM_ADMIN, ROLE_AIRLINE_OWNER, ROLE_USER).
  • 💺 Real-time Seat Locking: Atomic seat hold engine with auto-expiring locks (HELD, BOOKED, BLOCKED, AVAILABLE).
  • 📅 Flight Schedule Generator: Converts recurring weekly schedules into concrete daily flight instances automatically.
  • 🛡️ Centralized Exception Architecture: Standardized error contract across all 8 microservices via @RestControllerAdvice & custom HTTP-mapped exceptions (ResourceNotFoundException, BadRequestException, ResourceAlreadyExistsException, UnauthorizedException).
  • 💳 Razorpay Payment Gateway Integration: Complete order creation, signature verification, and automated booking confirmation callback flow.
  • 📄 Complete 104+ API Postman Collection: Ready-to-import Postman collection matching all DTOs and endpoints.

🛠️ Tech Stack & Dependencies

  • Framework: Spring Boot 3.x, Spring Cloud 2023.x
  • Language: Java 17
  • Database: MySQL 8.4 (Database-per-service pattern)
  • Security: Spring Security, io.jsonwebtoken (jjwt)
  • Inter-service Communication: OpenFeign, RestTemplate
  • Documentation: SpringDoc OpenAPI (Swagger UI)
  • Containerization: Docker & Docker Compose

🚀 Getting Started

1. Prerequisites

  • Java 17 or higher
  • Maven 3.8+
  • MySQL 8.4
  • Docker & Docker Compose (Optional, for containerized run)

2. Environment Configuration

Clone the repository and set up your local environment file:

git clone https://github.com/Sagar-devx/airline-booking-system.git
cd airline-booking-system/backend
cp .env.example .env

Edit .env if you wish to adjust your local database credentials or JWT secret:

MYSQL_ROOT_PASSWORD=root
MYSQL_USER=root
MYSQL_PASSWORD=root
JWT_SECRET_KEY=dfjfhdjbjihcdnvdihjdhkjdnedkjnbjdshkdjkdndkhdibbvtfthdjvhsjichpidsjgoksefjoc
RAZORPAY_KEY_ID=your_razorpay_key_id
RAZORPAY_KEY_SECRET=your_razorpay_key_secret

3. Build & Local Run

Option A: Running Locally with Maven

Build the common library and all services:

mvn clean install -DskipTests

Start services in the following order:

  1. Eureka Server: cloud/eureka-server (Port 8761)
  2. API Gateway: cloud/api-gateway (Port 8080)
  3. Core Services: user-service, airline-service, location-service, flight-ops-service, pricing-service, seat-service, booking-service, payment-service.

Option B: Running with Docker Compose

Important

Because the Dockerfile copies pre-compiled JARs (COPY ${MODULE_PATH}/target/*.jar app.jar), you must build the Maven artifacts on the host machine before launching Docker containers.

# Step 1: Package all Maven JAR files
mvn clean package -DskipTests

# Step 2: Launch all microservices & MySQL with Docker Compose
docker-compose up -d --build

To stop all running services:

docker-compose down

📫 Postman API Collection & Testing

A complete Postman Collection covering all 104+ API Endpoints is included at the root of the repository:

📄 AirSagar_Postman_Collection.json

How to Use:

  1. Open Postman.
  2. Click Import and select AirSagar_Postman_Collection.json.
  3. Hit Signup User and Login User. The collection test script automatically saves authToken to collection variables.
  4. Test all endpoints seamlessly via API Gateway at http://localhost:8080.

🎯 Standardized Error Contract

All microservices emit clean, structured JSON error payloads:

{
  "timestamp": "2026-07-26T09:30:00.000",
  "status": 404,
  "error": "Not Found",
  "message": "Airport not found with ID: 15"
}

📝 License

This project is licensed under the MIT License.

About

A distributed airline reservation system built as a multi-module Maven project, utilizing Spring Cloud for dynamic discovery, routing, and │ centralized configuration.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages