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.
+------------------------+
| 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)
| 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 |
- 🔒 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.
- Framework: Spring Boot
3.x, Spring Cloud2023.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
- Java 17 or higher
- Maven 3.8+
- MySQL 8.4
- Docker & Docker Compose (Optional, for containerized run)
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 .envEdit .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_secretBuild the common library and all services:
mvn clean install -DskipTestsStart services in the following order:
- Eureka Server:
cloud/eureka-server(Port 8761) - API Gateway:
cloud/api-gateway(Port 8080) - Core Services:
user-service,airline-service,location-service,flight-ops-service,pricing-service,seat-service,booking-service,payment-service.
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 --buildTo stop all running services:
docker-compose downA complete Postman Collection covering all 104+ API Endpoints is included at the root of the repository:
📄 AirSagar_Postman_Collection.json
- Open Postman.
- Click Import and select
AirSagar_Postman_Collection.json. - Hit Signup User and Login User. The collection test script automatically saves
authTokento collection variables. - Test all endpoints seamlessly via API Gateway at
http://localhost:8080.
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"
}This project is licensed under the MIT License.