# begindtheseen/space architecture

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

- Interactive diagram: https://gitdiagram.com/begindtheseen/space
- Repository: https://github.com/begindtheseen/space
- Video tour (about a minute): https://gitdiagram.com/begindtheseen/space/video

## Overview

ORBIT is a local-first GNC learning app, delivered in a browser or a thin Mac/Electron shell. The main workflow is to choose a curriculum module, learn its lessons, practice through runnable exercises, and recall with spaced reviews; progress and readiness guide what to study next. The graph also captures coding roadmaps and runtimes, speech, and desktop updates. Source excerpts and the README support the principal links; unsampled subsystems are included where documented, with their internal wiring left unspecified.

Main entry points: [`src/hooks/useLearner.tsx`](https://github.com/begindtheseen/space/blob/main/src/hooks/useLearner.tsx) (Learner context), [`src/App.tsx`](https://github.com/begindtheseen/space/blob/main/src/App.tsx) (Routes and pages), [`src/pages/Module.tsx`](https://github.com/begindtheseen/space/blob/main/src/pages/Module.tsx) (Module study), [`src/curriculum`](https://github.com/begindtheseen/space/tree/main/src/curriculum) (Curriculum corpus)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and shell"]
  node_entry["App entry<br/>[main.tsx]"]
  node_routes["Routes and pages<br/>[App.tsx]"]
  node_desktop["Desktop shell<br/>[main.js]"]
  node_updater["Bundle updater<br/>[updater.js]"]
end

subgraph group_learning["Curriculum and study"]
  node_curriculum["Curriculum corpus"]
  node_lessons["Lessons"]
  node_module["Module study<br/>[Module.tsx]"]
  node_review["Recall review<br/>[Review.tsx]"]
  node_learncourses["Coding roadmaps"]
  node_progress["Progress and mastery<br/>[Progress.tsx]"]
end

subgraph group_engine["Learning engine"]
  node_learnerstate["Learner context<br/>[useLearner.tsx]"]
  node_dag["Prerequisite graph<br/>[graph.ts]"]
  node_scheduler["Review scheduler<br/>[scheduler.ts]"]
  node_attempt["Attempt processing<br/>[apply.ts]"]
  node_state["Learner state<br/>[state.ts]"]
  node_storage[("Local persistence<br/>[store.ts]")]
end

subgraph group_coding["Code practice"]
  node_playground["Embedded IDE<br/>[Embed.tsx]"]
  node_runner["Code execution<br/>[run.ts]"]
  node_shell["Practice terminal<br/>[shell.ts]"]
end

subgraph group_platform["Device features"]
  node_readaloud["Read aloud<br/>[useReadAloud.tsx]"]
  node_voice["Neural voice<br/>[kokoro.ts]"]
  node_backup["Backup export<br/>[backup.js]"]
end

node_learner(("Learner"))
node_compiler{{"Compiler Explorer"}}
node_huggingface{{"Hugging Face"}}

node_learner -->|"opens app"| node_entry
node_entry -->|"renders"| node_routes
node_routes -->|"provides state"| node_learnerstate
node_routes -->|"routes to"| node_module
node_routes -->|"routes to"| node_review
node_learnerstate -->|"loads and saves"| node_storage
node_learnerstate -->|"loads modules"| node_curriculum
node_curriculum -->|"builds graph"| node_dag
node_curriculum -->|"attaches lessons"| node_lessons
node_module -->|"presents modules"| node_curriculum
node_module -->|"opens exercises"| node_playground
node_module -->|"starts recall"| node_review
node_learnerstate -->|"derives due count"| node_scheduler
node_learnerstate -->|"derives readiness"| node_dag
node_learnerstate -->|"applies attempt"| node_attempt
node_attempt -->|"updates state"| node_state
node_review -->|"grades recall"| node_learnerstate
node_scheduler -->|"checks prerequisites"| node_dag
node_scheduler -->|"reads topic state"| node_state
node_progress -->|"shows progress"| node_learnerstate
node_learncourses -->|"runs lessons"| node_playground
node_playground -->|"runs code"| node_runner
node_runner -->|"runs terminal"| node_shell
node_runner -.->|"compiles remotely"| node_compiler
node_learner -->|"requests speech"| node_readaloud
node_readaloud -->|"uses neural voice"| node_voice
node_voice -.->|"downloads model"| node_huggingface
node_entry -->|"detects shell"| node_desktop
node_desktop -->|"resolves bundle"| node_updater
node_learner -->|"exports data"| node_backup

click node_entry "https://github.com/begindtheseen/space/blob/main/src/main.tsx"
click node_routes "https://github.com/begindtheseen/space/blob/main/src/App.tsx"
click node_desktop "https://github.com/begindtheseen/space/blob/main/desktop/main.js"
click node_updater "https://github.com/begindtheseen/space/blob/main/desktop/updater.js"
click node_curriculum "https://github.com/begindtheseen/space/tree/main/src/curriculum"
click node_lessons "https://github.com/begindtheseen/space/tree/main/src/curriculum/lessons"
click node_module "https://github.com/begindtheseen/space/blob/main/src/pages/Module.tsx"
click node_review "https://github.com/begindtheseen/space/blob/main/src/pages/Review.tsx"
click node_learncourses "https://github.com/begindtheseen/space/tree/main/src/learn"
click node_learnerstate "https://github.com/begindtheseen/space/blob/main/src/hooks/useLearner.tsx"
click node_dag "https://github.com/begindtheseen/space/blob/main/src/engine/graph.ts"
click node_scheduler "https://github.com/begindtheseen/space/blob/main/src/engine/scheduler.ts"
click node_attempt "https://github.com/begindtheseen/space/blob/main/src/engine/apply.ts"
click node_state "https://github.com/begindtheseen/space/blob/main/src/engine/state.ts"
click node_storage "https://github.com/begindtheseen/space/blob/main/src/engine/store.ts"
click node_playground "https://github.com/begindtheseen/space/blob/main/src/components/ide/Embed.tsx"
click node_runner "https://github.com/begindtheseen/space/blob/main/src/lib/run.ts"
click node_shell "https://github.com/begindtheseen/space/blob/main/src/lib/shell.ts"
click node_readaloud "https://github.com/begindtheseen/space/blob/main/src/hooks/useReadAloud.tsx"
click node_voice "https://github.com/begindtheseen/space/blob/main/src/lib/voice/kokoro.ts"
click node_progress "https://github.com/begindtheseen/space/blob/main/src/pages/Progress.tsx"
click node_backup "https://github.com/begindtheseen/space/blob/main/desktop/backup.js"

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_entry,node_routes,node_desktop,node_updater toneBlue
class node_curriculum,node_lessons,node_module,node_review,node_learncourses,node_progress toneAmber
class node_learnerstate,node_dag,node_scheduler,node_attempt,node_state,node_storage toneMint
class node_playground,node_runner,node_shell toneRose
class node_readaloud,node_voice,node_backup,node_learner,node_compiler,node_huggingface toneIndigo
```

## Components

### App and shell

- [App entry](https://github.com/begindtheseen/space/blob/main/src/main.tsx): `src/main.tsx`
- [Routes and pages](https://github.com/begindtheseen/space/blob/main/src/App.tsx): `src/App.tsx`
- [Desktop shell](https://github.com/begindtheseen/space/blob/main/desktop/main.js): `desktop/main.js`
- [Bundle updater](https://github.com/begindtheseen/space/blob/main/desktop/updater.js): `desktop/updater.js`

### Curriculum and study

- [Curriculum corpus](https://github.com/begindtheseen/space/tree/main/src/curriculum): `src/curriculum`
- [Lessons](https://github.com/begindtheseen/space/tree/main/src/curriculum/lessons): `src/curriculum/lessons`
- [Module study](https://github.com/begindtheseen/space/blob/main/src/pages/Module.tsx): `src/pages/Module.tsx`
- [Recall review](https://github.com/begindtheseen/space/blob/main/src/pages/Review.tsx): `src/pages/Review.tsx`
- [Coding roadmaps](https://github.com/begindtheseen/space/tree/main/src/learn): `src/learn`
- [Progress and mastery](https://github.com/begindtheseen/space/blob/main/src/pages/Progress.tsx): `src/pages/Progress.tsx`

### Learning engine

- [Learner context](https://github.com/begindtheseen/space/blob/main/src/hooks/useLearner.tsx): `src/hooks/useLearner.tsx`
- [Prerequisite graph](https://github.com/begindtheseen/space/blob/main/src/engine/graph.ts): `src/engine/graph.ts`
- [Review scheduler](https://github.com/begindtheseen/space/blob/main/src/engine/scheduler.ts): `src/engine/scheduler.ts`
- [Attempt processing](https://github.com/begindtheseen/space/blob/main/src/engine/apply.ts): `src/engine/apply.ts`
- [Learner state](https://github.com/begindtheseen/space/blob/main/src/engine/state.ts): `src/engine/state.ts`
- [Local persistence](https://github.com/begindtheseen/space/blob/main/src/engine/store.ts): `src/engine/store.ts`

### Code practice

- [Embedded IDE](https://github.com/begindtheseen/space/blob/main/src/components/ide/Embed.tsx): `src/components/ide/Embed.tsx`
- [Code execution](https://github.com/begindtheseen/space/blob/main/src/lib/run.ts): `src/lib/run.ts`
- [Practice terminal](https://github.com/begindtheseen/space/blob/main/src/lib/shell.ts): `src/lib/shell.ts`

### Device features

- [Read aloud](https://github.com/begindtheseen/space/blob/main/src/hooks/useReadAloud.tsx): `src/hooks/useReadAloud.tsx`
- [Neural voice](https://github.com/begindtheseen/space/blob/main/src/lib/voice/kokoro.ts): `src/lib/voice/kokoro.ts`
- [Backup export](https://github.com/begindtheseen/space/blob/main/desktop/backup.js): `desktop/backup.js`

### Other components

- **Learner**
- **Compiler Explorer**
- **Hugging Face**

## Connections

- Learner → App entry: opens app
- App entry → Routes and pages: renders (evidence: `src/main.tsx`)
- Routes and pages → Learner context: provides state (evidence: `src/App.tsx`)
- Routes and pages → Module study: routes to (evidence: `src/App.tsx`)
- Routes and pages → Recall review: routes to (evidence: `src/App.tsx`)
- Learner context → Local persistence: loads and saves (evidence: `src/hooks/useLearner.tsx`)
- Learner context → Curriculum corpus: loads modules (evidence: `src/hooks/useLearner.tsx`)
- Curriculum corpus → Prerequisite graph: builds graph (evidence: `src/curriculum/index.ts`)
- Curriculum corpus → Lessons: attaches lessons (evidence: `src/curriculum/index.ts`)
- Module study → Curriculum corpus: presents modules
- Module study → Embedded IDE: opens exercises
- Module study → Recall review: starts recall
- Learner context → Review scheduler: derives due count (evidence: `src/hooks/useLearner.tsx`)
- Learner context → Prerequisite graph: derives readiness (evidence: `src/hooks/useLearner.tsx`)
- Learner context → Attempt processing: applies attempt (evidence: `src/hooks/useLearner.tsx`)
- Attempt processing → Learner state: updates state (evidence: `src/engine/apply.ts`)
- Recall review → Learner context: grades recall (evidence: `src/pages/Review.tsx`)
- Review scheduler → Prerequisite graph: checks prerequisites (evidence: `src/engine/scheduler.ts`)
- Review scheduler → Learner state: reads topic state (evidence: `src/engine/scheduler.ts`)
- Progress and mastery → Learner context: shows progress
- Coding roadmaps → Embedded IDE: runs lessons
- Embedded IDE → Code execution: runs code
- Code execution → Practice terminal: runs terminal
- Code execution → Compiler Explorer: compiles remotely
- Learner → Read aloud: requests speech
- Read aloud → Neural voice: uses neural voice (evidence: `src/hooks/useReadAloud.tsx`)
- Neural voice → Hugging Face: downloads model
- App entry → Desktop shell: detects shell (evidence: `src/main.tsx`)
- Desktop shell → Bundle updater: resolves bundle (evidence: `desktop/main.js`)
- Learner → Backup export: exports data
