# program-guru/aviation-ticketing-system architecture

> Architecture diagram of the GitHub repository program-guru/aviation-ticketing-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/program-guru/aviation-ticketing-system
- Repository: https://github.com/program-guru/aviation-ticketing-system

## Overview

##### Project Type and Purpose
- This is a microservices-based Aviation Ticketing System.
- It handles user management, authentication, flight/airport data, schedules, bookings, and payments.
- It uses domain-driven design, with each bounded context implemented as an independent Spring Boot service.

##### File Structure
- Top-level directories:
- api-gateway – entry point (Spring Cloud Gateway)
- auth-service – JWT authentication/authorization
- user-service – user CRUD, MySQL persistence
- airport-service – airport CRUD, MySQL persistence, RabbitMQ publisher
- flight-service – flight CRUD, MongoDB, RabbitMQ publisher
- schedule-service – schedule CRUD, MongoDB, RabbitMQ consumer, WebSocket notifications
- booking-service – booking logic, synchronous Feign calls to user, schedule, payment; MongoDB persistence
- payment-service – Razorpay integration, synchronous Feign from booking
- eureka-server – service registry
- docker-compose.yml & k8s/ – container and Kubernetes manifests for all pieces
- Configuration files reveal use of Feign Clients for RPC, RabbitMQ for events, JWT and Spring Security, Docker, Kubernetes.

##### Key Architecture Insights from README
- API Gateway routes all client calls, enforces JWT security.
- Eureka Server for service discovery/load balancing.
- Synchronous flows use Feign: API→Auth→User, Booking→Schedule, Booking→Payment, Schedule→Flight, etc.
- Asynchronous flows use RabbitMQ: Airport publishes status changes → Flight consumes; Flight publishes updates → Schedule consumes.
- Persistence: MySQL for User & Airport, MongoDB for Flight, Schedule & Booking, external Razorpay for payments.
- Additional real-time updates via WebSocket in Schedule and User services.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client Tier"
        ClientApps["Client (Web/Mobile)"]:::client
    end

    subgraph "Edge Tier"
        APIGW["API Gateway"]:::gateway
        Eureka["Eureka Server"]:::registry
    end

    subgraph "Service Tier"
        Auth["Authentication Service"]:::micro
        User["User Service"]:::micro
        Airport["Airport Service"]:::micro
        Flight["Flight Service"]:::micro
        Schedule["Schedule Service"]:::micro
        Booking["Booking Service"]:::micro
        Payment["Payment Service"]:::micro
    end

    subgraph "Integration Tier"
        Rabbit["RabbitMQ"]:::broker
    end

    subgraph "Persistence Tier"
        MySQL["MySQL"]:::db
        Mongo["MongoDB"]:::db
        Razorpay["Razorpay"]:::external
    end

    %% Client to Gateway
    ClientApps -->|"HTTP/REST"| APIGW

    %% Gateway to Services & Registry
    APIGW -->|"routes & security"| Auth
    APIGW -->|"routes & security"| User
    APIGW -->|"routes & security"| Airport
    APIGW -->|"routes & security"| Flight
    APIGW -->|"routes & security"| Schedule
    APIGW -->|"routes & security"| Booking
    APIGW -->|"routes & security"| Payment
    APIGW -->|"service discovery"| Eureka

    %% Services to Eureka
    Auth -->|"register & heartbeats"| Eureka
    User -->|"register & heartbeats"| Eureka
    Airport -->|"register & heartbeats"| Eureka
    Flight -->|"register & heartbeats"| Eureka
    Schedule -->|"register & heartbeats"| Eureka
    Booking -->|"register & heartbeats"| Eureka
    Payment -->|"register & heartbeats"| Eureka

    %% Synchronous Feign calls (solid arrows)
    Booking -->|"Feign: ScheduleService"| Schedule
    Booking -->|"Feign: PaymentService"| Payment
    Booking -->|"Feign: UserService"| User
    Schedule -->|"Feign: FlightService"| Flight
    Auth -->|"Feign: UserServiceCommunication"| User

    %% Asynchronous RabbitMQ events (dashed arrows)
    Airport -.->|"AMQP: airport.status.exchange"| Rabbit
    Rabbit -.->|"AMQP: flight.status.queue"| Flight
    Flight -.->|"AMQP: flight.update.exchange"| Rabbit
    Rabbit -.->|"AMQP: schedule.update.queue"| Schedule

    %% Services to Databases
    User -->|"JPA/MySQL"| MySQL
    Airport -->|"JPA/MySQL"| MySQL
    Flight -->|"Spring Data/MongoDB"| Mongo
    Schedule -->|"Spring Data/MongoDB"| Mongo
    Booking -->|"Spring Data/MongoDB"| Mongo

    %% Payment to External
    Payment -->|"HTTP/REST"| Razorpay

    %% Click Events: API Gateway
    click APIGW "https://github.com/program-guru/aviation-ticketing-system/blob/main/api-gateway/src/main/java/com/flight/booking/gateway/ApiGatewayApplication.java"
    click APIGW "https://github.com/program-guru/aviation-ticketing-system/blob/main/api-gateway/src/main/java/com/flight/booking/gateway/config/SecurityConfig.java"

    %% Click Events: Authentication Service
    click Auth "https://github.com/program-guru/aviation-ticketing-system/blob/main/auth-service/src/main/java/com/flight/booking/auth/AuthServiceApplication.java"
    click Auth "https://github.com/program-guru/aviation-ticketing-system/blob/main/auth-service/src/main/java/com/flight/booking/auth/config/SecurityConfig.java"
    click Auth "https://github.com/program-guru/aviation-ticketing-system/blob/main/auth-service/src/main/java/com/flight/booking/auth/feign/UserServiceCommunication.java"

    %% Click Events: User Service
    click User "https://github.com/program-guru/aviation-ticketing-system/blob/main/user-service/src/main/java/com/flight/booking/user/UserServiceApplication.java"
    click User "https://github.com/program-guru/aviation-ticketing-system/blob/main/user-service/src/main/java/com/flight/booking/user/controller/UserController.java"
    click User "https://github.com/program-guru/aviation-ticketing-system/tree/main/user-service/src/main/java/com/flight/booking/user/websocket/"

    %% Click Events: Airport Service
    click Airport "https://github.com/program-guru/aviation-ticketing-system/blob/main/airport-service/src/main/java/com/flight/booking/airport/AirportServiceApplication.java"
    click Airport "https://github.com/program-guru/aviation-ticketing-system/blob/main/airport-service/src/main/java/com/flight/booking/airport/config/RabbitMQConfig.java"
    click Airport "https://github.com/program-guru/aviation-ticketing-system/blob/main/airport-service/src/main/java/com/flight/booking/airport/event/AirportEventPublisher.java"

    %% Click Events: Flight Service
    click Flight "https://github.com/program-guru/aviation-ticketing-system/blob/main/flight-service/src/main/java/com/flight/booking/flight/FlightServiceApplication.java"
    click Flight "https://github.com/program-guru/aviation-ticketing-system/blob/main/flight-service/src/main/java/com/flight/booking/flight/config/RabbitMQConfig.java"
    click Flight "https://github.com/program-guru/aviation-ticketing-system/blob/main/flight-service/src/main/java/com/flight/booking/flight/event/FlightEventPublisher.java"

    %% Click Events: Schedule Service
    click Schedule "https://github.com/program-guru/aviation-ticketing-system/blob/main/schedule-service/src/main/java/com/flight/booking/schedule/ScheduleServiceApplication.java"
    click Schedule "https://github.com/program-guru/aviation-ticketing-system/blob/main/schedule-service/src/main/java/com/flight/booking/schedule/config/RabbitMQConfig.java"
    click Schedule "https://github.com/program-guru/aviation-ticketing-system/blob/main/schedule-service/src/main/java/com/flight/booking/schedule/websocket/SeatWebSocketHandler.java"
    click Schedule "https://github.com/program-guru/aviation-ticketing-system/tree/main/schedule-service/src/main/java/com/flight/booking/schedule/feign/"

    %% Click Events: Booking Service
    click Booking "https://github.com/program-guru/aviation-ticketing-system/blob/main/booking-service/src/main/java/com/flight/booking/BookingServiceApplication.java"
    click Booking "https://github.com/program-guru/aviation-ticketing-system/blob/main/booking-service/src/main/java/com/flight/booking/feign/PaymentServiceCommunicator.java"
    click Booking "https://github.com/program-guru/aviation-ticketing-system/blob/main/booking-service/src/main/java/com/flight/booking/feign/ScheduleServiceCommunicator.java"

    %% Click Events: Payment Service
    click Payment "https://github.com/program-guru/aviation-ticketing-system/blob/main/payment-service/src/main/java/com/flight/booking/PaymentServiceApplication.java"
    click Payment "https://github.com/program-guru/aviation-ticketing-system/blob/main/payment-service/src/main/java/com/flight/booking/config/RazorpayConfig.java"

    %% Click Events: Eureka Server
    click Eureka "https://github.com/program-guru/aviation-ticketing-system/blob/main/eureka-server/src/main/java/com/flight/booking/eureka/EurekaServerApplication.java"

    %% Click Events: Deployment & Integration
    click Docker "https://github.com/program-guru/aviation-ticketing-system/blob/main/docker-compose.yml"
    click K8s "https://github.com/program-guru/aviation-ticketing-system/tree/main/k8s/"
    click SQLInit "https://github.com/program-guru/aviation-ticketing-system/blob/main/sql-init/init.sql"

    %% Styles
    classDef client fill:#fad8d8,stroke:#c94c4c;
    classDef gateway fill:#e1d5f7,stroke:#7f5fc3;
    classDef registry fill:#e1d5f7,stroke:#7f5fc3;
    classDef micro fill:#d0e6fa,stroke:#3178c6;
    classDef broker fill:#fae0b3,stroke:#d18f00;
    classDef db fill:#d4f5d4,stroke:#2e8b57;
    classDef external fill:#e0e0e0,stroke:#6e6e6e;
```
