# msorkhpar/studyforge architecture

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

- Interactive diagram: https://gitdiagram.com/msorkhpar/studyforge
- Repository: https://github.com/msorkhpar/studyforge

## Overview

Studyforge converts teaching material into an offline-capable study site, with remembered reading progress, narration, and optional runnable or graded practices. The documented authoring workflow uses skills to produce a corpus manifest and archive, validates them, plans and builds the site, then serves it. Runtime capabilities also include narration and, for runnable courses, a browser editor and execution runner. The graph follows README-documented relationships; sampled source confirms server dispatch and narration-client behavior, while unsampled modules are represented at their existing directory paths.

Main entry points: [`src/studyforge/corpus/manifest`](https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/corpus/manifest) (Corpus manifest), [`src/studyforge/archive`](https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/archive) (Teaching archive), [`src/studyforge/generate`](https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/generate) (Site generation), [`src/studyforge/skills`](https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/skills) (Authoring skills)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Authoring and corpus"]
  node_skills["Authoring skills"]
  node_manifest["Corpus manifest"]
  node_archive["Teaching archive"]
  node_validate["Corpus validation"]
end

subgraph group_content["Content processing"]
  node_discovery["Corpus discovery"]
  node_units["Unit content"]
  node_generate["Site generation"]
  node_render["Page rendering"]
end

subgraph group_study["Study experience"]
  node_site["Built study site"]
  node_progress[("Reading progress")]
end

subgraph group_practice["Practices and execution"]
  node_exercises["Practice model<br/>[record.py]"]
  node_grading["Practice grading"]
  node_execution["Execution runtime"]
  node_editor["Browser editor<br/>[editor.py]"]
  node_runner["Execution runner<br/>[runnerservice.py]"]
end

subgraph group_delivery["Serving and narration"]
  node_narration["Narration client<br/>[client.py]"]
  node_server["Study server<br/>[app.py]"]
end

node_author(("Course author"))
node_reader(("Learner browser"))
node_speech_service["Narration service"]

node_author -->|"uses procedures"| node_skills
node_skills -->|"produces"| node_manifest
node_skills -->|"produces"| node_archive
node_manifest -->|"validated by"| node_validate
node_archive -->|"validated by"| node_validate
node_manifest -.->|"describes corpus"| node_discovery
node_archive -.->|"provides documents"| node_units
node_discovery -.->|"feeds build"| node_generate
node_units -.->|"feeds build"| node_generate
node_generate -.->|"renders pages"| node_render
node_generate -->|"builds"| node_site
node_site -->|"read offline"| node_reader
node_reader -->|"remembers progress"| node_progress
node_narration -->|"requests synthesis"| node_speech_service
node_manifest -->|"names audio"| node_narration
node_archive -->|"may define practices"| node_exercises
node_exercises -.->|"gated and graded"| node_grading
node_grading -.->|"runs practices"| node_execution
node_execution -->|"supports editing"| node_editor
node_execution -->|"runs in container"| node_runner
node_site -->|"served by"| node_server
node_reader -->|"opens site"| node_server

click node_skills "https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/skills"
click node_manifest "https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/corpus/manifest"
click node_archive "https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/archive"
click node_validate "https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/validate"
click node_discovery "https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/corpus/discovery"
click node_units "https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/unit"
click node_generate "https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/generate"
click node_render "https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/render/page"
click node_progress "https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/progress"
click node_narration "https://github.com/msorkhpar/studyforge/blob/main/src/studyforge/narrate/client.py"
click node_exercises "https://github.com/msorkhpar/studyforge/blob/main/src/studyforge/exercise/record.py"
click node_grading "https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/exercise/gates"
click node_execution "https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/execute"
click node_editor "https://github.com/msorkhpar/studyforge/blob/main/src/studyforge/execute/editor.py"
click node_runner "https://github.com/msorkhpar/studyforge/blob/main/src/studyforge/skills/execution/runnerservice.py"
click node_server "https://github.com/msorkhpar/studyforge/blob/main/src/studyforge/serve/app.py"

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_skills,node_manifest,node_archive,node_validate,node_reader toneBlue
class node_discovery,node_units,node_generate,node_render toneAmber
class node_site,node_progress toneMint
class node_exercises,node_grading,node_execution,node_editor,node_runner toneRose
class node_narration,node_server,node_author,node_speech_service toneIndigo
```

## Components

### Authoring and corpus

- [Authoring skills](https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/skills): `src/studyforge/skills`
- [Corpus manifest](https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/corpus/manifest): `src/studyforge/corpus/manifest`
- [Teaching archive](https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/archive): `src/studyforge/archive`
- [Corpus validation](https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/validate): `src/studyforge/validate`

### Content processing

- [Corpus discovery](https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/corpus/discovery): `src/studyforge/corpus/discovery`
- [Unit content](https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/unit): `src/studyforge/unit`
- [Site generation](https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/generate): `src/studyforge/generate`
- [Page rendering](https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/render/page): `src/studyforge/render/page`

### Study experience

- **Built study site**
- [Reading progress](https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/progress): `src/studyforge/progress`

### Practices and execution

- [Practice model](https://github.com/msorkhpar/studyforge/blob/main/src/studyforge/exercise/record.py): `src/studyforge/exercise/record.py`
- [Practice grading](https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/exercise/gates): `src/studyforge/exercise/gates`
- [Execution runtime](https://github.com/msorkhpar/studyforge/tree/main/src/studyforge/execute): `src/studyforge/execute`
- [Browser editor](https://github.com/msorkhpar/studyforge/blob/main/src/studyforge/execute/editor.py): `src/studyforge/execute/editor.py`
- [Execution runner](https://github.com/msorkhpar/studyforge/blob/main/src/studyforge/skills/execution/runnerservice.py): `src/studyforge/skills/execution/runnerservice.py`

### Serving and narration

- [Narration client](https://github.com/msorkhpar/studyforge/blob/main/src/studyforge/narrate/client.py): `src/studyforge/narrate/client.py`
- [Study server](https://github.com/msorkhpar/studyforge/blob/main/src/studyforge/serve/app.py): `src/studyforge/serve/app.py`

### Other components

- **Course author**
- **Learner browser**
- **Narration service**

## Connections

- Course author → Authoring skills: uses procedures (evidence: `README.md`)
- Authoring skills → Corpus manifest: produces (evidence: `README.md`)
- Authoring skills → Teaching archive: produces (evidence: `README.md`)
- Corpus manifest → Corpus validation: validated by (evidence: `README.md`)
- Teaching archive → Corpus validation: validated by (evidence: `README.md`)
- Corpus manifest → Corpus discovery: describes corpus
- Teaching archive → Unit content: provides documents
- Corpus discovery → Site generation: feeds build
- Unit content → Site generation: feeds build
- Site generation → Page rendering: renders pages
- Site generation → Built study site: builds (evidence: `README.md`)
- Built study site → Learner browser: read offline (evidence: `README.md`)
- Learner browser → Reading progress: remembers progress (evidence: `README.md`)
- Narration client → Narration service: requests synthesis (evidence: `src/studyforge/narrate/client.py`)
- Corpus manifest → Narration client: names audio (evidence: `README.md`)
- Teaching archive → Practice model: may define practices (evidence: `README.md`)
- Practice model → Practice grading: gated and graded (evidence: `src/studyforge/exercise/gates/quiz/review.py`)
- Practice grading → Execution runtime: runs practices
- Execution runtime → Browser editor: supports editing (evidence: `README.md`)
- Execution runtime → Execution runner: runs in container (evidence: `README.md`)
- Built study site → Study server: served by (evidence: `README.md`)
- Learner browser → Study server: opens site (evidence: `README.md`)
