# ilyasmohetna/flyaway architecture

> Architecture diagram of the GitHub repository ilyasmohetna/flyaway, 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/ilyasmohetna/flyaway
- Repository: https://github.com/ilyasmohetna/flyaway

## Overview

##### Main Components
- Backend Server (Laravel Application):
– Contains the Controllers (in app/Http/Controllers and subdirectories for Admin, Client, Landing, etc.) that define the business logic.
– Manages Models for various domain areas like BUS, CAR, CLIENT, CONFIG, EMPLOYE, FLIGHT, LODGING, PACKAGE, PAYMENT, and TRAIN.
– Uses Middleware (e.g., EnsureClient, EnsureAdmin) for request filtering and authentication handling.
- Frontend Application (React-based):
– Comprised of multiple pages and components stored in resources/js, including dedicated pages for Admin, Client, and Landing functionalities.
– Responsible for rendering interactive dashboards, booking forms, and other user interfaces.
- Database Server:
– MySQL (as specified in the README and .env configuration) handling the structured data – users, flights, lodging, packages, etc.
– The migration and seeder files indicate a mature relational database design.
- Deployment/Containerization:
– Dockerfile and docker-compose.yml suggest containerized deployment, helping manage the PHP environment, Node.js dependencies, and the web server (with nginx.conf).
- Additional Components:
– Static Assets: Public files (in /public) serve static assets like images, animations, and other resources for the landing page.
– Configuration & Environment: Files such as .env (not listed but referenced), config files for Laravel, and JSON files (cities.json, countries.json, states.json) for application-specific data.

##### Relationships and Interactions
- The Frontend (React UI components) interacts with the Laravel backend via HTTP requests—routing through dedicated API endpoints and web routes (see routes directory with different parts: admin, client, landing, etc.).
- The Laravel backend processes requests using Controllers, applies Middleware for security, and interacts with the database through Eloquent models.
- Containerization allows components to communicate in a structured environment managed through Docker.

##### Architectural Patterns and Design Principles
- MVC Pattern (Model-View-Controller):
– Laravel’s MVC architecture is clearly used for segregating concerns between the business logic (Controllers), data management (Models), and presentation (Views/React Components).
- Separation of Concerns:
– Different controllers and routes handle admin, client, and landing functions separately.
– Frontend and backend are clearly separated but interact via well-defined endpoints.
- Microservice/Modular Considerations:
– The domain is broken into several modules (BUS, CAR, FLIGHT, LODGING, PACKAGE, etc.) that can be depicted as separate components or modules in the architecture.
- Containerization:
– The Dockerfiles indicate that the deployment is standardized across environments.

##### Final Advice
- Remember to include deployment details since the Docker setup is a critical part of how FlyAway is run in different environments.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Deployment/Containerization Subgraph
    subgraph "Deployment/Containerization"
        D1["Docker Compose"]:::deployment
        D2["Dockerfile (Backend)"]:::deployment
        D3["Dockerfile (Frontend)"]:::deployment
        D4["Nginx Config"]:::deployment
    end

    %% Backend (Laravel Application) Subgraph
    subgraph "Backend (Laravel Application)"
        B1["Controllers"]:::backend
        B2["Middleware"]:::backend
        B3["Models"]:::backend
        B4["Migrations"]:::backend
        B5["Seeders"]:::backend
        B6["Laravel Config"]:::backend
        B7["Environment (.env)"]:::backend
    end

    %% Frontend (React UI) Subgraph
    subgraph "Frontend (React UI)"
        F1["React Components & Pages"]:::frontend
    end

    %% Database (MySQL) Subgraph
    subgraph "Database (MySQL)"
        DB1["MySQL Database"]:::database
        DB2["DB Configuration"]:::database
        DB3["Cities Data"]:::database
        DB4["Countries Data"]:::database
        DB5["States Data"]:::database
    end

    %% Static Assets Subgraph
    subgraph "Static Assets"
        S1["Public Assets"]:::static
    end

    %% Relationships and Data Flow
    D4 -->|"routes to"| B1
    D4 -->|"serves"| S1
    D1 -->|"deploys"| F1
    D1 -->|"deploys"| B1
    D1 --> D2
    D1 --> D3

    F1 -->|"API calls"| B1

    B1 -->|"calls"| B3
    B3 -->|"CRUD operations"| DB1
    DB1 -->|"data responses"| B3
    B3 -->|"updates"| B1
    B1 -->|"renders"| F1

    DB2 -->|"configures"| DB1
    DB3 -->|"data"| DB1
    DB4 -->|"data"| DB1
    DB5 -->|"data"| DB1

    %% Click Events for Deployment/Containerization
    click D1 "https://github.com/ilyasmohetna/flyaway/blob/main/docker-compose.yml"
    click D2 "https://github.com/ilyasmohetna/flyaway/tree/main/Dockerfile"
    click D3 "https://github.com/ilyasmohetna/flyaway/blob/main/Dockerfile.frontend"
    click D4 "https://github.com/ilyasmohetna/flyaway/blob/main/nginx.conf"

    %% Click Events for Backend (Laravel Application)
    click B1 "https://github.com/ilyasmohetna/flyaway/tree/main/app/Http/Controllers"
    click B2 "https://github.com/ilyasmohetna/flyaway/tree/main/app/Http/Middleware"
    click B3 "https://github.com/ilyasmohetna/flyaway/tree/main/app/Models"
    click B4 "https://github.com/ilyasmohetna/flyaway/tree/main/database/migrations"
    click B5 "https://github.com/ilyasmohetna/flyaway/tree/main/database/seeders"
    click B6 "https://github.com/ilyasmohetna/flyaway/tree/main/config"
    click B7 "https://github.com/ilyasmohetna/flyaway/blob/main/.env"

    %% Click Event for Frontend (React UI)
    click F1 "https://github.com/ilyasmohetna/flyaway/tree/main/resources/js"

    %% Click Events for Database (MySQL)
    click DB2 "https://github.com/ilyasmohetna/flyaway/blob/main/config/database.php"
    click DB3 "https://github.com/ilyasmohetna/flyaway/blob/main/cities.json"
    click DB4 "https://github.com/ilyasmohetna/flyaway/blob/main/countries.json"
    click DB5 "https://github.com/ilyasmohetna/flyaway/blob/main/states.json"

    %% Click Event for Static Assets
    click S1 "https://github.com/ilyasmohetna/flyaway/tree/main/public"

    %% Styles
    classDef deployment fill:#dcedc8,stroke:#333,stroke-width:2px;
    classDef backend fill:#f8e1f6,stroke:#333,stroke-width:2px;
    classDef frontend fill:#e3f2fd,stroke:#333,stroke-width:2px;
    classDef database fill:#ffecb3,stroke:#333,stroke-width:2px;
    classDef static fill:#ffe0b2,stroke:#333,stroke-width:2px;
```
