# shreyask95/simulator architecture

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

- Interactive diagram: https://gitdiagram.com/shreyask95/simulator
- Repository: https://github.com/shreyask95/simulator

## Overview

Simulator is a browser-based robotics simulator with a built-in programming IDE, scene editor, challenge experience, and learning-management views. The main user flow enters through the routed application, selects a scene or challenge, edits/programs a robot, then runs it in the simulator; challenge execution also supports compiled programs and worker-based runtime. The graph preserves documented AI, asset, feedback, account, and curriculum capabilities. Relationships involving unsampled implementations are omitted or marked unverified; source-index references and README statements provide the remaining evidence.

Main entry points: [`src/App.tsx`](https://github.com/shreyask95/simulator/blob/master/src/App.tsx) (Application router), [`src/pages/ChallengeRoot.tsx`](https://github.com/shreyask95/simulator/blob/master/src/pages/ChallengeRoot.tsx) (Challenge experience), [`src/pages/Root.tsx`](https://github.com/shreyask95/simulator/blob/master/src/pages/Root.tsx) (Scene editor), [`src/state/State/Scene`](https://github.com/shreyask95/simulator/tree/master/src/state/State/Scene) (Scene geometry and nodes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application experience"]
  node_app["Application router<br/>[App.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_scene_editor["Scene editor<br/>[Root.tsx]"]
  node_challenge["Challenge experience<br/>[ChallengeRoot.tsx]"]
  node_curriculum["Curriculum views<br/>[CurriculumPage.tsx]"]
  node_lms["Assignments and LMS"]
  node_ai["AI assistant"]
  node_asset["Asset viewer"]
  node_feedback["Feedback"]
end

subgraph group_simulation["Scene and simulation"]
  node_challenge_defs["Challenge definitions"]
  node_scene_defs["Scene definitions"]
  node_scene_state["Scene model<br/>[index.ts]"]
  node_scene_parts["Scene geometry and nodes"]
  node_sim_manager["Simulation manager<br/>[ScriptManager.ts]"]
  node_render_bindings["3D simulator bindings"]
  node_challenge_ui["Challenge interface"]
end

subgraph group_programming["Programming runtime"]
  node_editor["Code editor"]
  node_compiler["Program compiler<br/>[compile.ts]"]
  node_worker_instance["Worker controller<br/>[WorkerInstance.ts]"]
  node_worker["Program worker<br/>[worker.ts]"]
  node_robot_runtime["Robot registers"]
end

subgraph group_platform["Data and services"]
  node_state["Application state<br/>[index.ts]"]
  node_reducers["State reducers<br/>[index.ts]"]
  node_db["Database client<br/>[Selector.ts]"]
  node_firebase["Firebase authentication<br/>[firebase.ts]"]
  node_theme["Theme and UI primitives<br/>[theme.ts]"]
  node_scroll["Scroll area<br/>[ScrollArea.tsx]"]
  node_localization["Localized strings<br/>[LocalizedString.ts]"]
  node_unit_math["Unit math<br/>[unitMath.ts]"]
  node_raw_math["Vector math<br/>[math.ts]"]
  node_dict["Dictionary utilities<br/>[Dict.ts]"]
  node_patch["State patching<br/>[Patch.ts]"]
end

node_user(("Learner / user"))
node_backend[("KIPR database service")]

node_user -->|"opens"| node_app
node_app -->|"routes"| node_dashboard
node_app -->|"routes"| node_scene_editor
node_app -->|"routes"| node_challenge
node_app -->|"routes"| node_curriculum
node_app -->|"reads state"| node_state
node_app -->|"checks auth"| node_firebase
node_app -->|"checks consent"| node_db
node_curriculum -.->|"shows learning"| node_lms
node_challenge -->|"compiles programs"| node_compiler
node_challenge -->|"starts runtime"| node_worker_instance
node_challenge -->|"renders"| node_challenge_ui
node_challenge -.->|"uses simulator"| node_scene_editor
node_challenge -.->|"loads challenge"| node_challenge_defs
node_scene_editor -.->|"edits scene"| node_scene_state
node_scene_state -->|"models nodes"| node_scene_parts
node_scene_state -->|"provides scene data"| node_sim_manager
node_sim_manager -->|"reads and updates"| node_scene_parts
node_sim_manager -.->|"drives rendering"| node_render_bindings
node_scene_editor -.->|"offers scenes"| node_scene_defs
node_worker_instance -->|"connects registers"| node_robot_runtime
node_worker_instance -.->|"starts worker"| node_worker
node_compiler -.->|"supplies program"| node_worker
node_state -->|"combines reducers"| node_reducers
node_state -->|"uses selectors"| node_db
node_db -.->|"requests records"| node_backend
node_ai -.->|"uses app state"| node_state
node_asset -->|"reads state"| node_state
node_scene_parts -->|"diffs changes"| node_patch
node_scene_parts -->|"uses units"| node_unit_math
node_unit_math -->|"converts vectors"| node_raw_math
node_scene_parts -->|"uses dictionaries"| node_dict
node_scene_editor -.->|"uses styling"| node_theme
node_scene_editor -.->|"uses controls"| node_scroll
node_app -.->|"localizes interface"| node_localization
node_user -.->|"asks questions"| node_ai
node_user -.->|"views assets"| node_asset
node_user -.->|"sends feedback"| node_feedback
node_user -.->|"opens coursework"| node_lms

click node_app "https://github.com/shreyask95/simulator/blob/master/src/App.tsx"
click node_dashboard "https://github.com/shreyask95/simulator/blob/master/src/pages/Dashboard.tsx"
click node_scene_editor "https://github.com/shreyask95/simulator/blob/master/src/pages/Root.tsx"
click node_challenge "https://github.com/shreyask95/simulator/blob/master/src/pages/ChallengeRoot.tsx"
click node_curriculum "https://github.com/shreyask95/simulator/blob/master/src/lms/CurriculumPage.tsx"
click node_lms "https://github.com/shreyask95/simulator/tree/master/src/lms"
click node_ai "https://github.com/shreyask95/simulator/tree/master/src/components/Ai"
click node_asset "https://github.com/shreyask95/simulator/blob/master/src/asset-viewer/AssetViewerPage.tsx"
click node_feedback "https://github.com/shreyask95/simulator/tree/master/src/components/Feedback"
click node_challenge_defs "https://github.com/shreyask95/simulator/tree/master/src/simulator/definitions/challenges"
click node_scene_defs "https://github.com/shreyask95/simulator/tree/master/src/simulator/definitions/scenes"
click node_scene_state "https://github.com/shreyask95/simulator/blob/master/src/state/State/Scene/index.ts"
click node_scene_parts "https://github.com/shreyask95/simulator/tree/master/src/state/State/Scene"
click node_sim_manager "https://github.com/shreyask95/simulator/blob/master/src/simulator/ScriptManager.ts"
click node_render_bindings "https://github.com/shreyask95/simulator/tree/master/src/simulator/babylonBindings"
click node_challenge_ui "https://github.com/shreyask95/simulator/tree/master/src/components/Challenge"
click node_editor "https://github.com/shreyask95/simulator/tree/master/src/components/Editor"
click node_compiler "https://github.com/shreyask95/simulator/blob/master/src/programming/compiler/compile.ts"
click node_worker_instance "https://github.com/shreyask95/simulator/blob/master/src/programming/WorkerInstance.ts"
click node_worker "https://github.com/shreyask95/simulator/blob/master/src/programming/worker/worker.ts"
click node_robot_runtime "https://github.com/shreyask95/simulator/blob/master/src/programming/SharedRegistersRobot.ts"
click node_state "https://github.com/shreyask95/simulator/blob/master/src/state/index.ts"
click node_reducers "https://github.com/shreyask95/simulator/blob/master/src/state/reducer/index.ts"
click node_db "https://github.com/shreyask95/simulator/blob/master/src/db/Selector.ts"
click node_firebase "https://github.com/shreyask95/simulator/blob/master/src/firebase/firebase.ts"
click node_theme "https://github.com/shreyask95/simulator/blob/master/src/components/constants/theme.ts"
click node_scroll "https://github.com/shreyask95/simulator/blob/master/src/components/interface/ScrollArea.tsx"
click node_localization "https://github.com/shreyask95/simulator/blob/master/src/util/LocalizedString.ts"
click node_unit_math "https://github.com/shreyask95/simulator/blob/master/src/util/math/unitMath.ts"
click node_raw_math "https://github.com/shreyask95/simulator/blob/master/src/util/math/math.ts"
click node_dict "https://github.com/shreyask95/simulator/blob/master/src/util/objectOps/Dict.ts"
click node_patch "https://github.com/shreyask95/simulator/blob/master/src/util/redux/Patch.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_dashboard,node_scene_editor,node_challenge,node_curriculum,node_lms,node_ai,node_asset,node_feedback,node_user toneBlue
class node_challenge_defs,node_scene_defs,node_scene_state,node_scene_parts,node_sim_manager,node_render_bindings,node_challenge_ui,node_backend toneAmber
class node_editor,node_compiler,node_worker_instance,node_worker,node_robot_runtime toneMint
class node_state,node_reducers,node_db,node_firebase,node_theme,node_scroll,node_localization,node_unit_math,node_raw_math,node_dict,node_patch toneRose
```

## Components

### Application experience

- [Application router](https://github.com/shreyask95/simulator/blob/master/src/App.tsx): `src/App.tsx`
- [Dashboard](https://github.com/shreyask95/simulator/blob/master/src/pages/Dashboard.tsx): `src/pages/Dashboard.tsx`
- [Scene editor](https://github.com/shreyask95/simulator/blob/master/src/pages/Root.tsx): `src/pages/Root.tsx`
- [Challenge experience](https://github.com/shreyask95/simulator/blob/master/src/pages/ChallengeRoot.tsx): `src/pages/ChallengeRoot.tsx`
- [Curriculum views](https://github.com/shreyask95/simulator/blob/master/src/lms/CurriculumPage.tsx): `src/lms/CurriculumPage.tsx`
- [Assignments and LMS](https://github.com/shreyask95/simulator/tree/master/src/lms): `src/lms`
- [AI assistant](https://github.com/shreyask95/simulator/tree/master/src/components/Ai): `src/components/Ai`
- [Asset viewer](https://github.com/shreyask95/simulator/blob/master/src/asset-viewer/AssetViewerPage.tsx): `src/asset-viewer/AssetViewerPage.tsx`
- [Feedback](https://github.com/shreyask95/simulator/tree/master/src/components/Feedback): `src/components/Feedback`

### Scene and simulation

- [Challenge definitions](https://github.com/shreyask95/simulator/tree/master/src/simulator/definitions/challenges): `src/simulator/definitions/challenges`
- [Scene definitions](https://github.com/shreyask95/simulator/tree/master/src/simulator/definitions/scenes): `src/simulator/definitions/scenes`
- [Scene model](https://github.com/shreyask95/simulator/blob/master/src/state/State/Scene/index.ts): `src/state/State/Scene/index.ts`
- [Scene geometry and nodes](https://github.com/shreyask95/simulator/tree/master/src/state/State/Scene): `src/state/State/Scene`
- [Simulation manager](https://github.com/shreyask95/simulator/blob/master/src/simulator/ScriptManager.ts): `src/simulator/ScriptManager.ts`
- [3D simulator bindings](https://github.com/shreyask95/simulator/tree/master/src/simulator/babylonBindings): `src/simulator/babylonBindings`
- [Challenge interface](https://github.com/shreyask95/simulator/tree/master/src/components/Challenge): `src/components/Challenge`

### Programming runtime

- [Code editor](https://github.com/shreyask95/simulator/tree/master/src/components/Editor): `src/components/Editor`
- [Program compiler](https://github.com/shreyask95/simulator/blob/master/src/programming/compiler/compile.ts): `src/programming/compiler/compile.ts`
- [Worker controller](https://github.com/shreyask95/simulator/blob/master/src/programming/WorkerInstance.ts): `src/programming/WorkerInstance.ts`
- [Program worker](https://github.com/shreyask95/simulator/blob/master/src/programming/worker/worker.ts): `src/programming/worker/worker.ts`
- [Robot registers](https://github.com/shreyask95/simulator/blob/master/src/programming/SharedRegistersRobot.ts): `src/programming/SharedRegistersRobot.ts`

### Data and services

- [Application state](https://github.com/shreyask95/simulator/blob/master/src/state/index.ts): `src/state/index.ts`
- [State reducers](https://github.com/shreyask95/simulator/blob/master/src/state/reducer/index.ts): `src/state/reducer/index.ts`
- [Database client](https://github.com/shreyask95/simulator/blob/master/src/db/Selector.ts): `src/db/Selector.ts`
- [Firebase authentication](https://github.com/shreyask95/simulator/blob/master/src/firebase/firebase.ts): `src/firebase/firebase.ts`
- [Theme and UI primitives](https://github.com/shreyask95/simulator/blob/master/src/components/constants/theme.ts): `src/components/constants/theme.ts`
- [Scroll area](https://github.com/shreyask95/simulator/blob/master/src/components/interface/ScrollArea.tsx): `src/components/interface/ScrollArea.tsx`
- [Localized strings](https://github.com/shreyask95/simulator/blob/master/src/util/LocalizedString.ts): `src/util/LocalizedString.ts`
- [Unit math](https://github.com/shreyask95/simulator/blob/master/src/util/math/unitMath.ts): `src/util/math/unitMath.ts`
- [Vector math](https://github.com/shreyask95/simulator/blob/master/src/util/math/math.ts): `src/util/math/math.ts`
- [Dictionary utilities](https://github.com/shreyask95/simulator/blob/master/src/util/objectOps/Dict.ts): `src/util/objectOps/Dict.ts`
- [State patching](https://github.com/shreyask95/simulator/blob/master/src/util/redux/Patch.ts): `src/util/redux/Patch.ts`

### Other components

- **Learner / user**
- **KIPR database service**

## Connections

- Learner / user → Application router: opens (evidence: `src/App.tsx`)
- Application router → Dashboard: routes (evidence: `src/App.tsx`)
- Application router → Scene editor: routes (evidence: `src/App.tsx`)
- Application router → Challenge experience: routes (evidence: `src/App.tsx`)
- Application router → Curriculum views: routes (evidence: `src/App.tsx`)
- Application router → Application state: reads state (evidence: `src/App.tsx`)
- Application router → Firebase authentication: checks auth (evidence: `src/App.tsx`)
- Application router → Database client: checks consent (evidence: `src/App.tsx`)
- Curriculum views → Assignments and LMS: shows learning
- Challenge experience → Program compiler: compiles programs (evidence: `src/pages/ChallengeRoot.tsx`)
- Challenge experience → Worker controller: starts runtime (evidence: `src/pages/ChallengeRoot.tsx`)
- Challenge experience → Challenge interface: renders (evidence: `src/pages/ChallengeRoot.tsx`)
- Challenge experience → Scene editor: uses simulator
- Challenge experience → Challenge definitions: loads challenge
- Scene editor → Scene model: edits scene
- Scene model → Scene geometry and nodes: models nodes (evidence: `src/state/State/Scene/index.ts`)
- Scene model → Simulation manager: provides scene data (evidence: `src/simulator/ScriptManager.ts`)
- Simulation manager → Scene geometry and nodes: reads and updates (evidence: `src/simulator/ScriptManager.ts`)
- Simulation manager → 3D simulator bindings: drives rendering
- Scene editor → Scene definitions: offers scenes
- Worker controller → Robot registers: connects registers (evidence: `src/programming/WorkerInstance.ts`)
- Worker controller → Program worker: starts worker
- Program compiler → Program worker: supplies program
- Application state → State reducers: combines reducers (evidence: `src/state/index.ts`)
- Application state → Database client: uses selectors (evidence: `src/state/index.ts`)
- Database client → KIPR database service: requests records
- AI assistant → Application state: uses app state
- Asset viewer → Application state: reads state (evidence: `src/asset-viewer/index.tsx`)
- Scene geometry and nodes → State patching: diffs changes (evidence: `src/state/State/Scene/Geometry.ts`)
- Scene geometry and nodes → Unit math: uses units (evidence: `src/state/State/Scene/index.ts`)
- Unit math → Vector math: converts vectors (evidence: `src/util/math/unitMath.ts`)
- Scene geometry and nodes → Dictionary utilities: uses dictionaries (evidence: `src/state/State/Scene/index.ts`)
- Scene editor → Theme and UI primitives: uses styling
- Scene editor → Scroll area: uses controls
- Application router → Localized strings: localizes interface (evidence: `src/App.tsx`)
- Learner / user → AI assistant: asks questions
- Learner / user → Asset viewer: views assets
- Learner / user → Feedback: sends feedback
- Learner / user → Assignments and LMS: opens coursework
