# atpugvaraa/spool architecture

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

- Interactive diagram: https://gitdiagram.com/atpugvaraa/spool
- Repository: https://github.com/atpugvaraa/spool

## Overview

Spool is a local-first native design editor whose central workflow is opening a `.spool` bundle, reconciling `lamine.yaml` identities with authored HTML/CSS/SVG, deriving a disposable canvas document, editing through native surfaces and semantic history, then saving supported changes back to source. The website is a separate presentation project, not part of this editor workflow. Edges reflect the provided excerpts, SOURCE INDEX references, and README; unsampled capabilities are represented only where their paths and relationships are supported.

Main entry points: [`app/src/shell.rs`](https://github.com/atpugvaraa/spool/blob/main/app/src/shell.rs) (Application Shell), [`app/src/canvas.rs`](https://github.com/atpugvaraa/spool/blob/main/app/src/canvas.rs) (Canvas Document), [`app/src/project_open.rs`](https://github.com/atpugvaraa/spool/blob/main/app/src/project_open.rs) (Project Opening), [`app/src/project_save.rs`](https://github.com/atpugvaraa/spool/blob/main/app/src/project_save.rs) (Source Saving)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_project["Project and Source"]
  node_bundle[("Project Bundle<br/>[project_bundle.rs]")]
  node_metadata["Structural Metadata<br/>[source_document.rs]"]
  node_binding["Source Binding<br/>[source_binding.rs]"]
  node_open["Project Opening<br/>[project_open.rs]"]
  node_save["Source Saving<br/>[project_save.rs]"]
  node_spool["Project Launch<br/>[spool_project.rs]"]
end

subgraph group_runtime["Document Runtime"]
  node_visual["Source Interpretation<br/>[visual.rs]"]
  node_style["Style Resolution<br/>[style.rs]"]
  node_projection["Runtime Projection"]
  node_canvas[("Canvas Document<br/>[canvas.rs]")]
  node_hierarchy["Hierarchy<br/>[hierarchy.rs]"]
end

subgraph group_editing["Editing and History"]
  node_commands["Editor Commands<br/>[commands.rs]"]
  node_operations["Semantic History<br/>[operations.rs]"]
  node_snap["Alignment Snapping<br/>[snap.rs]"]
end

subgraph group_surfaces["Native Editor"]
  node_shell["Application Shell<br/>[shell.rs]"]
  node_layers["Layers Panel<br/>[layers.rs]"]
  node_inspector["Inspector Panel<br/>[inspector.rs]"]
end

subgraph group_support["Editor Support"]
  node_diagnostics["Diagnostics<br/>[diagnostics.rs]"]
  node_lifecycle["Window Lifecycle<br/>[lifecycle.rs]"]
end

node_user(("Designer"))

node_user -->|"edits in"| node_shell
node_shell -->|"opens project"| node_open
node_shell -->|"resolves launch"| node_spool
node_open -->|"loads bundle"| node_bundle
node_open -->|"reconciles identities"| node_binding
node_open -->|"interprets source"| node_visual
node_open -->|"projects runtime"| node_projection
node_projection -->|"builds document"| node_canvas
node_visual -->|"resolves styles"| node_style
node_binding -->|"binds structure"| node_metadata
node_bundle -->|"loads metadata"| node_metadata
node_shell -->|"dispatches commands"| node_commands
node_commands -->|"changes document"| node_canvas
node_commands -.->|"records edits"| node_operations
node_operations -->|"updates runtime"| node_canvas
node_operations -->|"updates structure"| node_metadata
node_shell -->|"shows hierarchy"| node_layers
node_shell -->|"shows properties"| node_inspector
node_layers -->|"reads structure"| node_metadata
node_shell -->|"hosts canvas"| node_canvas
node_canvas -.->|"supports alignment"| node_snap
node_shell -->|"saves project"| node_save
node_save -->|"writes bundle"| node_bundle
node_save -->|"resolves source spans"| node_binding
node_save -->|"uses source identity"| node_visual
node_save -->|"writes style edits"| node_style
node_shell -->|"reports status"| node_diagnostics
node_shell -->|"installs lifecycle"| node_lifecycle
node_visual -->|"derives geometry"| node_canvas
node_hierarchy -->|"projects hierarchy"| node_metadata

click node_bundle "https://github.com/atpugvaraa/spool/blob/main/app/src/project_bundle.rs"
click node_metadata "https://github.com/atpugvaraa/spool/blob/main/app/src/source_document.rs"
click node_binding "https://github.com/atpugvaraa/spool/blob/main/app/src/source_binding.rs"
click node_visual "https://github.com/atpugvaraa/spool/blob/main/app/src/visual.rs"
click node_style "https://github.com/atpugvaraa/spool/blob/main/app/src/style.rs"
click node_projection "https://github.com/atpugvaraa/spool/blob/main/app/src/document_runtime_bridge.rs"
click node_canvas "https://github.com/atpugvaraa/spool/blob/main/app/src/canvas.rs"
click node_open "https://github.com/atpugvaraa/spool/blob/main/app/src/project_open.rs"
click node_save "https://github.com/atpugvaraa/spool/blob/main/app/src/project_save.rs"
click node_shell "https://github.com/atpugvaraa/spool/blob/main/app/src/shell.rs"
click node_commands "https://github.com/atpugvaraa/spool/blob/main/app/src/commands.rs"
click node_operations "https://github.com/atpugvaraa/spool/blob/main/app/src/operations.rs"
click node_layers "https://github.com/atpugvaraa/spool/blob/main/app/src/layers.rs"
click node_inspector "https://github.com/atpugvaraa/spool/blob/main/app/src/inspector.rs"
click node_hierarchy "https://github.com/atpugvaraa/spool/blob/main/app/src/hierarchy.rs"
click node_snap "https://github.com/atpugvaraa/spool/blob/main/app/src/snap.rs"
click node_diagnostics "https://github.com/atpugvaraa/spool/blob/main/app/src/diagnostics.rs"
click node_lifecycle "https://github.com/atpugvaraa/spool/blob/main/app/src/lifecycle.rs"
click node_spool "https://github.com/atpugvaraa/spool/blob/main/app/src/spool_project.rs"

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_bundle,node_metadata,node_binding,node_open,node_save,node_spool toneBlue
class node_visual,node_style,node_projection,node_canvas,node_hierarchy toneAmber
class node_commands,node_operations,node_snap toneMint
class node_shell,node_layers,node_inspector toneRose
class node_diagnostics,node_lifecycle,node_user toneIndigo
```

## Components

### Project and Source

- [Project Bundle](https://github.com/atpugvaraa/spool/blob/main/app/src/project_bundle.rs): `app/src/project_bundle.rs`
- [Structural Metadata](https://github.com/atpugvaraa/spool/blob/main/app/src/source_document.rs): `app/src/source_document.rs`
- [Source Binding](https://github.com/atpugvaraa/spool/blob/main/app/src/source_binding.rs): `app/src/source_binding.rs`
- [Project Opening](https://github.com/atpugvaraa/spool/blob/main/app/src/project_open.rs): `app/src/project_open.rs`
- [Source Saving](https://github.com/atpugvaraa/spool/blob/main/app/src/project_save.rs): `app/src/project_save.rs`
- [Project Launch](https://github.com/atpugvaraa/spool/blob/main/app/src/spool_project.rs): `app/src/spool_project.rs`

### Document Runtime

- [Source Interpretation](https://github.com/atpugvaraa/spool/blob/main/app/src/visual.rs): `app/src/visual.rs`
- [Style Resolution](https://github.com/atpugvaraa/spool/blob/main/app/src/style.rs): `app/src/style.rs`
- [Runtime Projection](https://github.com/atpugvaraa/spool/blob/main/app/src/document_runtime_bridge.rs): `app/src/document_runtime_bridge.rs`
- [Canvas Document](https://github.com/atpugvaraa/spool/blob/main/app/src/canvas.rs): `app/src/canvas.rs`
- [Hierarchy](https://github.com/atpugvaraa/spool/blob/main/app/src/hierarchy.rs): `app/src/hierarchy.rs`

### Editing and History

- [Editor Commands](https://github.com/atpugvaraa/spool/blob/main/app/src/commands.rs): `app/src/commands.rs`
- [Semantic History](https://github.com/atpugvaraa/spool/blob/main/app/src/operations.rs): `app/src/operations.rs`
- [Alignment Snapping](https://github.com/atpugvaraa/spool/blob/main/app/src/snap.rs): `app/src/snap.rs`

### Native Editor

- [Application Shell](https://github.com/atpugvaraa/spool/blob/main/app/src/shell.rs): `app/src/shell.rs`
- [Layers Panel](https://github.com/atpugvaraa/spool/blob/main/app/src/layers.rs): `app/src/layers.rs`
- [Inspector Panel](https://github.com/atpugvaraa/spool/blob/main/app/src/inspector.rs): `app/src/inspector.rs`

### Editor Support

- [Diagnostics](https://github.com/atpugvaraa/spool/blob/main/app/src/diagnostics.rs): `app/src/diagnostics.rs`
- [Window Lifecycle](https://github.com/atpugvaraa/spool/blob/main/app/src/lifecycle.rs): `app/src/lifecycle.rs`

### Other components

- **Designer**

## Connections

- Designer → Application Shell: edits in (evidence: `README.md`)
- Application Shell → Project Opening: opens project (evidence: `app/src/shell.rs`)
- Application Shell → Project Launch: resolves launch (evidence: `app/src/shell.rs`)
- Project Opening → Project Bundle: loads bundle (evidence: `app/src/project_open.rs`)
- Project Opening → Source Binding: reconciles identities (evidence: `app/src/project_open.rs`)
- Project Opening → Source Interpretation: interprets source (evidence: `app/src/project_open.rs`)
- Project Opening → Runtime Projection: projects runtime (evidence: `app/src/project_open.rs`)
- Runtime Projection → Canvas Document: builds document (evidence: `app/src/document_runtime_bridge.rs`)
- Source Interpretation → Style Resolution: resolves styles (evidence: `app/src/visual.rs`)
- Source Binding → Structural Metadata: binds structure (evidence: `app/src/source_binding.rs`)
- Project Bundle → Structural Metadata: loads metadata (evidence: `app/src/project_bundle.rs`)
- Application Shell → Editor Commands: dispatches commands (evidence: `app/src/shell.rs`)
- Editor Commands → Canvas Document: changes document (evidence: `app/src/commands.rs`)
- Editor Commands → Semantic History: records edits
- Semantic History → Canvas Document: updates runtime (evidence: `app/src/operations.rs`)
- Semantic History → Structural Metadata: updates structure (evidence: `app/src/operations.rs`)
- Application Shell → Layers Panel: shows hierarchy (evidence: `app/src/shell.rs`)
- Application Shell → Inspector Panel: shows properties (evidence: `app/src/shell.rs`)
- Layers Panel → Structural Metadata: reads structure (evidence: `app/src/layers.rs`)
- Application Shell → Canvas Document: hosts canvas (evidence: `app/src/shell.rs`)
- Canvas Document → Alignment Snapping: supports alignment
- Application Shell → Source Saving: saves project (evidence: `app/src/shell.rs`)
- Source Saving → Project Bundle: writes bundle (evidence: `app/src/project_save.rs`)
- Source Saving → Source Binding: resolves source spans (evidence: `app/src/project_save.rs`)
- Source Saving → Source Interpretation: uses source identity (evidence: `app/src/project_save.rs`)
- Source Saving → Style Resolution: writes style edits (evidence: `app/src/project_save.rs`)
- Application Shell → Diagnostics: reports status (evidence: `app/src/shell.rs`)
- Application Shell → Window Lifecycle: installs lifecycle (evidence: `app/src/main.rs`)
- Source Interpretation → Canvas Document: derives geometry (evidence: `app/src/visual.rs`)
- Hierarchy → Structural Metadata: projects hierarchy (evidence: `app/src/hierarchy.rs`)
