# simonriley-141/drishti architecture

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

- Interactive diagram: https://gitdiagram.com/simonriley-141/drishti
- Repository: https://github.com/simonriley-141/drishti

## Overview

Drishti Labs is an accessible browser-based STEM learning workspace. Learners enter through the public site, choose a simulation, and explore circuits, forces, or matter; global controls support voice, gesture, and other accessibility preferences. Separate role-based portals support teacher, student, and parent progress workflows. The map follows the router and sampled voice/API paths; dashboard data wiring and several lab internals are not shown because their source was not sampled.

Main entry points: [`src/App.jsx`](https://github.com/simonriley-141/drishti/blob/main/src/App.jsx) (App router), [`src/pages/LabViewer.jsx`](https://github.com/simonriley-141/drishti/blob/main/src/pages/LabViewer.jsx) (Lab viewer), [`src/components/VoiceCommandController.jsx`](https://github.com/simonriley-141/drishti/blob/main/src/components/VoiceCommandController.jsx) (Voice controller), [`src/pages/TeacherDashboard.jsx`](https://github.com/simonriley-141/drishti/blob/main/src/pages/TeacherDashboard.jsx) (Teacher dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Learning experience"]
  node_app["App router<br/>[App.jsx]"]
  node_landing["Welcome page<br/>[LandingPage.jsx]"]
  node_directory["Lab directory"]
  node_labviewer["Lab viewer<br/>[LabViewer.jsx]"]
end

subgraph group_labs["Science simulations"]
  node_circuit["Circuit playground"]
  node_circuitworker["Circuit solver<br/>[circuitWorker.js]"]
  node_forces["Forces lab<br/>[TugOfWarCanvas.jsx]"]
  node_matter["Matter lab"]
end

subgraph group_access["Accessible interaction"]
  node_appstate["App preferences<br/>[AppContext.jsx]"]
  node_toolbar["Accessibility controls"]
  node_voice["Voice controller"]
  node_gesture["Gesture controller"]
  node_offlineasr["Offline speech recognition"]
end

subgraph group_portals["Role dashboards"]
  node_auth["Authentication context<br/>[AuthContext.jsx]"]
  node_teacher["Teacher dashboard"]
  node_student["Student dashboard"]
  node_parent["Parent dashboard"]
  node_telemetry["Lab telemetry<br/>[useLabTelemetry.js]"]
end

subgraph group_services["AI and platform services"]
  node_firebase["Firebase services<br/>[firebase.js]"]
  node_openaiutil["AI client workflows<br/>[openaiClient.js]"]
  node_api["API client<br/>[api.js]"]
  node_server["Voice and AI API<br/>[server.mjs]"]
end

node_learner(("Learner"))
node_openai{{"OpenAI service"}}

node_learner -->|"opens"| node_app
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_directory
node_app -->|"routes to"| node_labviewer
node_app -->|"routes to"| node_matter
node_directory -->|"selects lab"| node_labviewer
node_labviewer -->|"renders lab"| node_circuit
node_labviewer -->|"renders lab"| node_forces
node_learner -->|"adjusts controls"| node_toolbar
node_toolbar -->|"updates preferences"| node_appstate
node_voice -->|"dispatches commands"| node_appstate
node_gesture -->|"reads preferences"| node_appstate
node_voice -.->|"transcribes offline"| node_offlineasr
node_voice -->|"sends voice requests"| node_api
node_openaiutil -->|"requests AI tasks"| node_api
node_api -->|"calls endpoints"| node_server
node_server -->|"requests model work"| node_openai
node_app -->|"provides auth context"| node_auth
node_app -->|"routes to"| node_teacher
node_app -->|"routes to"| node_student
node_app -->|"routes to"| node_parent
node_teacher -->|"inspects progress"| node_telemetry
node_teacher -.->|"manages accounts"| node_firebase
node_student -.->|"reads progress"| node_firebase
node_parent -.->|"reads progress"| node_firebase
node_circuit -->|"solves circuit"| node_circuitworker

click node_app "https://github.com/simonriley-141/drishti/blob/main/src/App.jsx"
click node_landing "https://github.com/simonriley-141/drishti/blob/main/src/pages/LandingPage.jsx"
click node_directory "https://github.com/simonriley-141/drishti/blob/main/src/pages/SimulationDirectory.jsx"
click node_labviewer "https://github.com/simonriley-141/drishti/blob/main/src/pages/LabViewer.jsx"
click node_circuit "https://github.com/simonriley-141/drishti/blob/main/src/labs/electrical-circuit/FreeformCircuitCanvas.jsx"
click node_circuitworker "https://github.com/simonriley-141/drishti/blob/main/src/labs/electrical-circuit/circuitWorker.js"
click node_forces "https://github.com/simonriley-141/drishti/blob/main/src/labs/forces-tug-of-war/TugOfWarCanvas.jsx"
click node_matter "https://github.com/simonriley-141/drishti/blob/main/src/labs/states-of-matter/StatesOfMatterLab.jsx"
click node_appstate "https://github.com/simonriley-141/drishti/blob/main/src/context/AppContext.jsx"
click node_toolbar "https://github.com/simonriley-141/drishti/blob/main/src/components/AccessibilityToolbar.jsx"
click node_voice "https://github.com/simonriley-141/drishti/blob/main/src/components/VoiceCommandController.jsx"
click node_gesture "https://github.com/simonriley-141/drishti/blob/main/src/components/GestureMouseController.jsx"
click node_offlineasr "https://github.com/simonriley-141/drishti/blob/main/src/workers/offlineAsrWorker.js"
click node_auth "https://github.com/simonriley-141/drishti/blob/main/src/context/AuthContext.jsx"
click node_firebase "https://github.com/simonriley-141/drishti/blob/main/src/lib/firebase.js"
click node_teacher "https://github.com/simonriley-141/drishti/blob/main/src/pages/TeacherDashboard.jsx"
click node_student "https://github.com/simonriley-141/drishti/blob/main/src/pages/StudentDashboard.jsx"
click node_parent "https://github.com/simonriley-141/drishti/blob/main/src/pages/ParentDashboard.jsx"
click node_telemetry "https://github.com/simonriley-141/drishti/blob/main/src/hooks/useLabTelemetry.js"
click node_openaiutil "https://github.com/simonriley-141/drishti/blob/main/src/utils/openaiClient.js"
click node_api "https://github.com/simonriley-141/drishti/blob/main/src/lib/api.js"
click node_server "https://github.com/simonriley-141/drishti/blob/main/server.mjs"

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_landing,node_directory,node_labviewer toneBlue
class node_circuit,node_circuitworker,node_forces,node_matter toneAmber
class node_appstate,node_toolbar,node_voice,node_gesture,node_offlineasr toneMint
class node_auth,node_teacher,node_student,node_parent,node_telemetry toneRose
class node_firebase,node_openaiutil,node_api,node_server,node_learner,node_openai toneIndigo
```

## Components

### Learning experience

- [App router](https://github.com/simonriley-141/drishti/blob/main/src/App.jsx): `src/App.jsx`
- [Welcome page](https://github.com/simonriley-141/drishti/blob/main/src/pages/LandingPage.jsx): `src/pages/LandingPage.jsx`
- [Lab directory](https://github.com/simonriley-141/drishti/blob/main/src/pages/SimulationDirectory.jsx): `src/pages/SimulationDirectory.jsx`
- [Lab viewer](https://github.com/simonriley-141/drishti/blob/main/src/pages/LabViewer.jsx): `src/pages/LabViewer.jsx`

### Science simulations

- [Circuit playground](https://github.com/simonriley-141/drishti/blob/main/src/labs/electrical-circuit/FreeformCircuitCanvas.jsx): `src/labs/electrical-circuit/FreeformCircuitCanvas.jsx`
- [Circuit solver](https://github.com/simonriley-141/drishti/blob/main/src/labs/electrical-circuit/circuitWorker.js): `src/labs/electrical-circuit/circuitWorker.js`
- [Forces lab](https://github.com/simonriley-141/drishti/blob/main/src/labs/forces-tug-of-war/TugOfWarCanvas.jsx): `src/labs/forces-tug-of-war/TugOfWarCanvas.jsx`
- [Matter lab](https://github.com/simonriley-141/drishti/blob/main/src/labs/states-of-matter/StatesOfMatterLab.jsx): `src/labs/states-of-matter/StatesOfMatterLab.jsx`

### Accessible interaction

- [App preferences](https://github.com/simonriley-141/drishti/blob/main/src/context/AppContext.jsx): `src/context/AppContext.jsx`
- [Accessibility controls](https://github.com/simonriley-141/drishti/blob/main/src/components/AccessibilityToolbar.jsx): `src/components/AccessibilityToolbar.jsx`
- [Voice controller](https://github.com/simonriley-141/drishti/blob/main/src/components/VoiceCommandController.jsx): `src/components/VoiceCommandController.jsx`
- [Gesture controller](https://github.com/simonriley-141/drishti/blob/main/src/components/GestureMouseController.jsx): `src/components/GestureMouseController.jsx`
- [Offline speech recognition](https://github.com/simonriley-141/drishti/blob/main/src/workers/offlineAsrWorker.js): `src/workers/offlineAsrWorker.js`

### Role dashboards

- [Authentication context](https://github.com/simonriley-141/drishti/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`
- [Teacher dashboard](https://github.com/simonriley-141/drishti/blob/main/src/pages/TeacherDashboard.jsx): `src/pages/TeacherDashboard.jsx`
- [Student dashboard](https://github.com/simonriley-141/drishti/blob/main/src/pages/StudentDashboard.jsx): `src/pages/StudentDashboard.jsx`
- [Parent dashboard](https://github.com/simonriley-141/drishti/blob/main/src/pages/ParentDashboard.jsx): `src/pages/ParentDashboard.jsx`
- [Lab telemetry](https://github.com/simonriley-141/drishti/blob/main/src/hooks/useLabTelemetry.js): `src/hooks/useLabTelemetry.js`

### AI and platform services

- [Firebase services](https://github.com/simonriley-141/drishti/blob/main/src/lib/firebase.js): `src/lib/firebase.js`
- [AI client workflows](https://github.com/simonriley-141/drishti/blob/main/src/utils/openaiClient.js): `src/utils/openaiClient.js`
- [API client](https://github.com/simonriley-141/drishti/blob/main/src/lib/api.js): `src/lib/api.js`
- [Voice and AI API](https://github.com/simonriley-141/drishti/blob/main/server.mjs): `server.mjs`

### Other components

- **Learner**
- **OpenAI service**

## Connections

- Learner → App router: opens
- App router → Welcome page: routes to
- App router → Lab directory: routes to
- App router → Lab viewer: routes to
- App router → Matter lab: routes to
- Lab directory → Lab viewer: selects lab
- Lab viewer → Circuit playground: renders lab
- Lab viewer → Forces lab: renders lab
- Learner → Accessibility controls: adjusts controls
- Accessibility controls → App preferences: updates preferences
- Voice controller → App preferences: dispatches commands
- Gesture controller → App preferences: reads preferences
- Voice controller → Offline speech recognition: transcribes offline
- Voice controller → API client: sends voice requests
- AI client workflows → API client: requests AI tasks
- API client → Voice and AI API: calls endpoints
- Voice and AI API → OpenAI service: requests model work
- App router → Authentication context: provides auth context
- App router → Teacher dashboard: routes to
- App router → Student dashboard: routes to
- App router → Parent dashboard: routes to
- Teacher dashboard → Lab telemetry: inspects progress
- Teacher dashboard → Firebase services: manages accounts
- Student dashboard → Firebase services: reads progress
- Parent dashboard → Firebase services: reads progress
- Circuit playground → Circuit solver: solves circuit
