# akimushkin/airlinebookingsystem architecture

> Architecture diagram of the GitHub repository akimushkin/airlinebookingsystem, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akimushkin/airlinebookingsystem
- Repository: https://github.com/akimushkin/airlinebookingsystem

## Overview

##### Project type and purpose
- This is a .NET-based, microservices-oriented full-stack backend for an airline booking system.
- It follows a “Clean Architecture” or “Onion Architecture” approach in each microservice, with clearly separated API, Application, Core, and Infrastructure layers.
- It consists of four business-capability services—Bookings, Flights, Payments, Notifications—each exposed as its own HTTP API.

##### File structure
- Top-level solution file (.sln) and a folder per microservice:
- AirlineBookingSystem.Bookings.Api + .Application + .Core + .Infrastructure
- AirlineBookingSystem.Flights.Api + .Application + .Core + .Infrastructure
- AirlineBookingSystem.Payments.Api + .Application + .Core + .Infrastructure
- AirlineBookingSystem.Notifications.Api + .Application + .Core + .Infrastructure
- Each “Api” project contains controllers and HTTP request examples (.http), plus appsettings.json for configuration.
- Each “Application” project defines CQRS commands, queries, and handlers.
- “Core” defines domain entities and repository interfaces.
- “Infrastructure” provides repository implementations (e.g., EF Core or Dapper to a Postgres DB).
- An InitialDataSchema folder contains SQL scripts and Docker commands for Postgres and Redis provisioning.

##### README
- The README is minimal, but the file layout strongly conveys that the solution is built around separate bounded-context microservices, each following the same layered pattern.
- The presence of Postgres and Redis scripts suggests relational storage and a caching or pub/sub layer.

##### Essential architectural elements
- Four microservices and their layered structure.
- Data stores per service.
- Service composition workflow: flight lookup, payment processing, notification sending.
- Do not include internal file names—focus on logical components and layers.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Clients
    WebApp["Web App"]:::client
    MobileApp["Mobile App"]:::client
    APIConsumers["API Consumers"]:::client

    %% Redis
    Redis["Redis Cache/Event Bus"]:::cache

    %% Bookings Service
    subgraph "Bookings Service"
        direction TB
        BS_API["Bookings API"]:::api
        BS_App["Bookings Application"]:::app
        BS_Core["Bookings Core"]:::core
        BS_Infra["Bookings Infrastructure"]:::infra
        BS_DB["BookingsDB"]:::db
    end

    %% Flights Service
    subgraph "Flights Service"
        direction TB
        FS_API["Flights API"]:::api
        FS_App["Flights Application"]:::app
        FS_Core["Flights Core"]:::core
        FS_Infra["Flights Infrastructure"]:::infra
        FS_DB["FlightsDB"]:::db
    end

    %% Payments Service
    subgraph "Payments Service"
        direction TB
        PS_API["Payments API"]:::api
        PS_App["Payments Application"]:::app
        PS_Core["Payments Core"]:::core
        PS_Infra["Payments Infrastructure"]:::infra
        PS_DB["PaymentsDB"]:::db
    end

    %% Notifications Service
    subgraph "Notifications Service"
        direction TB
        NS_API["Notifications API"]:::api
        NS_App["Notifications Application"]:::app
        NS_Core["Notifications Core"]:::core
        NS_Infra["Notifications Infrastructure"]:::infra
        NS_DB["NotificationsDB"]:::db
    end

    %% Client to Service API calls
    WebApp -->|"REST calls"| BS_API
    WebApp -->|"REST calls"| FS_API
    WebApp -->|"REST calls"| PS_API
    WebApp -->|"REST calls"| NS_API

    MobileApp -->|"REST calls"| BS_API
    MobileApp -->|"REST calls"| FS_API
    MobileApp -->|"REST calls"| PS_API
    MobileApp -->|"REST calls"| NS_API

    APIConsumers -->|"REST calls"| BS_API
    APIConsumers -->|"REST calls"| FS_API
    APIConsumers -->|"REST calls"| PS_API
    APIConsumers -->|"REST calls"| NS_API

    %% Intra-service flows
    BS_API -->|"invoke handlers"| BS_App
    BS_App -->|"use interfaces"| BS_Core
    BS_App -->|"persist/retrieve"| BS_Infra
    BS_Infra -->|"read/write"| BS_DB

    FS_API -->|"invoke handlers"| FS_App
    FS_App -->|"use interfaces"| FS_Core
    FS_App -->|"persist/retrieve"| FS_Infra
    FS_Infra -->|"read/write"| FS_DB

    PS_API -->|"invoke handlers"| PS_App
    PS_App -->|"use interfaces"| PS_Core
    PS_App -->|"persist/retrieve"| PS_Infra
    PS_Infra -->|"read/write"| PS_DB

    NS_API -->|"invoke handlers"| NS_App
    NS_App -->|"use interfaces"| NS_Core
    NS_App -->|"persist/retrieve"| NS_Infra
    NS_Infra -->|"read/write"| NS_DB

    %% Inter-service calls from Bookings
    BS_App -->|"Check flight availability"| FS_API
    BS_App -->|"Process payment"| PS_API
    BS_App -->|"Send booking event"| NS_API

    %% Shared Redis usage
    FS_App -->|"cache flight data"| Redis
    BS_App -->|"publish BookingCreated"| Redis
    NS_App -->|"subscribe events"| Redis

    %% Click Events
    click BS_API "https://github.com/akimushkin/airlinebookingsystem/blob/master/AirlineBookingSystem/AirlineBookingSystem.Bookings.Api"
    click BS_App "https://github.com/akimushkin/airlinebookingsystem/blob/master/AirlineBookingSystem/AirlineBookingSystem.Bookings.Application"
    click BS_Core "https://github.com/akimushkin/airlinebookingsystem/blob/master/AirlineBookingSystem/AirlineBookingSystem.Bookings.Core"
    click BS_Infra "https://github.com/akimushkin/airlinebookingsystem/blob/master/AirlineBookingSystem/AirlineBookingSystem.Bookings.Infrastructure"

    click FS_API "https://github.com/akimushkin/airlinebookingsystem/blob/master/AirlineBookingSystem/AirlineBookingSystem.Flights.Api"
    click FS_App "https://github.com/akimushkin/airlinebookingsystem/blob/master/AirlineBookingSystem/AirlineBookingSystem.Flights.Application"
    click FS_Core "https://github.com/akimushkin/airlinebookingsystem/blob/master/AirlineBookingSystem/AirlineBookingSystem.Flights.Core"
    click FS_Infra "https://github.com/akimushkin/airlinebookingsystem/blob/master/AirlineBookingSystem/AirlineBookingSystem.Flights.Infrastructure"

    click PS_API "https://github.com/akimushkin/airlinebookingsystem/blob/master/AirlineBookingSystem/AirlineBookingSystem.Payments.Api"
    click PS_App "https://github.com/akimushkin/airlinebookingsystem/blob/master/AirlineBookingSystem/AirlineBookingSystem.Payments.Application"
    click PS_Core "https://github.com/akimushkin/airlinebookingsystem/blob/master/AirlineBookingSystem/AirlineBookingSystem.Payments.Core"
    click PS_Infra "https://github.com/akimushkin/airlinebookingsystem/blob/master/AirlineBookingSystem/AirlineBookingSystem.Payments.Infrastructure"

    click NS_API "https://github.com/akimushkin/airlinebookingsystem/blob/master/AirlineBookingSystem/AirlineBookingSystem.Notifications.Api"
    click NS_App "https://github.com/akimushkin/airlinebookingsystem/blob/master/AirlineBookingSystem/AirlineBookingSystem.Notifications.Application"
    click NS_Core "https://github.com/akimushkin/airlinebookingsystem/blob/master/AirlineBookingSystem/AirlineBookingSystem.Notifications.Core"
    click NS_Infra "https://github.com/akimushkin/airlinebookingsystem/blob/master/AirlineBookingSystem/AirlineBookingSystem.Notifications.Infrastructure"

    click InitialData "https://github.com/akimushkin/airlinebookingsystem/tree/master/InitialDataSchema"

    %% Styles
    classDef client fill:#f9f,stroke:#333,stroke-width:1px
    classDef api fill:#bbdefb,stroke:#333,stroke-width:1px
    classDef app fill:#c8e6c9,stroke:#333,stroke-width:1px
    classDef core fill:#fff9c4,stroke:#333,stroke-width:1px
    classDef infra fill:#ffe0b2,stroke:#333,stroke-width:1px
    classDef db fill:#b3e5fc,stroke:#333,stroke-width:1px,shape:cylinder
    classDef cache fill:#ffccbc,stroke:#333,stroke-width:1px,shape:cylinder
```
