# jimmyochoa/flight-system architecture

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

- Interactive diagram: https://gitdiagram.com/jimmyochoa/flight-system
- Repository: https://github.com/jimmyochoa/flight-system

## Overview

##### Main Components
- Docker Compose Orchestration – Represent the docker-compose.yml file orchestrating multiple containers.
- Microservices – Highlight four primary microservices:
- Auth Microservice (handles user login and JWT generation)
- Flights Microservice (manages flight details)
- Reservations Microservice (handles flight booking and reservation logic)
- Users Microservice (deals with user management functionality)
- Database (MongoDB) – A centralized (or containerized) database that each microservice interacts with.
- External Tools – Indicate integration with Postman (for API testing) and explain that Docker and Node.js are key technologies.

##### Relationships and Interactions
- The Auth Microservice provides authentication tokens (JWT) consumed by the other services.
- The Flights and Reservations microservices might communicate indirectly through API calls for integrated functionalities.
- Users data may be referenced/imported within the Reservations and Auth services.
- Microservice to the central MongoDB container to denote database interactions.

##### Architectural Patterns & Design Principles
- Microservices-based Architecture – Emphasize the separation of concerns where each service is independently deployed via Docker.
- Containerization – Each microservice has its own Dockerfile, and they are built and networked using Docker Compose.
- RESTful API – All services expose endpoints to communicate with each other, with Axios being used as an HTTP client.
- Security via JWT – The use of JSON Web Tokens for secure authentication across services.

##### Relevant Technologies and Frameworks
- Node.js – The runtime powering each microservice.
- MongoDB – The NoSQL database accessed by each service.
- Docker (and Docker Compose) – To define, build, and run the containerized services.
- JWT – For secure authentication.
- Axios – For handling inter-service communication.

##### Recommended Elements
- Annotations: Briefly note key technologies (like Node.js, MongoDB, Docker) inside or adjacent to the respective components.

- Then detail each microservice as its own container, linking them to the MongoDB instance.
- Interactions between the services (e.g., which services require authentication via the Auth Microservice and how they interact with the database).

## Diagram (Mermaid)

```mermaid
flowchart TD
    DC["Docker Compose"]:::infra
    ET["Postman & Documentation"]:::external

    subgraph "Microservices"
        A["Auth Microservice – Authentication & JWT"]:::microservice
        U["Users Microservice – User Management"]:::microservice
        F["Flights Microservice – Flight Details"]:::microservice
        R["Reservations Microservice – Flight Bookings"]:::microservice
    end

    DB["MongoDB"]:::infra

    %% Docker Compose orchestrates microservices
    DC --> A
    DC --> U
    DC --> F
    DC --> R

    %% External tools connected to orchestration layer
    ET --> DC

    %% Inter-service communications
    A -->|"JWT"| F
    A -->|"JWT"| R
    A -->|"JWT"| U
    U -->|"userData"| R
    R -->|"flightQuery"| F

    %% Database interactions from each microservice
    A -->|"dbInteraction"| DB
    U -->|"dbInteraction"| DB
    F -->|"dbInteraction"| DB
    R -->|"dbInteraction"| DB

    %% Click Events
    click DC "https://github.com/jimmyochoa/flight-system/blob/main/docker-compose.yml"
    click A "https://github.com/jimmyochoa/flight-system/tree/main/Backend/auth-microservice"
    click U "https://github.com/jimmyochoa/flight-system/tree/main/Backend/users-microservice"
    click F "https://github.com/jimmyochoa/flight-system/tree/main/Backend/flights-microservice"
    click R "https://github.com/jimmyochoa/flight-system/tree/main/Backend/reservations-microservice"
    click DB "https://github.com/jimmyochoa/flight-system/blob/main/Backend/auth-microservice/config/database.js"
    click ET "https://github.com/jimmyochoa/flight-system/blob/main/Documentacion/Diagrama Arquitectura de Microservicios.pdf"

    %% Styles
    classDef microservice fill:#8ec07c,stroke:#000,stroke-width:2px,color:#fff;
    classDef infra fill:#83a598,stroke:#000,stroke-width:2px,color:#fff;
    classDef external fill:#d3869b,stroke:#000,stroke-width:2px,color:#fff;
```
