# onepixelaway/frontend-textbooks architecture

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

- Interactive diagram: https://gitdiagram.com/onepixelaway/frontend-textbooks
- Repository: https://github.com/onepixelaway/frontend-textbooks

## Overview

Frontend Textbooks is an agent-oriented publishing tool that turns long-form manuscripts into designed, editable HTML books and print-ready PDFs. The main workflow is manuscript and plan input, validated book generation with theme and cover assets, browser pagination and rendering, then verification and PDF export. The README also describes source-preservation checks, responsive layouts, diagrams and feature pages, bundled typography, and aesthetic evidence. The graph reflects documented capabilities; unsampled subsystem wiring is intentionally left unspecified.

Main entry points: [`scripts/build-html-book.mjs`](https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/build-html-book.mjs) (HTML book builder), [`scripts/book-pipeline.mjs`](https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/book-pipeline.mjs) (Book pipeline), [`scripts/lib/browser-runtime.mjs`](https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/browser-runtime.mjs) (Browser renderer), [`scripts/book-browser.mjs`](https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/book-browser.mjs) (Book browser runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Authoring Inputs"]
  node_manuscript["Manuscript"]
  node_plan["Book plan"]
end

subgraph group_production["Book Production"]
  node_pipeline["Book pipeline<br/>[book-pipeline.mjs]"]
  node_builder["HTML book builder"]
  node_parser["Manuscript parser<br/>[manuscript.mjs]"]
  node_compiler["Plan compiler<br/>[plan-compiler.mjs]"]
  node_themes["Theme registry<br/>[index.mjs]"]
  node_fontassets["Theme fonts<br/>[font-assets.mjs]"]
  node_cover["Cover assets<br/>[cover-assets.mjs]"]
end

subgraph group_rendering["Layout and Rendering"]
  node_htmlbook["HTML book"]
  node_client["Pagination client"]
  node_browser["Browser renderer"]
  node_browserbook["Book browser runner<br/>[book-browser.mjs]"]
end

subgraph group_quality["Verification and Export"]
  node_verify["Verification checks"]
  node_profiles["Verification profiles"]
  node_report["Rendered reports"]
  node_pdfinspect["PDF structure inspection<br/>[pdf-inspection.mjs]"]
  node_pdf["Print PDF"]
  node_aesthetic["Aesthetic evidence"]
end

node_agent(("Coding agent"))

node_agent -->|"provides source"| node_manuscript
node_agent -->|"supplies plan"| node_plan
node_agent -->|"runs workflow"| node_pipeline
node_pipeline -->|"invokes build"| node_builder
node_builder -->|"parses manuscript"| node_parser
node_builder -->|"compiles plan"| node_compiler
node_builder -->|"resolves theme"| node_themes
node_builder -->|"resolves fonts"| node_fontassets
node_builder -->|"validates cover"| node_cover
node_manuscript -->|"build input"| node_builder
node_plan -->|"build input"| node_builder
node_builder -->|"writes HTML"| node_htmlbook
node_client -->|"provides pagination"| node_htmlbook
node_pipeline -->|"requests rendering"| node_browserbook
node_browserbook -->|"renders pages"| node_browser
node_browser -->|"loads HTML"| node_htmlbook
node_pipeline -->|"selects checks"| node_profiles
node_pipeline -->|"runs verification"| node_verify
node_verify -->|"checks rendered pages"| node_browserbook
node_browser -->|"produces evidence"| node_report
node_pipeline -->|"exports PDF"| node_pdf
node_pdf -->|"inspects structure"| node_pdfinspect
node_report -->|"supplies visual evidence"| node_aesthetic

click node_pipeline "https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/book-pipeline.mjs"
click node_builder "https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/build-html-book.mjs"
click node_parser "https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/manuscript.mjs"
click node_compiler "https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/plan-compiler.mjs"
click node_themes "https://github.com/onepixelaway/frontend-textbooks/blob/main/themes/index.mjs"
click node_fontassets "https://github.com/onepixelaway/frontend-textbooks/blob/main/themes/font-assets.mjs"
click node_cover "https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/cover-assets.mjs"
click node_client "https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/book-client-program.mjs"
click node_browser "https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/browser-runtime.mjs"
click node_browserbook "https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/book-browser.mjs"
click node_verify "https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/verification-checks.mjs"
click node_profiles "https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/verification-profiles.mjs"
click node_report "https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/rendered-report.mjs"
click node_pdfinspect "https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/pdf-inspection.mjs"
click node_aesthetic "https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/aesthetic-review.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_manuscript,node_plan toneBlue
class node_pipeline,node_builder,node_parser,node_compiler,node_themes,node_fontassets,node_cover toneAmber
class node_htmlbook,node_client,node_browser,node_browserbook toneMint
class node_verify,node_profiles,node_report,node_pdfinspect,node_pdf,node_aesthetic toneRose
class node_agent toneIndigo
```

## Components

### Authoring Inputs

- **Manuscript**
- **Book plan**

### Book Production

- [Book pipeline](https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/book-pipeline.mjs): `scripts/book-pipeline.mjs`
- [HTML book builder](https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/build-html-book.mjs): `scripts/build-html-book.mjs`
- [Manuscript parser](https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/manuscript.mjs): `scripts/lib/manuscript.mjs`
- [Plan compiler](https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/plan-compiler.mjs): `scripts/lib/plan-compiler.mjs`
- [Theme registry](https://github.com/onepixelaway/frontend-textbooks/blob/main/themes/index.mjs): `themes/index.mjs`
- [Theme fonts](https://github.com/onepixelaway/frontend-textbooks/blob/main/themes/font-assets.mjs): `themes/font-assets.mjs`
- [Cover assets](https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/cover-assets.mjs): `scripts/lib/cover-assets.mjs`

### Layout and Rendering

- **HTML book**
- [Pagination client](https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/book-client-program.mjs): `scripts/lib/book-client-program.mjs`
- [Browser renderer](https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/browser-runtime.mjs): `scripts/lib/browser-runtime.mjs`
- [Book browser runner](https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/book-browser.mjs): `scripts/book-browser.mjs`

### Verification and Export

- [Verification checks](https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/verification-checks.mjs): `scripts/lib/verification-checks.mjs`
- [Verification profiles](https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/verification-profiles.mjs): `scripts/lib/verification-profiles.mjs`
- [Rendered reports](https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/rendered-report.mjs): `scripts/lib/rendered-report.mjs`
- [PDF structure inspection](https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/pdf-inspection.mjs): `scripts/pdf-inspection.mjs`
- **Print PDF**
- [Aesthetic evidence](https://github.com/onepixelaway/frontend-textbooks/blob/main/scripts/lib/aesthetic-review.mjs): `scripts/lib/aesthetic-review.mjs`

### Other components

- **Coding agent**

## Connections

- Coding agent → Manuscript: provides source
- Coding agent → Book plan: supplies plan
- Coding agent → Book pipeline: runs workflow
- Book pipeline → HTML book builder: invokes build
- HTML book builder → Manuscript parser: parses manuscript
- HTML book builder → Plan compiler: compiles plan
- HTML book builder → Theme registry: resolves theme
- HTML book builder → Theme fonts: resolves fonts
- HTML book builder → Cover assets: validates cover
- Manuscript → HTML book builder: build input
- Book plan → HTML book builder: build input
- HTML book builder → HTML book: writes HTML
- Pagination client → HTML book: provides pagination
- Book pipeline → Book browser runner: requests rendering
- Book browser runner → Browser renderer: renders pages
- Browser renderer → HTML book: loads HTML
- Book pipeline → Verification profiles: selects checks
- Book pipeline → Verification checks: runs verification
- Verification checks → Book browser runner: checks rendered pages
- Browser renderer → Rendered reports: produces evidence
- Book pipeline → Print PDF: exports PDF
- Print PDF → PDF structure inspection: inspects structure
- Rendered reports → Aesthetic evidence: supplies visual evidence
