# suprithh7/aerotwin architecture

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

- Interactive diagram: https://gitdiagram.com/suprithh7/aerotwin
- Repository: https://github.com/suprithh7/aerotwin

## Overview

AeroTwin is a browser-based, seeded UAV-engine mission rehearsal simulator. Users edit and assess a mission in BRIEF, run a fault-injected FLY rehearsal, then inspect detection and Data Guard outcomes in DEBRIEF; the E-key engineering console exposes the same simulation and diagnosis models. The graph preserves the documented planning, simulation, navigation, diagnosis, rehearsal, and encrypted-payload capabilities. Some stage internals were not sampled, so their documented relationships use README evidence; unsampled implementation details are not inferred.

Main entry points: [`src/mission/missionStore.ts`](https://github.com/suprithh7/aerotwin/blob/main/src/mission/missionStore.ts) (Mission store), [`src/components/rehearsal/EngineerOverlay.tsx`](https://github.com/suprithh7/aerotwin/blob/main/src/components/rehearsal/EngineerOverlay.tsx) (Engineering overlay), [`src/components/rehearsal/FlyStage.tsx`](https://github.com/suprithh7/aerotwin/blob/main/src/components/rehearsal/FlyStage.tsx) (Flight display), [`src/payload/session.ts`](https://github.com/suprithh7/aerotwin/blob/main/src/payload/session.ts) (Payload session)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_planning["Mission planning"]
  node_brief["Mission editor<br/>[BriefStage.tsx]"]
  node_mission[("Mission store<br/>[missionStore.ts]")]
  node_geojson["GeoJSON exchange<br/>[geoJson.ts]"]
  node_weather["Weather and terrain<br/>[weather.ts]"]
  node_preflight["Preflight checks<br/>[preflight.ts]"]
  node_risk["Monte Carlo risk<br/>[monteCarlo.ts]"]
  node_route["Route geometry<br/>[route.ts]"]
  node_nav["Alternate reachability<br/>[alternates.ts]"]
end

subgraph group_twin["Engine twin"]
  node_simstate[("Simulation state<br/>[store.ts]")]
  node_worker["Simulation worker<br/>[worker.ts]"]
  node_engine["Engine model<br/>[engineModel.ts]"]
  node_diagnosis["Fault diagnosis<br/>[diagnose.ts]"]
  node_rul["Life projection<br/>[rul.ts]"]
end

subgraph group_rehearsal["Rehearsal experience"]
  node_app["Stage shell<br/>[App.tsx]"]
  node_fly["Flight display<br/>[FlyStage.tsx]"]
  node_director["Failure director<br/>[director.ts]"]
  node_rehearsalstore[("Rehearsal state<br/>[store.ts]")]
  node_debrief["Debrief report<br/>[DebriefStage.tsx]"]
  node_map["Rehearsal map<br/>[RehearsalMap.tsx]"]
end

subgraph group_payload["Data Guard"]
  node_session["Payload session<br/>[session.ts]"]
  node_crypto["Payload cryptography<br/>[crypto.ts]"]
  node_offload["Priority offload<br/>[offload.ts]"]
  node_guard["Data Guard policy<br/>[guard.ts]"]
end

subgraph group_engineering["Engineering console"]
  node_overlay["Engineering overlay"]
  node_diagnosisui["Diagnosis panel<br/>[DiagnosisPanel.tsx]"]
  node_faultui["Fault controls<br/>[FaultPanel.tsx]"]
  node_charts["Strip charts<br/>[StripCharts.tsx]"]
  node_schematic["Engine schematic"]
end

node_pilot(("Mission operator"))

node_pilot -->|"edits mission"| node_brief
node_brief -->|"updates"| node_mission
node_mission -->|"round-trips"| node_geojson
node_mission -->|"fetches forecasts"| node_weather
node_mission -->|"assesses"| node_preflight
node_mission -->|"requests risk run"| node_risk
node_mission -->|"resolves route"| node_route
node_pilot -->|"runs rehearsal"| node_fly
node_app -->|"renders stage"| node_brief
node_app -->|"renders stage"| node_fly
node_app -->|"renders stage"| node_debrief
node_fly -->|"reads telemetry"| node_simstate
node_simstate -->|"sends commands"| node_worker
node_worker -.->|"steps simulation"| node_engine
node_worker -->|"classifies snapshots"| node_diagnosis
node_diagnosis -->|"estimates life"| node_rul
node_fly -->|"injects events"| node_director
node_director -.->|"dispatches faults"| node_simstate
node_fly -->|"shows reachability"| node_nav
node_nav -->|"uses leg geometry"| node_route
node_fly -->|"runs Data Guard"| node_session
node_session -->|"encrypts items"| node_crypto
node_session -->|"sends priority queue"| node_offload
node_session -->|"evaluates policy"| node_guard
node_session -->|"checks landing options"| node_nav
node_pilot -->|"reviews outcome"| node_debrief
node_debrief -.->|"reads run record"| node_rehearsalstore
node_app -->|"opens on E key"| node_overlay
node_overlay -->|"renders validation map"| node_map
node_overlay -->|"renders controls"| node_faultui
node_overlay -->|"renders diagnosis"| node_diagnosisui
node_overlay -->|"renders charts"| node_charts
node_overlay -->|"renders schematic"| node_schematic
node_schematic -->|"reads snapshot"| node_simstate

click node_app "https://github.com/suprithh7/aerotwin/blob/main/src/App.tsx"
click node_brief "https://github.com/suprithh7/aerotwin/blob/main/src/components/rehearsal/BriefStage.tsx"
click node_mission "https://github.com/suprithh7/aerotwin/blob/main/src/mission/missionStore.ts"
click node_geojson "https://github.com/suprithh7/aerotwin/blob/main/src/mission/geoJson.ts"
click node_weather "https://github.com/suprithh7/aerotwin/blob/main/src/mission/weather.ts"
click node_preflight "https://github.com/suprithh7/aerotwin/blob/main/src/mission/preflight.ts"
click node_risk "https://github.com/suprithh7/aerotwin/blob/main/src/mission/monteCarlo.ts"
click node_route "https://github.com/suprithh7/aerotwin/blob/main/src/mission/route.ts"
click node_nav "https://github.com/suprithh7/aerotwin/blob/main/src/nav/alternates.ts"
click node_fly "https://github.com/suprithh7/aerotwin/blob/main/src/components/rehearsal/FlyStage.tsx"
click node_director "https://github.com/suprithh7/aerotwin/blob/main/src/rehearsal/director.ts"
click node_rehearsalstore "https://github.com/suprithh7/aerotwin/blob/main/src/rehearsal/store.ts"
click node_debrief "https://github.com/suprithh7/aerotwin/blob/main/src/components/rehearsal/DebriefStage.tsx"
click node_simstate "https://github.com/suprithh7/aerotwin/blob/main/src/state/store.ts"
click node_worker "https://github.com/suprithh7/aerotwin/blob/main/src/sim/worker.ts"
click node_engine "https://github.com/suprithh7/aerotwin/blob/main/src/sim/engineModel.ts"
click node_diagnosis "https://github.com/suprithh7/aerotwin/blob/main/src/diagnosis/diagnose.ts"
click node_rul "https://github.com/suprithh7/aerotwin/blob/main/src/diagnosis/rul.ts"
click node_session "https://github.com/suprithh7/aerotwin/blob/main/src/payload/session.ts"
click node_crypto "https://github.com/suprithh7/aerotwin/blob/main/src/payload/crypto.ts"
click node_offload "https://github.com/suprithh7/aerotwin/blob/main/src/payload/offload.ts"
click node_guard "https://github.com/suprithh7/aerotwin/blob/main/src/payload/guard.ts"
click node_overlay "https://github.com/suprithh7/aerotwin/blob/main/src/components/rehearsal/EngineerOverlay.tsx"
click node_diagnosisui "https://github.com/suprithh7/aerotwin/blob/main/src/components/DiagnosisPanel.tsx"
click node_faultui "https://github.com/suprithh7/aerotwin/blob/main/src/components/FaultPanel.tsx"
click node_charts "https://github.com/suprithh7/aerotwin/blob/main/src/components/StripCharts.tsx"
click node_schematic "https://github.com/suprithh7/aerotwin/blob/main/src/components/EngineSchematic.tsx"
click node_map "https://github.com/suprithh7/aerotwin/blob/main/src/components/rehearsal/RehearsalMap.tsx"

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_brief,node_mission,node_geojson,node_weather,node_preflight,node_risk,node_route,node_nav toneBlue
class node_simstate,node_worker,node_engine,node_diagnosis,node_rul toneAmber
class node_app,node_fly,node_director,node_rehearsalstore,node_debrief,node_map toneMint
class node_session,node_crypto,node_offload,node_guard toneRose
class node_overlay,node_diagnosisui,node_faultui,node_charts,node_schematic,node_pilot toneIndigo
```

## Components

### Mission planning

- [Mission editor](https://github.com/suprithh7/aerotwin/blob/main/src/components/rehearsal/BriefStage.tsx): `src/components/rehearsal/BriefStage.tsx`
- [Mission store](https://github.com/suprithh7/aerotwin/blob/main/src/mission/missionStore.ts): `src/mission/missionStore.ts`
- [GeoJSON exchange](https://github.com/suprithh7/aerotwin/blob/main/src/mission/geoJson.ts): `src/mission/geoJson.ts`
- [Weather and terrain](https://github.com/suprithh7/aerotwin/blob/main/src/mission/weather.ts): `src/mission/weather.ts`
- [Preflight checks](https://github.com/suprithh7/aerotwin/blob/main/src/mission/preflight.ts): `src/mission/preflight.ts`
- [Monte Carlo risk](https://github.com/suprithh7/aerotwin/blob/main/src/mission/monteCarlo.ts): `src/mission/monteCarlo.ts`
- [Route geometry](https://github.com/suprithh7/aerotwin/blob/main/src/mission/route.ts): `src/mission/route.ts`
- [Alternate reachability](https://github.com/suprithh7/aerotwin/blob/main/src/nav/alternates.ts): `src/nav/alternates.ts`

### Engine twin

- [Simulation state](https://github.com/suprithh7/aerotwin/blob/main/src/state/store.ts): `src/state/store.ts`
- [Simulation worker](https://github.com/suprithh7/aerotwin/blob/main/src/sim/worker.ts): `src/sim/worker.ts`
- [Engine model](https://github.com/suprithh7/aerotwin/blob/main/src/sim/engineModel.ts): `src/sim/engineModel.ts`
- [Fault diagnosis](https://github.com/suprithh7/aerotwin/blob/main/src/diagnosis/diagnose.ts): `src/diagnosis/diagnose.ts`
- [Life projection](https://github.com/suprithh7/aerotwin/blob/main/src/diagnosis/rul.ts): `src/diagnosis/rul.ts`

### Rehearsal experience

- [Stage shell](https://github.com/suprithh7/aerotwin/blob/main/src/App.tsx): `src/App.tsx`
- [Flight display](https://github.com/suprithh7/aerotwin/blob/main/src/components/rehearsal/FlyStage.tsx): `src/components/rehearsal/FlyStage.tsx`
- [Failure director](https://github.com/suprithh7/aerotwin/blob/main/src/rehearsal/director.ts): `src/rehearsal/director.ts`
- [Rehearsal state](https://github.com/suprithh7/aerotwin/blob/main/src/rehearsal/store.ts): `src/rehearsal/store.ts`
- [Debrief report](https://github.com/suprithh7/aerotwin/blob/main/src/components/rehearsal/DebriefStage.tsx): `src/components/rehearsal/DebriefStage.tsx`
- [Rehearsal map](https://github.com/suprithh7/aerotwin/blob/main/src/components/rehearsal/RehearsalMap.tsx): `src/components/rehearsal/RehearsalMap.tsx`

### Data Guard

- [Payload session](https://github.com/suprithh7/aerotwin/blob/main/src/payload/session.ts): `src/payload/session.ts`
- [Payload cryptography](https://github.com/suprithh7/aerotwin/blob/main/src/payload/crypto.ts): `src/payload/crypto.ts`
- [Priority offload](https://github.com/suprithh7/aerotwin/blob/main/src/payload/offload.ts): `src/payload/offload.ts`
- [Data Guard policy](https://github.com/suprithh7/aerotwin/blob/main/src/payload/guard.ts): `src/payload/guard.ts`

### Engineering console

- [Engineering overlay](https://github.com/suprithh7/aerotwin/blob/main/src/components/rehearsal/EngineerOverlay.tsx): `src/components/rehearsal/EngineerOverlay.tsx`
- [Diagnosis panel](https://github.com/suprithh7/aerotwin/blob/main/src/components/DiagnosisPanel.tsx): `src/components/DiagnosisPanel.tsx`
- [Fault controls](https://github.com/suprithh7/aerotwin/blob/main/src/components/FaultPanel.tsx): `src/components/FaultPanel.tsx`
- [Strip charts](https://github.com/suprithh7/aerotwin/blob/main/src/components/StripCharts.tsx): `src/components/StripCharts.tsx`
- [Engine schematic](https://github.com/suprithh7/aerotwin/blob/main/src/components/EngineSchematic.tsx): `src/components/EngineSchematic.tsx`

### Other components

- **Mission operator**

## Connections

- Mission operator → Mission editor: edits mission (evidence: `README.md`)
- Mission editor → Mission store: updates (evidence: `README.md`)
- Mission store → GeoJSON exchange: round-trips (evidence: `src/mission/missionStore.ts`)
- Mission store → Weather and terrain: fetches forecasts (evidence: `src/mission/missionStore.ts`)
- Mission store → Preflight checks: assesses (evidence: `README.md`)
- Mission store → Monte Carlo risk: requests risk run (evidence: `src/mission/missionStore.ts`)
- Mission store → Route geometry: resolves route (evidence: `src/mission/missionStore.ts`)
- Mission operator → Flight display: runs rehearsal (evidence: `README.md`)
- Stage shell → Mission editor: renders stage (evidence: `src/App.tsx`)
- Stage shell → Flight display: renders stage (evidence: `src/App.tsx`)
- Stage shell → Debrief report: renders stage (evidence: `src/App.tsx`)
- Flight display → Simulation state: reads telemetry (evidence: `README.md`)
- Simulation state → Simulation worker: sends commands (evidence: `src/state/store.ts`)
- Simulation worker → Engine model: steps simulation (evidence: `src/sim/worker.ts`)
- Simulation worker → Fault diagnosis: classifies snapshots (evidence: `src/sim/worker.ts`)
- Fault diagnosis → Life projection: estimates life (evidence: `src/diagnosis/diagnose.ts`)
- Flight display → Failure director: injects events (evidence: `README.md`)
- Failure director → Simulation state: dispatches faults
- Flight display → Alternate reachability: shows reachability (evidence: `README.md`)
- Alternate reachability → Route geometry: uses leg geometry (evidence: `src/nav/alternates.ts`)
- Flight display → Payload session: runs Data Guard (evidence: `README.md`)
- Payload session → Payload cryptography: encrypts items (evidence: `src/payload/session.ts`)
- Payload session → Priority offload: sends priority queue (evidence: `src/payload/session.ts`)
- Payload session → Data Guard policy: evaluates policy (evidence: `src/payload/session.ts`)
- Payload session → Alternate reachability: checks landing options (evidence: `src/payload/session.ts`)
- Mission operator → Debrief report: reviews outcome (evidence: `README.md`)
- Debrief report → Rehearsal state: reads run record
- Stage shell → Engineering overlay: opens on E key (evidence: `src/App.tsx`)
- Engineering overlay → Rehearsal map: renders validation map (evidence: `src/components/rehearsal/EngineerOverlay.tsx`)
- Engineering overlay → Fault controls: renders controls (evidence: `src/components/rehearsal/EngineerOverlay.tsx`)
- Engineering overlay → Diagnosis panel: renders diagnosis (evidence: `src/components/rehearsal/EngineerOverlay.tsx`)
- Engineering overlay → Strip charts: renders charts (evidence: `src/components/rehearsal/EngineerOverlay.tsx`)
- Engineering overlay → Engine schematic: renders schematic (evidence: `src/components/rehearsal/EngineerOverlay.tsx`)
- Engine schematic → Simulation state: reads snapshot (evidence: `src/components/EngineSchematic.tsx`)
