# nttare0/paper-style architecture

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

- Interactive diagram: https://gitdiagram.com/nttare0/paper-style
- Repository: https://github.com/nttare0/paper-style

## Overview

This is a browser-based paper-sheet creator: users configure a paper template and appearance, preview and edit pages, then export or print the result. The main runtime is supported by the source index and selected excerpts; several renderer and exporter internals are unsampled, so their finer-grained interactions are not asserted.

Main entry points: [`src/engine/buildSheetSvg.ts`](https://github.com/nttare0/paper-style/blob/main/src/engine/buildSheetSvg.ts) (SVG assembly), [`src/engine/renderers/index.ts`](https://github.com/nttare0/paper-style/blob/main/src/engine/renderers/index.ts) (Renderer registry), [`src/components/PaperCreator.tsx`](https://github.com/nttare0/paper-style/blob/main/src/components/PaperCreator.tsx) (Creator workspace), [`src/components/ControlPanel.tsx`](https://github.com/nttare0/paper-style/blob/main/src/components/ControlPanel.tsx) (Paper controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Creator experience"]
  node_creator["Creator workspace<br/>[PaperCreator.tsx]"]
  node_controls["Paper controls<br/>[ControlPanel.tsx]"]
  node_preview["Page preview<br/>[PaperPreview.tsx]"]
end

subgraph group_catalog["Paper choices"]
  node_templates["Template catalog<br/>[templates.ts]"]
  node_sizes["Paper sizes<br/>[sizes.ts]"]
  node_themes["Print themes<br/>[themes.ts]"]
  node_settings["Paper settings types<br/>[paper.ts]"]
end

subgraph group_generation["Sheet generation"]
  node_geometry["Page geometry<br/>[geometry.ts]"]
  node_fields["Template fields<br/>[sheetFields.ts]"]
  node_writing["Writing areas<br/>[writingBox.ts]"]
  node_patterns["Background patterns<br/>[patterns.ts]"]
  node_linegrids["Lines and grids<br/>[basicLinesGrids.ts]"]
  node_graphs["Graph renderers<br/>[geometryGraphs.ts]"]
  node_handwriting["Handwriting renderers"]
  node_music["Music renderers<br/>[musicNotation.ts]"]
  node_planners["Planner renderers"]
  node_registry["Renderer registry<br/>[index.ts]"]
  node_svg["SVG assembly<br/>[buildSheetSvg.ts]"]
  node_svghelpers["SVG primitives<br/>[svgHelpers.ts]"]
end

subgraph group_delivery["Export and install"]
  node_exporters["Export formats<br/>[exporters.ts]"]
  node_pwa["Install and offline<br/>[pwa.ts]"]
  node_serviceworker["Offline worker<br/>[sw.js]"]
end

node_user(("Paper creator"))

node_user -->|"configures"| node_creator
node_creator -->|"renders"| node_controls
node_creator -->|"renders"| node_preview
node_creator -->|"invokes export"| node_exporters
node_creator -->|"uses install state"| node_pwa
node_controls -->|"reads choices"| node_templates
node_controls -->|"reads choices"| node_sizes
node_controls -->|"reads choices"| node_themes
node_controls -->|"validates layout"| node_geometry
node_preview -->|"requests sheet"| node_svg
node_preview -->|"resolves print color"| node_themes
node_svg -->|"computes layout"| node_geometry
node_svg -->|"adds pattern"| node_patterns
node_svg -->|"gets field layout"| node_fields
node_svg -->|"gets writing areas"| node_writing
node_svg -->|"dispatches renderer"| node_registry
node_registry -->|"registers renderer"| node_linegrids
node_registry -->|"registers renderer"| node_graphs
node_registry -->|"registers renderer"| node_handwriting
node_registry -->|"registers renderer"| node_music
node_registry -->|"registers renderer"| node_planners
node_svg -->|"resolves colors"| node_themes
node_svg -->|"builds SVG"| node_svghelpers
node_exporters -->|"exports sheet SVG"| node_svg
node_exporters -->|"uses dimensions"| node_sizes
node_pwa -->|"registers worker"| node_serviceworker

click node_creator "https://github.com/nttare0/paper-style/blob/main/src/components/PaperCreator.tsx"
click node_controls "https://github.com/nttare0/paper-style/blob/main/src/components/ControlPanel.tsx"
click node_preview "https://github.com/nttare0/paper-style/blob/main/src/components/PaperPreview.tsx"
click node_templates "https://github.com/nttare0/paper-style/blob/main/src/data/templates.ts"
click node_sizes "https://github.com/nttare0/paper-style/blob/main/src/data/sizes.ts"
click node_themes "https://github.com/nttare0/paper-style/blob/main/src/data/themes.ts"
click node_settings "https://github.com/nttare0/paper-style/blob/main/src/types/paper.ts"
click node_geometry "https://github.com/nttare0/paper-style/blob/main/src/engine/geometry.ts"
click node_fields "https://github.com/nttare0/paper-style/blob/main/src/engine/sheetFields.ts"
click node_writing "https://github.com/nttare0/paper-style/blob/main/src/engine/writingBox.ts"
click node_patterns "https://github.com/nttare0/paper-style/blob/main/src/engine/patterns.ts"
click node_linegrids "https://github.com/nttare0/paper-style/blob/main/src/engine/renderers/basicLinesGrids.ts"
click node_graphs "https://github.com/nttare0/paper-style/blob/main/src/engine/renderers/geometryGraphs.ts"
click node_handwriting "https://github.com/nttare0/paper-style/blob/main/src/engine/renderers/handwritingCalligraphy.ts"
click node_music "https://github.com/nttare0/paper-style/blob/main/src/engine/renderers/musicNotation.ts"
click node_planners "https://github.com/nttare0/paper-style/blob/main/src/engine/renderers/plannersTrackers.ts"
click node_registry "https://github.com/nttare0/paper-style/blob/main/src/engine/renderers/index.ts"
click node_svg "https://github.com/nttare0/paper-style/blob/main/src/engine/buildSheetSvg.ts"
click node_svghelpers "https://github.com/nttare0/paper-style/blob/main/src/engine/svgHelpers.ts"
click node_exporters "https://github.com/nttare0/paper-style/blob/main/src/engine/exporters.ts"
click node_pwa "https://github.com/nttare0/paper-style/blob/main/src/lib/pwa.ts"
click node_serviceworker "https://github.com/nttare0/paper-style/blob/main/public/sw.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_creator,node_controls,node_preview toneBlue
class node_templates,node_sizes,node_themes,node_settings toneAmber
class node_geometry,node_fields,node_writing,node_patterns,node_linegrids,node_graphs,node_handwriting,node_music,node_planners,node_registry,node_svg,node_svghelpers toneMint
class node_exporters,node_pwa,node_serviceworker toneRose
class node_user toneIndigo
```

## Components

### Creator experience

- [Creator workspace](https://github.com/nttare0/paper-style/blob/main/src/components/PaperCreator.tsx): `src/components/PaperCreator.tsx`
- [Paper controls](https://github.com/nttare0/paper-style/blob/main/src/components/ControlPanel.tsx): `src/components/ControlPanel.tsx`
- [Page preview](https://github.com/nttare0/paper-style/blob/main/src/components/PaperPreview.tsx): `src/components/PaperPreview.tsx`

### Paper choices

- [Template catalog](https://github.com/nttare0/paper-style/blob/main/src/data/templates.ts): `src/data/templates.ts`
- [Paper sizes](https://github.com/nttare0/paper-style/blob/main/src/data/sizes.ts): `src/data/sizes.ts`
- [Print themes](https://github.com/nttare0/paper-style/blob/main/src/data/themes.ts): `src/data/themes.ts`
- [Paper settings types](https://github.com/nttare0/paper-style/blob/main/src/types/paper.ts): `src/types/paper.ts`

### Sheet generation

- [Page geometry](https://github.com/nttare0/paper-style/blob/main/src/engine/geometry.ts): `src/engine/geometry.ts`
- [Template fields](https://github.com/nttare0/paper-style/blob/main/src/engine/sheetFields.ts): `src/engine/sheetFields.ts`
- [Writing areas](https://github.com/nttare0/paper-style/blob/main/src/engine/writingBox.ts): `src/engine/writingBox.ts`
- [Background patterns](https://github.com/nttare0/paper-style/blob/main/src/engine/patterns.ts): `src/engine/patterns.ts`
- [Lines and grids](https://github.com/nttare0/paper-style/blob/main/src/engine/renderers/basicLinesGrids.ts): `src/engine/renderers/basicLinesGrids.ts`
- [Graph renderers](https://github.com/nttare0/paper-style/blob/main/src/engine/renderers/geometryGraphs.ts): `src/engine/renderers/geometryGraphs.ts`
- [Handwriting renderers](https://github.com/nttare0/paper-style/blob/main/src/engine/renderers/handwritingCalligraphy.ts): `src/engine/renderers/handwritingCalligraphy.ts`
- [Music renderers](https://github.com/nttare0/paper-style/blob/main/src/engine/renderers/musicNotation.ts): `src/engine/renderers/musicNotation.ts`
- [Planner renderers](https://github.com/nttare0/paper-style/blob/main/src/engine/renderers/plannersTrackers.ts): `src/engine/renderers/plannersTrackers.ts`
- [Renderer registry](https://github.com/nttare0/paper-style/blob/main/src/engine/renderers/index.ts): `src/engine/renderers/index.ts`
- [SVG assembly](https://github.com/nttare0/paper-style/blob/main/src/engine/buildSheetSvg.ts): `src/engine/buildSheetSvg.ts`
- [SVG primitives](https://github.com/nttare0/paper-style/blob/main/src/engine/svgHelpers.ts): `src/engine/svgHelpers.ts`

### Export and install

- [Export formats](https://github.com/nttare0/paper-style/blob/main/src/engine/exporters.ts): `src/engine/exporters.ts`
- [Install and offline](https://github.com/nttare0/paper-style/blob/main/src/lib/pwa.ts): `src/lib/pwa.ts`
- [Offline worker](https://github.com/nttare0/paper-style/blob/main/public/sw.js): `public/sw.js`

### Other components

- **Paper creator**

## Connections

- Paper creator → Creator workspace: configures (evidence: `src/components/PaperCreator.tsx`)
- Creator workspace → Paper controls: renders (evidence: `src/components/PaperCreator.tsx`)
- Creator workspace → Page preview: renders (evidence: `src/components/PaperCreator.tsx`)
- Creator workspace → Export formats: invokes export (evidence: `src/components/PaperCreator.tsx`)
- Creator workspace → Install and offline: uses install state (evidence: `src/components/PaperCreator.tsx`)
- Paper controls → Template catalog: reads choices (evidence: `src/components/ControlPanel.tsx`)
- Paper controls → Paper sizes: reads choices (evidence: `src/components/ControlPanel.tsx`)
- Paper controls → Print themes: reads choices (evidence: `src/components/ControlPanel.tsx`)
- Paper controls → Page geometry: validates layout (evidence: `src/components/ControlPanel.tsx`)
- Page preview → SVG assembly: requests sheet (evidence: `src/components/PaperPreview.tsx`)
- Page preview → Print themes: resolves print color (evidence: `src/components/PaperPreview.tsx`)
- SVG assembly → Page geometry: computes layout (evidence: `src/engine/buildSheetSvg.ts`)
- SVG assembly → Background patterns: adds pattern (evidence: `src/engine/buildSheetSvg.ts`)
- SVG assembly → Template fields: gets field layout (evidence: `src/engine/buildSheetSvg.ts`)
- SVG assembly → Writing areas: gets writing areas (evidence: `src/engine/buildSheetSvg.ts`)
- SVG assembly → Renderer registry: dispatches renderer (evidence: `src/engine/buildSheetSvg.ts`)
- Renderer registry → Lines and grids: registers renderer (evidence: `src/engine/renderers/index.ts`)
- Renderer registry → Graph renderers: registers renderer (evidence: `src/engine/renderers/index.ts`)
- Renderer registry → Handwriting renderers: registers renderer (evidence: `src/engine/renderers/index.ts`)
- Renderer registry → Music renderers: registers renderer (evidence: `src/engine/renderers/index.ts`)
- Renderer registry → Planner renderers: registers renderer (evidence: `src/engine/renderers/index.ts`)
- SVG assembly → Print themes: resolves colors (evidence: `src/engine/buildSheetSvg.ts`)
- SVG assembly → SVG primitives: builds SVG (evidence: `src/engine/buildSheetSvg.ts`)
- Export formats → SVG assembly: exports sheet SVG (evidence: `src/engine/exporters.ts`)
- Export formats → Paper sizes: uses dimensions (evidence: `src/engine/exporters.ts`)
- Install and offline → Offline worker: registers worker (evidence: `src/lib/pwa.ts`)
