# lunch418/stratum architecture

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

- Interactive diagram: https://gitdiagram.com/lunch418/stratum
- Repository: https://github.com/lunch418/stratum

## Overview

Stratum Modern reimplements the Stratum 2000 visual-modeling environment: users open or convert a project, edit its image hierarchy, schemas and code, then run and inspect a live simulation. The Rust core supplies project formats, language processing, runtime, simulation and graphics; a local player API connects that engine to the React IDE, with Tauri as the desktop host. The README documents additional IDE capabilities beyond the sampled excerpts; their paths are shown where supported, but unsampled wiring is not asserted.

Main entry points: [`app/src/App.tsx`](https://github.com/lunch418/stratum/blob/main/app/src/App.tsx) (IDE Shell), [`core/src/player/mod.rs`](https://github.com/lunch418/stratum/blob/main/core/src/player/mod.rs) (Local Player API), [`core/src/gfx/mod.rs`](https://github.com/lunch418/stratum/blob/main/core/src/gfx/mod.rs) (Graphics Engine), [`core/src/sim/mod.rs`](https://github.com/lunch418/stratum/blob/main/core/src/sim/mod.rs) (Simulation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop and IDE"]
  node_desktop_host["Desktop Host<br/>[main.rs]"]
  node_ide["IDE Shell<br/>[App.tsx]"]
  node_frontend_api["Frontend API<br/>[api.ts]"]
  node_shared_state["IDE State<br/>[store.ts]"]
end

subgraph group_editing["Project Editing"]
  node_project_tree["Hierarchy and Schema<br/>[Hierarchy.tsx]"]
  node_scheme_canvas["Schema Canvas<br/>[SchemeCanvas.tsx]"]
  node_code_editor["Code Editor<br/>[CodeEditor.tsx]"]
  node_inspector["Variable Inspector<br/>[Inspector.tsx]"]
  node_debug_tools["Debug and Graphs<br/>[Debug.tsx]"]
  node_graphics_editors["Graphics Editors<br/>[PictureEditor.tsx]"]
  node_project_search["Project Search<br/>[Search.tsx]"]
  node_project_help["Help Browser<br/>[Help.tsx]"]
  node_print_export["Print and Export<br/>[print.ts]"]
end

subgraph group_engine["Model Engine"]
  node_local_player["Local Player API<br/>[mod.rs]"]
  node_simulation["Simulation<br/>[mod.rs]"]
  node_interpreter["Interpreter<br/>[interp.rs]"]
  node_language["Language Parser<br/>[parser.rs]"]
  node_runtime["Runtime Builtins<br/>[mod.rs]"]
  node_graphics["Graphics Engine<br/>[mod.rs]"]
  node_svg_renderer["SVG Renderer<br/>[svg.rs]"]
end

subgraph group_formats["Project Interchange"]
  node_formats_module["Format Support<br/>[mod.rs]"]
  node_project_format["Project Format<br/>[project.rs]"]
  node_native_format["Native Format<br/>[native.rs]"]
  node_vdr_format["Vector Format<br/>[vdr.rs]"]
end

node_engineer(("Modeler"))

node_engineer -->|"edits project"| node_ide
node_desktop_host -->|"starts server"| node_local_player
node_ide -->|"sends commands"| node_frontend_api
node_ide -->|"reads and updates"| node_shared_state
node_ide -->|"presents editing"| node_project_tree
node_ide -->|"presents editing"| node_scheme_canvas
node_ide -->|"presents editing"| node_code_editor
node_ide -->|"presents values"| node_inspector
node_ide -->|"presents debugging"| node_debug_tools
node_ide -->|"presents editing"| node_graphics_editors
node_ide -->|"presents search"| node_project_search
node_ide -->|"presents help"| node_project_help
node_ide -->|"offers output"| node_print_export
node_frontend_api -->|"calls API"| node_local_player
node_local_player -->|"controls simulation"| node_simulation
node_simulation -->|"executes model"| node_interpreter
node_interpreter -->|"uses parsed model"| node_language
node_interpreter -->|"calls builtins"| node_runtime
node_simulation -->|"updates spaces"| node_graphics
node_local_player -->|"renders model"| node_graphics
node_graphics -->|"renders scene"| node_svg_renderer
node_local_player -->|"loads and saves"| node_formats_module
node_formats_module -->|"handles projects"| node_project_format
node_formats_module -->|"imports and exports"| node_native_format
node_graphics -->|"reads and writes"| node_vdr_format

click node_desktop_host "https://github.com/lunch418/stratum/blob/main/app/src-tauri/src/main.rs"
click node_ide "https://github.com/lunch418/stratum/blob/main/app/src/App.tsx"
click node_frontend_api "https://github.com/lunch418/stratum/blob/main/app/src/api.ts"
click node_shared_state "https://github.com/lunch418/stratum/blob/main/app/src/store.ts"
click node_project_tree "https://github.com/lunch418/stratum/blob/main/app/src/components/Hierarchy.tsx"
click node_scheme_canvas "https://github.com/lunch418/stratum/blob/main/app/src/components/SchemeCanvas.tsx"
click node_code_editor "https://github.com/lunch418/stratum/blob/main/app/src/components/CodeEditor.tsx"
click node_inspector "https://github.com/lunch418/stratum/blob/main/app/src/components/Inspector.tsx"
click node_debug_tools "https://github.com/lunch418/stratum/blob/main/app/src/components/Debug.tsx"
click node_graphics_editors "https://github.com/lunch418/stratum/blob/main/app/src/components/PictureEditor.tsx"
click node_project_search "https://github.com/lunch418/stratum/blob/main/app/src/components/Search.tsx"
click node_project_help "https://github.com/lunch418/stratum/blob/main/app/src/components/Help.tsx"
click node_print_export "https://github.com/lunch418/stratum/blob/main/app/src/print.ts"
click node_local_player "https://github.com/lunch418/stratum/blob/main/core/src/player/mod.rs"
click node_simulation "https://github.com/lunch418/stratum/blob/main/core/src/sim/mod.rs"
click node_interpreter "https://github.com/lunch418/stratum/blob/main/core/src/sim/interp.rs"
click node_language "https://github.com/lunch418/stratum/blob/main/core/src/lang/parser.rs"
click node_runtime "https://github.com/lunch418/stratum/blob/main/core/src/runtime/mod.rs"
click node_graphics "https://github.com/lunch418/stratum/blob/main/core/src/gfx/mod.rs"
click node_svg_renderer "https://github.com/lunch418/stratum/blob/main/core/src/gfx/svg.rs"
click node_formats_module "https://github.com/lunch418/stratum/blob/main/core/src/formats/mod.rs"
click node_project_format "https://github.com/lunch418/stratum/blob/main/core/src/formats/project.rs"
click node_native_format "https://github.com/lunch418/stratum/blob/main/core/src/formats/native.rs"
click node_vdr_format "https://github.com/lunch418/stratum/blob/main/core/src/formats/vdr.rs"

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_desktop_host,node_ide,node_frontend_api,node_shared_state toneBlue
class node_project_tree,node_scheme_canvas,node_code_editor,node_inspector,node_debug_tools,node_graphics_editors,node_project_search,node_project_help,node_print_export toneAmber
class node_local_player,node_simulation,node_interpreter,node_language,node_runtime,node_graphics,node_svg_renderer toneMint
class node_formats_module,node_project_format,node_native_format,node_vdr_format toneRose
class node_engineer toneIndigo
```

## Components

### Desktop and IDE

- [Desktop Host](https://github.com/lunch418/stratum/blob/main/app/src-tauri/src/main.rs): `app/src-tauri/src/main.rs`
- [IDE Shell](https://github.com/lunch418/stratum/blob/main/app/src/App.tsx): `app/src/App.tsx`
- [Frontend API](https://github.com/lunch418/stratum/blob/main/app/src/api.ts): `app/src/api.ts`
- [IDE State](https://github.com/lunch418/stratum/blob/main/app/src/store.ts): `app/src/store.ts`

### Project Editing

- [Hierarchy and Schema](https://github.com/lunch418/stratum/blob/main/app/src/components/Hierarchy.tsx): `app/src/components/Hierarchy.tsx`
- [Schema Canvas](https://github.com/lunch418/stratum/blob/main/app/src/components/SchemeCanvas.tsx): `app/src/components/SchemeCanvas.tsx`
- [Code Editor](https://github.com/lunch418/stratum/blob/main/app/src/components/CodeEditor.tsx): `app/src/components/CodeEditor.tsx`
- [Variable Inspector](https://github.com/lunch418/stratum/blob/main/app/src/components/Inspector.tsx): `app/src/components/Inspector.tsx`
- [Debug and Graphs](https://github.com/lunch418/stratum/blob/main/app/src/components/Debug.tsx): `app/src/components/Debug.tsx`
- [Graphics Editors](https://github.com/lunch418/stratum/blob/main/app/src/components/PictureEditor.tsx): `app/src/components/PictureEditor.tsx`
- [Project Search](https://github.com/lunch418/stratum/blob/main/app/src/components/Search.tsx): `app/src/components/Search.tsx`
- [Help Browser](https://github.com/lunch418/stratum/blob/main/app/src/components/Help.tsx): `app/src/components/Help.tsx`
- [Print and Export](https://github.com/lunch418/stratum/blob/main/app/src/print.ts): `app/src/print.ts`

### Model Engine

- [Local Player API](https://github.com/lunch418/stratum/blob/main/core/src/player/mod.rs): `core/src/player/mod.rs`
- [Simulation](https://github.com/lunch418/stratum/blob/main/core/src/sim/mod.rs): `core/src/sim/mod.rs`
- [Interpreter](https://github.com/lunch418/stratum/blob/main/core/src/sim/interp.rs): `core/src/sim/interp.rs`
- [Language Parser](https://github.com/lunch418/stratum/blob/main/core/src/lang/parser.rs): `core/src/lang/parser.rs`
- [Runtime Builtins](https://github.com/lunch418/stratum/blob/main/core/src/runtime/mod.rs): `core/src/runtime/mod.rs`
- [Graphics Engine](https://github.com/lunch418/stratum/blob/main/core/src/gfx/mod.rs): `core/src/gfx/mod.rs`
- [SVG Renderer](https://github.com/lunch418/stratum/blob/main/core/src/gfx/svg.rs): `core/src/gfx/svg.rs`

### Project Interchange

- [Format Support](https://github.com/lunch418/stratum/blob/main/core/src/formats/mod.rs): `core/src/formats/mod.rs`
- [Project Format](https://github.com/lunch418/stratum/blob/main/core/src/formats/project.rs): `core/src/formats/project.rs`
- [Native Format](https://github.com/lunch418/stratum/blob/main/core/src/formats/native.rs): `core/src/formats/native.rs`
- [Vector Format](https://github.com/lunch418/stratum/blob/main/core/src/formats/vdr.rs): `core/src/formats/vdr.rs`

### Other components

- **Modeler**

## Connections

- Modeler → IDE Shell: edits project
- Desktop Host → Local Player API: starts server
- IDE Shell → Frontend API: sends commands
- IDE Shell → IDE State: reads and updates
- IDE Shell → Hierarchy and Schema: presents editing
- IDE Shell → Schema Canvas: presents editing
- IDE Shell → Code Editor: presents editing
- IDE Shell → Variable Inspector: presents values
- IDE Shell → Debug and Graphs: presents debugging
- IDE Shell → Graphics Editors: presents editing
- IDE Shell → Project Search: presents search
- IDE Shell → Help Browser: presents help
- IDE Shell → Print and Export: offers output
- Frontend API → Local Player API: calls API
- Local Player API → Simulation: controls simulation
- Simulation → Interpreter: executes model
- Interpreter → Language Parser: uses parsed model
- Interpreter → Runtime Builtins: calls builtins
- Simulation → Graphics Engine: updates spaces
- Local Player API → Graphics Engine: renders model
- Graphics Engine → SVG Renderer: renders scene
- Local Player API → Format Support: loads and saves
- Format Support → Project Format: handles projects
- Format Support → Native Format: imports and exports
- Graphics Engine → Vector Format: reads and writes
