# dozentwelve/papermorph architecture

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

- Interactive diagram: https://gitdiagram.com/dozentwelve/papermorph
- Repository: https://github.com/dozentwelve/papermorph

## Overview

Papermorph presents animated, narrated, interactive math books. The reader-facing path is the bookshelf, then a book and its chapter lessons, where the lesson runtime provides animation and practice. The tree contains the published site, not the PDF-to-book authoring Skill described in the README, so that production pipeline is not mapped as implemented code. Chapter timing data is represented by book-level content nodes; the excerpts do not show how chapter pages load those files.

Main entry points: [`site/lib/bookshelf.js`](https://github.com/dozentwelve/papermorph/blob/main/site/lib/bookshelf.js) (Bookshelf), [`site/elementary-algebra`](https://github.com/dozentwelve/papermorph/tree/main/site/elementary-algebra) (Algebra book), [`site/elementary-algebra/ch01/audio/en/timings.js`](https://github.com/dozentwelve/papermorph/blob/main/site/elementary-algebra/ch01/audio/en/timings.js) (Chapter lessons), [`site/math-notebook`](https://github.com/dozentwelve/papermorph/tree/main/site/math-notebook) (Math notebook)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_site["Site navigation"]
  node_shelf["Bookshelf<br/>[bookshelf.js]"]
end

subgraph group_algebra["Elementary algebra"]
  node_algebra_book["Algebra book"]
  node_algebra_lessons["Chapter lessons<br/>[timings.js]"]
  node_algebra_engine["Lesson runtime<br/>[engine.js]"]
end

subgraph group_notebook["Math notebook"]
  node_unit_art["Unit artwork<br/>[unit-art.js]"]
  node_notebook_book["Math notebook"]
  node_notebook_lessons["Chapter lessons<br/>[timings.js]"]
  node_notebook_engine["Lesson runtime<br/>[engine.js]"]
end

node_reader(("Reader"))

node_reader -->|"opens"| node_shelf
node_shelf -->|"links to"| node_algebra_book
node_shelf -->|"links to"| node_notebook_book
node_algebra_book -.->|"contains lessons"| node_algebra_lessons
node_notebook_book -.->|"contains lessons"| node_notebook_lessons
node_algebra_lessons -.->|"uses runtime"| node_algebra_engine
node_notebook_lessons -.->|"uses runtime"| node_notebook_engine

click node_shelf "https://github.com/dozentwelve/papermorph/blob/main/site/lib/bookshelf.js"
click node_algebra_book "https://github.com/dozentwelve/papermorph/tree/main/site/elementary-algebra"
click node_algebra_lessons "https://github.com/dozentwelve/papermorph/blob/main/site/elementary-algebra/ch01/audio/en/timings.js"
click node_algebra_engine "https://github.com/dozentwelve/papermorph/blob/main/site/elementary-algebra/lib/engine.js"
click node_unit_art "https://github.com/dozentwelve/papermorph/blob/main/site/math-notebook/unit-art.js"
click node_notebook_book "https://github.com/dozentwelve/papermorph/tree/main/site/math-notebook"
click node_notebook_lessons "https://github.com/dozentwelve/papermorph/blob/main/site/math-notebook/ch04/audio/en/timings.js"
click node_notebook_engine "https://github.com/dozentwelve/papermorph/blob/main/site/math-notebook/lib/engine.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_shelf toneBlue
class node_algebra_book,node_algebra_lessons,node_algebra_engine toneAmber
class node_unit_art,node_notebook_book,node_notebook_lessons,node_notebook_engine toneMint
class node_reader toneIndigo
```

## Components

### Site navigation

- [Bookshelf](https://github.com/dozentwelve/papermorph/blob/main/site/lib/bookshelf.js): `site/lib/bookshelf.js`

### Elementary algebra

- [Algebra book](https://github.com/dozentwelve/papermorph/tree/main/site/elementary-algebra): `site/elementary-algebra`
- [Chapter lessons](https://github.com/dozentwelve/papermorph/blob/main/site/elementary-algebra/ch01/audio/en/timings.js): `site/elementary-algebra/ch01/audio/en/timings.js`
- [Lesson runtime](https://github.com/dozentwelve/papermorph/blob/main/site/elementary-algebra/lib/engine.js): `site/elementary-algebra/lib/engine.js`

### Math notebook

- [Unit artwork](https://github.com/dozentwelve/papermorph/blob/main/site/math-notebook/unit-art.js): `site/math-notebook/unit-art.js`
- [Math notebook](https://github.com/dozentwelve/papermorph/tree/main/site/math-notebook): `site/math-notebook`
- [Chapter lessons](https://github.com/dozentwelve/papermorph/blob/main/site/math-notebook/ch04/audio/en/timings.js): `site/math-notebook/ch04/audio/en/timings.js`
- [Lesson runtime](https://github.com/dozentwelve/papermorph/blob/main/site/math-notebook/lib/engine.js): `site/math-notebook/lib/engine.js`

### Other components

- **Reader**

## Connections

- Reader → Bookshelf: opens
- Bookshelf → Algebra book: links to (evidence: `site/lib/bookshelf.js`)
- Bookshelf → Math notebook: links to (evidence: `site/lib/bookshelf.js`)
- Algebra book → Chapter lessons: contains lessons
- Math notebook → Chapter lessons: contains lessons
- Chapter lessons → Lesson runtime: uses runtime
- Chapter lessons → Lesson runtime: uses runtime
