# eagletrt/backend-configuration architecture

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

- Interactive diagram: https://gitdiagram.com/eagletrt/backend-configuration
- Repository: https://github.com/eagletrt/backend-configuration

## Overview

##### Main Components Identification

- Nginx (Reverse Proxy/Load Balancer)
- MongoDB Database
- InfluxDB (implied by the influx-logger)
- Mosquitto (MQTT Broker)
- Ghost (Content Management System)
- Multiple Custom Services:
- Eagle App
- Influx Logger
- Telemetry Service
- Telemetry API

**┌─ Client Layer**
- External Clients/Applications

- Gateway Layer
- Nginx (Reverse Proxy with SSL/TLS)

- Application Services Layer
- Eagle App
- Telemetry API
- Telemetry Service
- Influx Logger

- Data Layer
- MongoDB
- InfluxDB
- Mosquitto (MQTT Broker)

##### Specific Elements

a) Gateway Layer:
- Nginx with SSL/TLS termination
- Logging paths (NGINX_LOGS_DIR)
- SSL certificate management (NGINX_LETSENCRYPT_DIR)

b) Application Services:
- Configuration file connections
- Environment variable dependencies
- Service interconnections

c) Data Layer:
- Database connections with authentication
- Persistent storage volumes
- Message broker topics/patterns

##### Additional Details

- Docker container boundaries
- Configuration file locations
- Environment variable dependencies
- Network connections
- Data flow directions

##### Relationships to Highlight

- How Nginx routes requests to different services
- How the Telemetry API interacts with databases
- How the Influx Logger processes and stores data
- Message flow through the MQTT broker

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef gateway fill:#3498db,stroke:#2980b9,color:white
    classDef service fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#e74c3c,stroke:#c0392b,color:white
    classDef broker fill:#f1c40f,stroke:#f39c12,color:black
    classDef security fill:#9b59b6,stroke:#8e44ad,color:white
    classDef client fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Client Layer
    subgraph ClientLayer["Client Layer"]
        Clients["External Clients"]:::client
    end

    %% Gateway Layer
    subgraph GatewayLayer["Gateway Layer"]
        Nginx["Nginx Reverse Proxy"]:::gateway
        SSL["SSL/TLS Certificates"]:::security
    end

    %% Application Services Layer
    subgraph AppLayer["Application Services Layer"]
        EagleApp["Eagle App"]:::service
        TelemetryAPI["Telemetry API"]:::service
        TelemetryService["Telemetry Service"]:::service
        InfluxLogger["Influx Logger"]:::service
        Ghost["Ghost CMS"]:::service
    end

    %% Data Layer
    subgraph DataLayer["Data Layer"]
        MongoDB[(MongoDB)]:::database
        InfluxDB[(InfluxDB)]:::database
        Mosquitto{{"Mosquitto MQTT"}}:::broker
    end

    %% Relationships
    Clients --> Nginx
    Nginx --> SSL
    Nginx --> EagleApp
    Nginx --> TelemetryAPI
    Nginx --> Ghost
    TelemetryAPI --> MongoDB
    TelemetryAPI --> InfluxDB
    TelemetryService --> Mosquitto
    InfluxLogger --> InfluxDB
    InfluxLogger --> Mosquitto
    TelemetryService --> MongoDB

    %% Click Events
    click Nginx "https://github.com/eagletrt/backend-configuration/blob/master/configs/nginx.conf"
    click Mosquitto "https://github.com/eagletrt/backend-configuration/blob/master/configs/mosquitto.conf"
    click Ghost "https://github.com/eagletrt/backend-configuration/blob/master/configs/ghost.json"
    click EagleApp "https://github.com/eagletrt/backend-configuration/tree/master/repos/eagle-app"
    click InfluxLogger "https://github.com/eagletrt/backend-configuration/tree/master/repos/influx-logger"
    click TelemetryService "https://github.com/eagletrt/backend-configuration/tree/master/repos/telemetry"
    click TelemetryAPI "https://github.com/eagletrt/backend-configuration/tree/master/repos/telemetry-api"

    %% Legend
    subgraph Legend["Legend"]
        L1["Gateway"]:::gateway
        L2["Service"]:::service
        L3[(Database)]:::database
        L4{{"Message Broker"}}:::broker
        L5["Security"]:::security
    end
```
