# moreiramicael/aerostream architecture

> Architecture diagram of the GitHub repository moreiramicael/aerostream, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/moreiramicael/aerostream
- Repository: https://github.com/moreiramicael/aerostream

## Overview

AeroStream is a UAV-swarm ground-control and telemetry stack. Drones or the simulator POST telemetry to the .NET API, which checks battery/geofence conditions, queues accepted records, and returns pending commands; a background processor broadcasts live updates and batches persistence. Operators use the dashboard to monitor drones and submit routes, geofences, and commands. RabbitMQ carries durable command dispatch and alert events. The graph preserves the README’s simulator, observability, and operator-control capabilities; unsampled subsystem paths and edges rely only on documented behavior, while source-level call detail is limited to the excerpts and source index.

Main entry points: [`src/AeroStream.Ingestion/Program.cs`](https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/Program.cs) (Minimal API), [`src/AeroStream.Ingestion/TelemetryProcessor.cs`](https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/TelemetryProcessor.cs) (Telemetry Processor), [`src/AeroStream.Ingestion/TelemetryDbContext.cs`](https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/TelemetryDbContext.cs) (EF Database Context), [`src/AeroStream.Ingestion/RabbitMqPublisher.cs`](https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/RabbitMqPublisher.cs) (RabbitMQ Publisher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_aircraft["Aircraft &amp; Simulation"]
  node_drone["UAV / Simulator<br/>[simulate.js]"]
  node_firmware["ESP32 Firmware<br/>[main.cpp]"]
  node_msp["Flight Controller MSP<br/>[msp.cpp]"]
end

subgraph group_ingestion["Telemetry Ingestion"]
  node_api["Minimal API<br/>[Program.cs]"]
  node_channel["Telemetry Channel<br/>[Program.cs]"]
  node_processor["Telemetry Processor"]
  node_hub["SignalR Hub<br/>[TelemetryHub.cs]"]
  node_record["Telemetry Record<br/>[TelemetryRecord.cs]"]
  node_dbcontext["EF Database Context"]
  node_postgres[("PostgreSQL")]
  node_geofence["Geofence State &amp; Checks<br/>[Program.cs]"]
end

subgraph group_control["Command &amp; Events"]
  node_publisher["RabbitMQ Publisher"]
  node_rabbitmq["RabbitMQ Exchange &amp; Queues"]
  node_consumer["Dispatch Consumer"]
  node_commandqueue["Pending Drone Commands<br/>[Program.cs]"]
end

subgraph group_dashboard["Operator Dashboard"]
  node_dashboard["Tactical Dashboard<br/>[App.tsx]"]
end

subgraph group_observability["Observability"]
  node_prometheus["Prometheus Metrics<br/>[prometheus.yml]"]
  node_grafana["Grafana Dashboard<br/>[aerostream.json]"]
end

node_operator(("Operator"))

node_drone -.->|"sends telemetry"| node_api
node_firmware -->|"reads flight data"| node_msp
node_firmware -->|"POSTs telemetry"| node_api
node_api -->|"enqueues records"| node_channel
node_channel -->|"feeds records"| node_processor
node_processor -->|"broadcasts updates"| node_hub
node_hub -->|"streams telemetry"| node_dashboard
node_processor -->|"persists batches"| node_dbcontext
node_dbcontext -->|"maps records"| node_record
node_dbcontext -.->|"reads/writes"| node_postgres
node_api -->|"checks boundary"| node_geofence
node_api -->|"publishes alerts"| node_publisher
node_api -->|"publishes commands"| node_publisher
node_publisher -->|"publishes events"| node_rabbitmq
node_rabbitmq -->|"dispatches messages"| node_consumer
node_consumer -->|"stores commands"| node_commandqueue
node_api -.->|"returns pending C2"| node_commandqueue
node_commandqueue -.->|"delivers on ACK"| node_drone
node_operator -.->|"uses controls"| node_dashboard
node_dashboard -->|"sends HTTP commands"| node_api
node_api -.->|"exposes metrics"| node_prometheus
node_prometheus -.->|"feeds dashboards"| node_grafana

click node_drone "https://github.com/moreiramicael/aerostream/blob/main/simulate.js"
click node_firmware "https://github.com/moreiramicael/aerostream/blob/main/firmware/src/main.cpp"
click node_msp "https://github.com/moreiramicael/aerostream/blob/main/firmware/src/msp.cpp"
click node_dashboard "https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Dashboard/src/App.tsx"
click node_api "https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/Program.cs"
click node_channel "https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/Program.cs"
click node_processor "https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/TelemetryProcessor.cs"
click node_hub "https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/TelemetryHub.cs"
click node_record "https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/TelemetryRecord.cs"
click node_dbcontext "https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/TelemetryDbContext.cs"
click node_geofence "https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/Program.cs"
click node_publisher "https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/RabbitMqPublisher.cs"
click node_consumer "https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/CommandDispatchConsumer.cs"
click node_commandqueue "https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/Program.cs"
click node_prometheus "https://github.com/moreiramicael/aerostream/blob/main/prometheus.yml"
click node_grafana "https://github.com/moreiramicael/aerostream/blob/main/grafana/provisioning/dashboards/aerostream.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_drone,node_firmware,node_msp toneBlue
class node_api,node_channel,node_processor,node_hub,node_record,node_dbcontext,node_postgres,node_geofence toneAmber
class node_publisher,node_rabbitmq,node_consumer,node_commandqueue toneMint
class node_dashboard toneRose
class node_prometheus,node_grafana,node_operator toneIndigo
```

## Components

### Aircraft & Simulation

- [UAV / Simulator](https://github.com/moreiramicael/aerostream/blob/main/simulate.js): `simulate.js`
- [ESP32 Firmware](https://github.com/moreiramicael/aerostream/blob/main/firmware/src/main.cpp): `firmware/src/main.cpp`
- [Flight Controller MSP](https://github.com/moreiramicael/aerostream/blob/main/firmware/src/msp.cpp): `firmware/src/msp.cpp`

### Telemetry Ingestion

- [Minimal API](https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/Program.cs): `src/AeroStream.Ingestion/Program.cs`
- [Telemetry Channel](https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/Program.cs): `src/AeroStream.Ingestion/Program.cs`
- [Telemetry Processor](https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/TelemetryProcessor.cs): `src/AeroStream.Ingestion/TelemetryProcessor.cs`
- [SignalR Hub](https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/TelemetryHub.cs): `src/AeroStream.Ingestion/TelemetryHub.cs`
- [Telemetry Record](https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/TelemetryRecord.cs): `src/AeroStream.Ingestion/TelemetryRecord.cs`
- [EF Database Context](https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/TelemetryDbContext.cs): `src/AeroStream.Ingestion/TelemetryDbContext.cs`
- **PostgreSQL**
- [Geofence State & Checks](https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/Program.cs): `src/AeroStream.Ingestion/Program.cs`

### Command & Events

- [RabbitMQ Publisher](https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/RabbitMqPublisher.cs): `src/AeroStream.Ingestion/RabbitMqPublisher.cs`
- **RabbitMQ Exchange & Queues**
- [Dispatch Consumer](https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/CommandDispatchConsumer.cs): `src/AeroStream.Ingestion/CommandDispatchConsumer.cs`
- [Pending Drone Commands](https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Ingestion/Program.cs): `src/AeroStream.Ingestion/Program.cs`

### Operator Dashboard

- [Tactical Dashboard](https://github.com/moreiramicael/aerostream/blob/main/src/AeroStream.Dashboard/src/App.tsx): `src/AeroStream.Dashboard/src/App.tsx`

### Observability

- [Prometheus Metrics](https://github.com/moreiramicael/aerostream/blob/main/prometheus.yml): `prometheus.yml`
- [Grafana Dashboard](https://github.com/moreiramicael/aerostream/blob/main/grafana/provisioning/dashboards/aerostream.json): `grafana/provisioning/dashboards/aerostream.json`

### Other components

- **Operator**

## Connections

- UAV / Simulator → Minimal API: sends telemetry (evidence: `README.md`)
- ESP32 Firmware → Flight Controller MSP: reads flight data (evidence: `firmware/src/main.cpp`)
- ESP32 Firmware → Minimal API: POSTs telemetry (evidence: `firmware/src/main.cpp`)
- Minimal API → Telemetry Channel: enqueues records (evidence: `README.md`)
- Telemetry Channel → Telemetry Processor: feeds records (evidence: `src/AeroStream.Ingestion/TelemetryProcessor.cs`)
- Telemetry Processor → SignalR Hub: broadcasts updates (evidence: `src/AeroStream.Ingestion/TelemetryProcessor.cs`)
- SignalR Hub → Tactical Dashboard: streams telemetry (evidence: `src/AeroStream.Dashboard/src/App.tsx`)
- Telemetry Processor → EF Database Context: persists batches (evidence: `src/AeroStream.Ingestion/TelemetryProcessor.cs`)
- EF Database Context → Telemetry Record: maps records (evidence: `src/AeroStream.Ingestion/TelemetryDbContext.cs`)
- EF Database Context → PostgreSQL: reads/writes (evidence: `README.md`)
- Minimal API → Geofence State & Checks: checks boundary (evidence: `src/AeroStream.Ingestion/Program.cs`)
- Minimal API → RabbitMQ Publisher: publishes alerts (evidence: `src/AeroStream.Ingestion/Program.cs`)
- Minimal API → RabbitMQ Publisher: publishes commands (evidence: `src/AeroStream.Ingestion/Program.cs`)
- RabbitMQ Publisher → RabbitMQ Exchange & Queues: publishes events (evidence: `src/AeroStream.Ingestion/RabbitMqPublisher.cs`)
- RabbitMQ Exchange & Queues → Dispatch Consumer: dispatches messages (evidence: `src/AeroStream.Ingestion/CommandDispatchConsumer.cs`)
- Dispatch Consumer → Pending Drone Commands: stores commands (evidence: `src/AeroStream.Ingestion/CommandDispatchConsumer.cs`)
- Minimal API → Pending Drone Commands: returns pending C2 (evidence: `README.md`)
- Pending Drone Commands → UAV / Simulator: delivers on ACK (evidence: `README.md`)
- Operator → Tactical Dashboard: uses controls (evidence: `README.md`)
- Tactical Dashboard → Minimal API: sends HTTP commands (evidence: `src/AeroStream.Dashboard/src/App.tsx`)
- Minimal API → Prometheus Metrics: exposes metrics (evidence: `README.md`)
- Prometheus Metrics → Grafana Dashboard: feeds dashboards (evidence: `README.md`)
