# fran-tor/flight-search architecture

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

- Interactive diagram: https://gitdiagram.com/fran-tor/flight-search
- Repository: https://github.com/fran-tor/flight-search

## Overview

##### Project Type and Purpose
- This is a full-stack flight search application that leverages the Amadeus API to allow users to search for flight information.

##### File Structure Analysis
- There are two main top-level directories: “backend” and “frontend”. This indicates a clear separation between server-side and client-side components.
– The FlightSearchApplication.java serves as the entry point.
– The “config” directory (including SSLConfig.java) signifies specific configuration setups, which might include secure communications.
– The “controllers” directory (e.g., FlightSearchController.java) handles incoming API requests.
– The “services” folder (e.g., FlightSearchService.java) encapsulates business logic.
– The “repositories” folder (e.g., AmadeusRepository.java) likely handles communication with the external Amadeus API.

##### Key Components & Their Roles
- Frontend:
– User Interface built with React and Material UI.
– Views such as SearchPage, FlightSearchApp, ResultsPage, and DetailsPage that display and manage flight search functionalities.
– API utility files (e.g., flights.ts) that facilitate communication with the backend.
– Assets including airlines, airports, and dummy flight search results for data simulations.
- Backend:
– Main Application: FlightSearchApplication.java (Spring Boot entry point).
– Controllers: FlightSearchController.java that exposes RESTful endpoints.
– Services: FlightSearchService.java manages the business logic of the flight search.
– Models: A set of Java classes (such as FlightDetails, FlightSegmentDetails, Amenity, etc.) representing the domain entities.
– Repositories: AmadeusRepository.java communicates with the Amadeus API, acting as the integration point.
– Configuration: SSLConfig.java suggests secured communication setups.
- External Services:
– Amadeus API integration is central to this application, requiring API keys provided by the user during setup.
- Deployment:
– Docker and Docker Compose are used to containerize and orchestrate both frontend and backend services.
– Separate dockerfiles exist for both sub-projects, ensuring environment consistency for both development and production.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Deployment"
        DC["Docker Compose"]
        BDF["Backend Dockerfile"]
        FDF["Frontend Dockerfile"]
    end

    subgraph "Frontend"
        FEUI["UI Components (Views & App)"]
        FEAPI["API Utilities"]
        FEAssets["Assets"]
    end

    subgraph "Backend"
        BEEntry["Main Application Entry Point"]
        BEController["REST Controller"]
        BEService["Business Logic Service"]
        BEModels["Data Models"]
        BERepo["Repository (Amadeus Integration)"]
        BEConfig["Configuration (SSL)"]
    end

    AmadeusAPI[("Amadeus API")]

    DC --> FEUI
    DC --> BEEntry
    FEUI --> FEAPI
    FEAPI -->|"API Request/Response"| BEController
    BEEntry --> BEController
    BEController --> BEService
    BEService --> BERepo
    BERepo -->|"API Integration"| AmadeusAPI
    BEController --> BEService
    BEEntry --> BEConfig

    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef external fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef deployment fill:#D3D3D3,stroke:#000,stroke-width:2px;

    class FEUI,FEAPI,FEAssets frontend;
    class BEEntry,BEController,BEService,BEModels,BERepo,BEConfig backend;
    class AmadeusAPI external;
    class DC,BDF,FDF deployment;

    click FEUI "https://github.com/fran-tor/flight-search/tree/main/frontend/src/views"
    click FEAPI "https://github.com/fran-tor/flight-search/blob/main/frontend/src/api/flights.ts"
    click FEAssets "https://github.com/fran-tor/flight-search/tree/main/frontend/src/assets"
    click BEEntry "https://github.com/fran-tor/flight-search/blob/main/backend/src/main/java/com/example/flight_search/FlightSearchApplication.java"
    click BEController "https://github.com/fran-tor/flight-search/blob/main/backend/src/main/java/com/example/flight_search/controllers/FlightSearchController.java"
    click BEService "https://github.com/fran-tor/flight-search/blob/main/backend/src/main/java/com/example/flight_search/services/FlightSearchService.java"
    click BEModels "https://github.com/fran-tor/flight-search/tree/main/backend/src/main/java/com/example/flight_search/models"
    click BERepo "https://github.com/fran-tor/flight-search/blob/main/backend/src/main/java/com/example/flight_search/repositories/AmadeusRepository.java"
    click BEConfig "https://github.com/fran-tor/flight-search/blob/main/backend/src/main/java/com/example/flight_search/config/SSLConfig.java"
    click DC "https://github.com/fran-tor/flight-search/blob/main/docker-compose.yml"
    click BDF "https://github.com/fran-tor/flight-search/tree/main/backend/dockerfile"
    click FDF "https://github.com/fran-tor/flight-search/tree/main/frontend/dockerfile"
```
