# vincentsch/explainroo architecture

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

- Interactive diagram: https://gitdiagram.com/vincentsch/explainroo
- Repository: https://github.com/vincentsch/explainroo

## Overview

explainroo turns an agent-authored narration script and JavaScript scenes into locally rendered explainer videos. The main workflow validates a project, synthesizes narration, aligns word timing, prepares a browser session, renders scenes and sound, then emits video and companion files; checks and product-demo capture are distinct capabilities. The graph follows documented behavior and SOURCE INDEX references; unsampled subsystems are represented only where the README or index supports them.

Main entry points: [`src/cli.js`](https://github.com/vincentsch/explainroo/blob/main/src/cli.js) (CLI commands), [`src/pipeline.js`](https://github.com/vincentsch/explainroo/blob/main/src/pipeline.js) (Render preparation), [`engine/runtime.js`](https://github.com/vincentsch/explainroo/blob/main/engine/runtime.js) (Browser engine), [`src/voice.js`](https://github.com/vincentsch/explainroo/blob/main/src/voice.js) (Voice synthesis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Project authoring"]
  node_cli["CLI commands<br/>[cli.js]"]
  node_project["Project loader<br/>[project.js]"]
  node_script["Narration script<br/>[script.js]"]
end

subgraph group_speech["Voice and timing"]
  node_voice["Voice synthesis<br/>[voice.js]"]
  node_models["Local speech models<br/>[models.js]"]
  node_alignment["Word alignment<br/>[align.js]"]
  node_elevenlabs["ElevenLabs voice<br/>[elevenlabs.js]"]
end

subgraph group_engine["Scene and audio engine"]
  node_scenes["Scene API<br/>[stage.js]"]
  node_runtime["Browser engine<br/>[runtime.js]"]
  node_themes["Visual themes<br/>[themes.js]"]
  node_director["Camera direction<br/>[director.js]"]
  node_soundtrack["Music and effects<br/>[soundtrack.js]"]
  node_synth["Audio synthesis core<br/>[synth.js]"]
end

subgraph group_delivery["Rendering and delivery"]
  node_pipeline["Render preparation<br/>[pipeline.js]"]
  node_browser["Headless browser<br/>[browser.js]"]
  node_server["Project HTTP server<br/>[server.js]"]
  node_render["Video rendering<br/>[render.js]"]
  node_media["Media outputs<br/>[ffmpeg.js]"]
  node_captions["Subtitles and chapters<br/>[subtitles.js]"]
end

subgraph group_extras["Checks and capture"]
  node_qa["Video checks<br/>[qa.js]"]
  node_capture["Product capture<br/>[capture.js]"]
end

node_agent(("Coding agent"))
node_openrouter(("OpenRouter images"))

node_agent -->|"runs commands"| node_cli
node_cli -->|"loads project"| node_project
node_project -->|"parses narration"| node_script
node_cli -->|"prepares render"| node_pipeline
node_pipeline -->|"synthesizes speech"| node_voice
node_voice -->|"uses local models"| node_models
node_voice -->|"aligns words"| node_alignment
node_pipeline -->|"starts server"| node_server
node_pipeline -->|"opens engine"| node_browser
node_cli -->|"renders video"| node_render
node_render -->|"prepares project"| node_pipeline
node_render -->|"encodes output"| node_media
node_render -->|"writes subtitles"| node_captions
node_browser -->|"loads engine"| node_runtime
node_runtime -->|"runs scene functions"| node_scenes
node_runtime -->|"loads theme"| node_themes
node_runtime -->|"directs camera"| node_director
node_runtime -->|"builds soundtrack"| node_soundtrack
node_soundtrack -->|"synthesizes audio"| node_synth
node_cli -->|"checks video"| node_qa
node_qa -->|"reuses preparation"| node_pipeline
node_cli -->|"captures product"| node_capture
node_voice -.->|"supports alternate voice"| node_elevenlabs
node_agent -.->|"may request images"| node_openrouter

click node_cli "https://github.com/vincentsch/explainroo/blob/main/src/cli.js"
click node_project "https://github.com/vincentsch/explainroo/blob/main/src/project.js"
click node_script "https://github.com/vincentsch/explainroo/blob/main/src/script.js"
click node_scenes "https://github.com/vincentsch/explainroo/blob/main/engine/stage.js"
click node_voice "https://github.com/vincentsch/explainroo/blob/main/src/voice.js"
click node_models "https://github.com/vincentsch/explainroo/blob/main/src/models.js"
click node_alignment "https://github.com/vincentsch/explainroo/blob/main/src/align.js"
click node_pipeline "https://github.com/vincentsch/explainroo/blob/main/src/pipeline.js"
click node_browser "https://github.com/vincentsch/explainroo/blob/main/src/browser.js"
click node_server "https://github.com/vincentsch/explainroo/blob/main/src/server.js"
click node_runtime "https://github.com/vincentsch/explainroo/blob/main/engine/runtime.js"
click node_themes "https://github.com/vincentsch/explainroo/blob/main/engine/themes.js"
click node_director "https://github.com/vincentsch/explainroo/blob/main/engine/director.js"
click node_soundtrack "https://github.com/vincentsch/explainroo/blob/main/engine/audio/soundtrack.js"
click node_synth "https://github.com/vincentsch/explainroo/blob/main/engine/audio/synth.js"
click node_render "https://github.com/vincentsch/explainroo/blob/main/src/render.js"
click node_media "https://github.com/vincentsch/explainroo/blob/main/src/ffmpeg.js"
click node_captions "https://github.com/vincentsch/explainroo/blob/main/src/subtitles.js"
click node_qa "https://github.com/vincentsch/explainroo/blob/main/src/qa.js"
click node_capture "https://github.com/vincentsch/explainroo/blob/main/src/capture.js"
click node_elevenlabs "https://github.com/vincentsch/explainroo/blob/main/src/elevenlabs.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_cli,node_project,node_script toneBlue
class node_voice,node_models,node_alignment,node_elevenlabs toneAmber
class node_scenes,node_runtime,node_themes,node_director,node_soundtrack,node_synth,node_openrouter toneMint
class node_pipeline,node_browser,node_server,node_render,node_media,node_captions toneRose
class node_qa,node_capture,node_agent toneIndigo
```

## Components

### Project authoring

- [CLI commands](https://github.com/vincentsch/explainroo/blob/main/src/cli.js): `src/cli.js`
- [Project loader](https://github.com/vincentsch/explainroo/blob/main/src/project.js): `src/project.js`
- [Narration script](https://github.com/vincentsch/explainroo/blob/main/src/script.js): `src/script.js`

### Voice and timing

- [Voice synthesis](https://github.com/vincentsch/explainroo/blob/main/src/voice.js): `src/voice.js`
- [Local speech models](https://github.com/vincentsch/explainroo/blob/main/src/models.js): `src/models.js`
- [Word alignment](https://github.com/vincentsch/explainroo/blob/main/src/align.js): `src/align.js`
- [ElevenLabs voice](https://github.com/vincentsch/explainroo/blob/main/src/elevenlabs.js): `src/elevenlabs.js`

### Scene and audio engine

- [Scene API](https://github.com/vincentsch/explainroo/blob/main/engine/stage.js): `engine/stage.js`
- [Browser engine](https://github.com/vincentsch/explainroo/blob/main/engine/runtime.js): `engine/runtime.js`
- [Visual themes](https://github.com/vincentsch/explainroo/blob/main/engine/themes.js): `engine/themes.js`
- [Camera direction](https://github.com/vincentsch/explainroo/blob/main/engine/director.js): `engine/director.js`
- [Music and effects](https://github.com/vincentsch/explainroo/blob/main/engine/audio/soundtrack.js): `engine/audio/soundtrack.js`
- [Audio synthesis core](https://github.com/vincentsch/explainroo/blob/main/engine/audio/synth.js): `engine/audio/synth.js`

### Rendering and delivery

- [Render preparation](https://github.com/vincentsch/explainroo/blob/main/src/pipeline.js): `src/pipeline.js`
- [Headless browser](https://github.com/vincentsch/explainroo/blob/main/src/browser.js): `src/browser.js`
- [Project HTTP server](https://github.com/vincentsch/explainroo/blob/main/src/server.js): `src/server.js`
- [Video rendering](https://github.com/vincentsch/explainroo/blob/main/src/render.js): `src/render.js`
- [Media outputs](https://github.com/vincentsch/explainroo/blob/main/src/ffmpeg.js): `src/ffmpeg.js`
- [Subtitles and chapters](https://github.com/vincentsch/explainroo/blob/main/src/subtitles.js): `src/subtitles.js`

### Checks and capture

- [Video checks](https://github.com/vincentsch/explainroo/blob/main/src/qa.js): `src/qa.js`
- [Product capture](https://github.com/vincentsch/explainroo/blob/main/src/capture.js): `src/capture.js`

### Other components

- **Coding agent**
- **OpenRouter images**

## Connections

- Coding agent → CLI commands: runs commands (evidence: `README.md`)
- CLI commands → Project loader: loads project (evidence: `src/cli.js`)
- Project loader → Narration script: parses narration (evidence: `src/project.js`)
- CLI commands → Render preparation: prepares render (evidence: `src/cli.js`)
- Render preparation → Voice synthesis: synthesizes speech (evidence: `src/pipeline.js`)
- Voice synthesis → Local speech models: uses local models (evidence: `src/voice.js`)
- Voice synthesis → Word alignment: aligns words (evidence: `src/voice.js`)
- Render preparation → Project HTTP server: starts server (evidence: `src/pipeline.js`)
- Render preparation → Headless browser: opens engine (evidence: `src/pipeline.js`)
- CLI commands → Video rendering: renders video (evidence: `src/cli.js`)
- Video rendering → Render preparation: prepares project
- Video rendering → Media outputs: encodes output (evidence: `README.md`)
- Video rendering → Subtitles and chapters: writes subtitles (evidence: `README.md`)
- Headless browser → Browser engine: loads engine (evidence: `README.md`)
- Browser engine → Scene API: runs scene functions (evidence: `engine/runtime.js`)
- Browser engine → Visual themes: loads theme (evidence: `engine/runtime.js`)
- Browser engine → Camera direction: directs camera (evidence: `engine/runtime.js`)
- Browser engine → Music and effects: builds soundtrack (evidence: `engine/runtime.js`)
- Music and effects → Audio synthesis core: synthesizes audio (evidence: `engine/audio/soundtrack.js`)
- CLI commands → Video checks: checks video (evidence: `src/cli.js`)
- Video checks → Render preparation: reuses preparation (evidence: `src/qa.js`)
- CLI commands → Product capture: captures product (evidence: `src/cli.js`)
- Voice synthesis → ElevenLabs voice: supports alternate voice (evidence: `README.md`)
- Coding agent → OpenRouter images: may request images (evidence: `README.md`)
