# snansrin/flightsimrc architecture

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

- Interactive diagram: https://gitdiagram.com/snansrin/flightsimrc
- Repository: https://github.com/snansrin/flightsimrc

## Overview

FlightSimRC is a browser-based RC aircraft simulator for solo practice and informal multiplayer flying. The pilot selects an aircraft, field, and conditions; configures keyboard or controller input; flies a physics-driven session; and views instruments, scenery, and optional remote pilots. Separate capabilities include guided controller calibration, flight-school lessons, and engine audio. The graph follows documented and indexed relationships; some source files were not sampled, so uncertain links are omitted rather than inferred.

Main entry points: [`src/main.tsx`](https://github.com/snansrin/flightsimrc/blob/main/src/main.tsx) (App and flight UI), [`src/sim/simulation.ts`](https://github.com/snansrin/flightsimrc/blob/main/src/sim/simulation.ts) (Simulation engine), [`src/scene/FlightScene.tsx`](https://github.com/snansrin/flightsimrc/blob/main/src/scene/FlightScene.tsx) (Flight scene), [`src/scene/Airfield.tsx`](https://github.com/snansrin/flightsimrc/blob/main/src/scene/Airfield.tsx) (Airfield scenery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Flight experience"]
  node_app["App and flight UI<br/>[main.tsx]"]
  node_flightdeck["Flight deck<br/>[FlightDeck.tsx]"]
  node_aircraft["Aircraft selection<br/>[AircraftHangar.tsx]"]
  node_quickflight["Quick flight<br/>[quickFlight.ts]"]
end

subgraph group_controls["Controller setup"]
  node_controller["Controller profiles"]
  node_hid["USB HID input<br/>[hid.ts]"]
  node_mapping["Input mapping<br/>[input.ts]"]
  node_guided["Guided calibration<br/>[guidedSetup.ts]"]
  node_signal["Signal display"]
end

subgraph group_simulation["Flight simulation"]
  node_flightstate["Flight state and controls<br/>[flight.ts]"]
  node_engine["Simulation engine<br/>[simulation.ts]"]
  node_catalog["Aircraft catalogue<br/>[catalog.ts]"]
  node_aero["Aerodynamics<br/>[aero.ts]"]
  node_rotor["Rotorcraft dynamics<br/>[rotor.ts]"]
  node_rigidbody["Rigid-body dynamics<br/>[rigidBody.ts]"]
  node_atmosphere["Atmosphere and wind<br/>[atmosphere.ts]"]
end

subgraph group_world["World and rendering"]
  node_fields["Airfields and weather<br/>[fields.ts]"]
  node_terrain["Geographic terrain<br/>[worldTerrain.ts]"]
  node_worldpicker["World picker<br/>[WorldPicker.tsx]"]
  node_scene["Flight scene<br/>[FlightScene.tsx]"]
  node_vehicles["Aircraft rendering<br/>[Vehicles.tsx]"]
  node_airfield["Airfield scenery<br/>[Airfield.tsx]"]
  node_earth["Earth terrain rendering<br/>[EarthTerrain.tsx]"]
  node_instruments["Flight instruments<br/>[Instruments.tsx]"]
end

subgraph group_features["Training and multiplayer"]
  node_school["Flight school<br/>[school.ts]"]
  node_multiplayer["Multiplayer rooms<br/>[multiplayer.ts]"]
  node_remote["Remote aircraft<br/>[RemoteAircraft.tsx]"]
  node_audio["Engine audio<br/>[audio.ts]"]
end

node_pilot(("Pilot"))
node_supabase["Supabase Realtime"]

node_pilot -->|"uses"| node_app
node_app -->|"shows"| node_aircraft
node_app -->|"renders"| node_flightdeck
node_app -->|"uses"| node_quickflight
node_pilot -->|"configures"| node_controller
node_app -->|"uses"| node_controller
node_app -->|"opens"| node_hid
node_hid -->|"provides signals"| node_mapping
node_app -->|"reads"| node_mapping
node_app -->|"uses"| node_guided
node_mapping -->|"defines controls"| node_flightstate
node_app -->|"renders"| node_signal
node_app -->|"runs"| node_engine
node_engine -->|"selects aircraft"| node_catalog
node_engine -->|"gets field data"| node_fields
node_engine -->|"computes forces"| node_aero
node_engine -->|"computes rotor forces"| node_rotor
node_engine -->|"integrates motion"| node_rigidbody
node_engine -->|"builds environment"| node_atmosphere
node_worldpicker -->|"uses terrain"| node_terrain
node_app -->|"shows"| node_worldpicker
node_app -->|"renders"| node_scene
node_scene -->|"renders"| node_vehicles
node_scene -->|"renders"| node_airfield
node_scene -->|"renders"| node_earth
node_scene -->|"renders"| node_remote
node_scene -.->|"displays"| node_instruments
node_airfield -->|"reads field data"| node_fields
node_airfield -->|"reads wind"| node_atmosphere
node_earth -->|"uses terrain"| node_terrain
node_vehicles -.->|"uses aircraft specs"| node_catalog
node_app -->|"uses"| node_school
node_app -->|"uses"| node_multiplayer
node_multiplayer -->|"broadcasts"| node_supabase
node_scene -->|"reads remote pilots"| node_multiplayer
node_app -->|"creates"| node_audio

click node_app "https://github.com/snansrin/flightsimrc/blob/main/src/main.tsx"
click node_flightdeck "https://github.com/snansrin/flightsimrc/blob/main/src/FlightDeck.tsx"
click node_aircraft "https://github.com/snansrin/flightsimrc/blob/main/src/AircraftHangar.tsx"
click node_quickflight "https://github.com/snansrin/flightsimrc/blob/main/src/quickFlight.ts"
click node_controller "https://github.com/snansrin/flightsimrc/blob/main/src/controllerSelection.ts"
click node_hid "https://github.com/snansrin/flightsimrc/blob/main/src/hid.ts"
click node_mapping "https://github.com/snansrin/flightsimrc/blob/main/src/input.ts"
click node_guided "https://github.com/snansrin/flightsimrc/blob/main/src/guidedSetup.ts"
click node_signal "https://github.com/snansrin/flightsimrc/blob/main/src/ControllerSignalRow.tsx"
click node_flightstate "https://github.com/snansrin/flightsimrc/blob/main/src/flight.ts"
click node_engine "https://github.com/snansrin/flightsimrc/blob/main/src/sim/simulation.ts"
click node_catalog "https://github.com/snansrin/flightsimrc/blob/main/src/sim/catalog.ts"
click node_aero "https://github.com/snansrin/flightsimrc/blob/main/src/sim/aero.ts"
click node_rotor "https://github.com/snansrin/flightsimrc/blob/main/src/sim/rotor.ts"
click node_rigidbody "https://github.com/snansrin/flightsimrc/blob/main/src/sim/rigidBody.ts"
click node_atmosphere "https://github.com/snansrin/flightsimrc/blob/main/src/sim/atmosphere.ts"
click node_fields "https://github.com/snansrin/flightsimrc/blob/main/src/sim/fields.ts"
click node_terrain "https://github.com/snansrin/flightsimrc/blob/main/src/sim/worldTerrain.ts"
click node_worldpicker "https://github.com/snansrin/flightsimrc/blob/main/src/WorldPicker.tsx"
click node_scene "https://github.com/snansrin/flightsimrc/blob/main/src/scene/FlightScene.tsx"
click node_vehicles "https://github.com/snansrin/flightsimrc/blob/main/src/scene/Vehicles.tsx"
click node_airfield "https://github.com/snansrin/flightsimrc/blob/main/src/scene/Airfield.tsx"
click node_earth "https://github.com/snansrin/flightsimrc/blob/main/src/scene/EarthTerrain.tsx"
click node_instruments "https://github.com/snansrin/flightsimrc/blob/main/src/scene/Instruments.tsx"
click node_school "https://github.com/snansrin/flightsimrc/blob/main/src/school.ts"
click node_multiplayer "https://github.com/snansrin/flightsimrc/blob/main/src/multiplayer.ts"
click node_remote "https://github.com/snansrin/flightsimrc/blob/main/src/scene/RemoteAircraft.tsx"
click node_audio "https://github.com/snansrin/flightsimrc/blob/main/src/audio.ts"

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_app,node_flightdeck,node_aircraft,node_quickflight toneBlue
class node_controller,node_hid,node_mapping,node_guided,node_signal toneAmber
class node_flightstate,node_engine,node_catalog,node_aero,node_rotor,node_rigidbody,node_atmosphere toneMint
class node_fields,node_terrain,node_worldpicker,node_scene,node_vehicles,node_airfield,node_earth,node_instruments toneRose
class node_school,node_multiplayer,node_remote,node_audio,node_pilot,node_supabase toneIndigo
```

## Components

### Flight experience

- [App and flight UI](https://github.com/snansrin/flightsimrc/blob/main/src/main.tsx): `src/main.tsx`
- [Flight deck](https://github.com/snansrin/flightsimrc/blob/main/src/FlightDeck.tsx): `src/FlightDeck.tsx`
- [Aircraft selection](https://github.com/snansrin/flightsimrc/blob/main/src/AircraftHangar.tsx): `src/AircraftHangar.tsx`
- [Quick flight](https://github.com/snansrin/flightsimrc/blob/main/src/quickFlight.ts): `src/quickFlight.ts`

### Controller setup

- [Controller profiles](https://github.com/snansrin/flightsimrc/blob/main/src/controllerSelection.ts): `src/controllerSelection.ts`
- [USB HID input](https://github.com/snansrin/flightsimrc/blob/main/src/hid.ts): `src/hid.ts`
- [Input mapping](https://github.com/snansrin/flightsimrc/blob/main/src/input.ts): `src/input.ts`
- [Guided calibration](https://github.com/snansrin/flightsimrc/blob/main/src/guidedSetup.ts): `src/guidedSetup.ts`
- [Signal display](https://github.com/snansrin/flightsimrc/blob/main/src/ControllerSignalRow.tsx): `src/ControllerSignalRow.tsx`

### Flight simulation

- [Flight state and controls](https://github.com/snansrin/flightsimrc/blob/main/src/flight.ts): `src/flight.ts`
- [Simulation engine](https://github.com/snansrin/flightsimrc/blob/main/src/sim/simulation.ts): `src/sim/simulation.ts`
- [Aircraft catalogue](https://github.com/snansrin/flightsimrc/blob/main/src/sim/catalog.ts): `src/sim/catalog.ts`
- [Aerodynamics](https://github.com/snansrin/flightsimrc/blob/main/src/sim/aero.ts): `src/sim/aero.ts`
- [Rotorcraft dynamics](https://github.com/snansrin/flightsimrc/blob/main/src/sim/rotor.ts): `src/sim/rotor.ts`
- [Rigid-body dynamics](https://github.com/snansrin/flightsimrc/blob/main/src/sim/rigidBody.ts): `src/sim/rigidBody.ts`
- [Atmosphere and wind](https://github.com/snansrin/flightsimrc/blob/main/src/sim/atmosphere.ts): `src/sim/atmosphere.ts`

### World and rendering

- [Airfields and weather](https://github.com/snansrin/flightsimrc/blob/main/src/sim/fields.ts): `src/sim/fields.ts`
- [Geographic terrain](https://github.com/snansrin/flightsimrc/blob/main/src/sim/worldTerrain.ts): `src/sim/worldTerrain.ts`
- [World picker](https://github.com/snansrin/flightsimrc/blob/main/src/WorldPicker.tsx): `src/WorldPicker.tsx`
- [Flight scene](https://github.com/snansrin/flightsimrc/blob/main/src/scene/FlightScene.tsx): `src/scene/FlightScene.tsx`
- [Aircraft rendering](https://github.com/snansrin/flightsimrc/blob/main/src/scene/Vehicles.tsx): `src/scene/Vehicles.tsx`
- [Airfield scenery](https://github.com/snansrin/flightsimrc/blob/main/src/scene/Airfield.tsx): `src/scene/Airfield.tsx`
- [Earth terrain rendering](https://github.com/snansrin/flightsimrc/blob/main/src/scene/EarthTerrain.tsx): `src/scene/EarthTerrain.tsx`
- [Flight instruments](https://github.com/snansrin/flightsimrc/blob/main/src/scene/Instruments.tsx): `src/scene/Instruments.tsx`

### Training and multiplayer

- [Flight school](https://github.com/snansrin/flightsimrc/blob/main/src/school.ts): `src/school.ts`
- [Multiplayer rooms](https://github.com/snansrin/flightsimrc/blob/main/src/multiplayer.ts): `src/multiplayer.ts`
- [Remote aircraft](https://github.com/snansrin/flightsimrc/blob/main/src/scene/RemoteAircraft.tsx): `src/scene/RemoteAircraft.tsx`
- [Engine audio](https://github.com/snansrin/flightsimrc/blob/main/src/audio.ts): `src/audio.ts`

### Other components

- **Pilot**
- **Supabase Realtime**

## Connections

- Pilot → App and flight UI: uses
- App and flight UI → Aircraft selection: shows (evidence: `src/main.tsx`)
- App and flight UI → Flight deck: renders (evidence: `src/main.tsx`)
- App and flight UI → Quick flight: uses (evidence: `src/main.tsx`)
- Pilot → Controller profiles: configures
- App and flight UI → Controller profiles: uses (evidence: `src/main.tsx`)
- App and flight UI → USB HID input: opens (evidence: `src/main.tsx`)
- USB HID input → Input mapping: provides signals (evidence: `src/hid.ts`)
- App and flight UI → Input mapping: reads (evidence: `src/main.tsx`)
- App and flight UI → Guided calibration: uses (evidence: `src/main.tsx`)
- Input mapping → Flight state and controls: defines controls (evidence: `src/input.ts`)
- App and flight UI → Signal display: renders (evidence: `src/main.tsx`)
- App and flight UI → Simulation engine: runs (evidence: `src/main.tsx`)
- Simulation engine → Aircraft catalogue: selects aircraft (evidence: `src/sim/simulation.ts`)
- Simulation engine → Airfields and weather: gets field data (evidence: `src/sim/simulation.ts`)
- Simulation engine → Aerodynamics: computes forces (evidence: `src/sim/simulation.ts`)
- Simulation engine → Rotorcraft dynamics: computes rotor forces (evidence: `src/sim/simulation.ts`)
- Simulation engine → Rigid-body dynamics: integrates motion (evidence: `src/sim/simulation.ts`)
- Simulation engine → Atmosphere and wind: builds environment (evidence: `src/sim/simulation.ts`)
- World picker → Geographic terrain: uses terrain (evidence: `src/WorldPicker.tsx`)
- App and flight UI → World picker: shows (evidence: `src/main.tsx`)
- App and flight UI → Flight scene: renders (evidence: `src/main.tsx`)
- Flight scene → Aircraft rendering: renders (evidence: `src/scene/FlightScene.tsx`)
- Flight scene → Airfield scenery: renders (evidence: `src/scene/FlightScene.tsx`)
- Flight scene → Earth terrain rendering: renders (evidence: `src/scene/FlightScene.tsx`)
- Flight scene → Remote aircraft: renders (evidence: `src/scene/FlightScene.tsx`)
- Flight scene → Flight instruments: displays
- Airfield scenery → Airfields and weather: reads field data (evidence: `src/scene/Airfield.tsx`)
- Airfield scenery → Atmosphere and wind: reads wind (evidence: `src/scene/Airfield.tsx`)
- Earth terrain rendering → Geographic terrain: uses terrain (evidence: `src/scene/EarthTerrain.tsx`)
- Aircraft rendering → Aircraft catalogue: uses aircraft specs
- App and flight UI → Flight school: uses (evidence: `src/main.tsx`)
- App and flight UI → Multiplayer rooms: uses (evidence: `src/main.tsx`)
- Multiplayer rooms → Supabase Realtime: broadcasts
- Flight scene → Multiplayer rooms: reads remote pilots (evidence: `src/scene/FlightScene.tsx`)
- App and flight UI → Engine audio: creates (evidence: `src/main.tsx`)
