# kasfreedom/sabura-editor architecture

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

- Interactive diagram: https://gitdiagram.com/kasfreedom/sabura-editor
- Repository: https://github.com/kasfreedom/sabura-editor

## Overview

Sabura is an offline, single-file visual whiteboard. Users open a board, edit and present it with drawing tools, then save a portable copy containing its document and runtime. Its core flow runs from the browser editor through workspace interactions, validated document commands, SVG rendering, and file packaging. Separate branches provide themes and revision lineage, plus optional browser-agent automation. The graph uses documented capabilities and indexed imports; unsampled implementation details are not treated as verified calls.

Main entry points: [`src/main.js`](https://github.com/kasfreedom/sabura-editor/blob/main/src/main.js) (App coordinator), [`src/core/document.js`](https://github.com/kasfreedom/sabura-editor/blob/main/src/core/document.js) (Document schema), [`src/ui/workspace.js`](https://github.com/kasfreedom/sabura-editor/blob/main/src/ui/workspace.js) (Workspace gestures), [`src/renderer/svg-renderer.js`](https://github.com/kasfreedom/sabura-editor/blob/main/src/renderer/svg-renderer.js) (SVG renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_editor["Editor experience"]
  node_app["App coordinator<br/>[main.js]"]
  node_workspace["Workspace gestures<br/>[workspace.js]"]
  node_toolwheel["Tool wheel<br/>[wheel.js]"]
  node_topbar["Top bar<br/>[topbar.js]"]
  node_shortcuts["Keyboard shortcuts<br/>[shortcuts.js]"]
  node_texteditor["Text editing<br/>[text-editor.js]"]
  node_zoom["Zoom controls<br/>[zoom-toolbar.js]"]
  node_help["Help and shortcuts<br/>[help-modal.js]"]
  node_renderer["SVG renderer<br/>[svg-renderer.js]"]
  node_laser["Presentation laser<br/>[laser.js]"]
end

subgraph group_model["Canvas model"]
  node_commands["Command engine<br/>[commands.js]"]
  node_document["Document schema<br/>[document.js]"]
  node_geometry["Geometry engine<br/>[geometry.js]"]
  node_revision["Revision lineage<br/>[revision.js]"]
  node_types["Schemas and themes<br/>[types.js]"]
  node_sketch["Sketch paths<br/>[sketch.js]"]
  node_color["Contrast colors<br/>[color.js]"]
  node_themecolors["Theme palettes<br/>[theme-colors.js]"]
end

subgraph group_persistence["Portable files"]
  node_packer["HTML file packer<br/>[file-packer.js]"]
end

subgraph group_automation["Agent automation"]
  node_agent["Versioned agent API<br/>[agent-api.js]"]
  node_webmcp["WebMCP tools<br/>[webmcp.js]"]
end

node_user(("Board user"))
node_browser["Browser download"]
node_browser_agent(("Browser agent"))

node_user -->|"opens and edits"| node_app
node_app -->|"coordinates"| node_workspace
node_app -->|"coordinates"| node_toolwheel
node_app -->|"coordinates"| node_topbar
node_app -->|"coordinates"| node_shortcuts
node_app -->|"coordinates"| node_texteditor
node_app -->|"coordinates"| node_zoom
node_app -->|"coordinates"| node_help
node_workspace -->|"renders scene"| node_renderer
node_workspace -->|"uses transforms"| node_geometry
node_workspace -->|"clones objects"| node_document
node_app -->|"dispatches edits"| node_commands
node_commands -->|"clones documents"| node_document
node_document -->|"validates lineage"| node_revision
node_document -->|"uses schema"| node_types
node_geometry -->|"uses constants"| node_types
node_renderer -->|"resolves connectors"| node_geometry
node_renderer -->|"generates paths"| node_sketch
node_renderer -->|"resolves contrast"| node_color
node_toolwheel -->|"draws decoration"| node_sketch
node_toolwheel -->|"gets palettes"| node_themecolors
node_app -->|"packages save copy"| node_packer
node_packer -->|"validates and serializes"| node_document
node_packer -->|"downloads HTML"| node_browser
node_app -->|"exposes API"| node_agent
node_agent -->|"dispatches batches"| node_commands
node_app -->|"registers tools"| node_webmcp
node_webmcp -->|"exposes capabilities"| node_agent
node_browser_agent -->|"uses API"| node_agent

click node_app "https://github.com/kasfreedom/sabura-editor/blob/main/src/main.js"
click node_workspace "https://github.com/kasfreedom/sabura-editor/blob/main/src/ui/workspace.js"
click node_toolwheel "https://github.com/kasfreedom/sabura-editor/blob/main/src/ui/wheel.js"
click node_topbar "https://github.com/kasfreedom/sabura-editor/blob/main/src/ui/topbar.js"
click node_shortcuts "https://github.com/kasfreedom/sabura-editor/blob/main/src/ui/shortcuts.js"
click node_texteditor "https://github.com/kasfreedom/sabura-editor/blob/main/src/ui/text-editor.js"
click node_zoom "https://github.com/kasfreedom/sabura-editor/blob/main/src/ui/zoom-toolbar.js"
click node_help "https://github.com/kasfreedom/sabura-editor/blob/main/src/ui/help-modal.js"
click node_renderer "https://github.com/kasfreedom/sabura-editor/blob/main/src/renderer/svg-renderer.js"
click node_laser "https://github.com/kasfreedom/sabura-editor/blob/main/src/renderer/laser.js"
click node_commands "https://github.com/kasfreedom/sabura-editor/blob/main/src/core/commands.js"
click node_document "https://github.com/kasfreedom/sabura-editor/blob/main/src/core/document.js"
click node_geometry "https://github.com/kasfreedom/sabura-editor/blob/main/src/core/geometry.js"
click node_revision "https://github.com/kasfreedom/sabura-editor/blob/main/src/core/revision.js"
click node_types "https://github.com/kasfreedom/sabura-editor/blob/main/src/core/types.js"
click node_sketch "https://github.com/kasfreedom/sabura-editor/blob/main/src/core/sketch.js"
click node_color "https://github.com/kasfreedom/sabura-editor/blob/main/src/core/color.js"
click node_themecolors "https://github.com/kasfreedom/sabura-editor/blob/main/src/core/theme-colors.js"
click node_packer "https://github.com/kasfreedom/sabura-editor/blob/main/src/storage/file-packer.js"
click node_agent "https://github.com/kasfreedom/sabura-editor/blob/main/src/agent-api.js"
click node_webmcp "https://github.com/kasfreedom/sabura-editor/blob/main/src/webmcp.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_app,node_workspace,node_toolwheel,node_topbar,node_shortcuts,node_texteditor,node_zoom,node_help,node_renderer,node_laser,node_user,node_browser,node_browser_agent toneBlue
class node_commands,node_document,node_geometry,node_revision,node_types,node_sketch,node_color,node_themecolors toneAmber
class node_packer toneMint
class node_agent,node_webmcp toneRose
```

## Components

### Editor experience

- [App coordinator](https://github.com/kasfreedom/sabura-editor/blob/main/src/main.js): `src/main.js`
- [Workspace gestures](https://github.com/kasfreedom/sabura-editor/blob/main/src/ui/workspace.js): `src/ui/workspace.js`
- [Tool wheel](https://github.com/kasfreedom/sabura-editor/blob/main/src/ui/wheel.js): `src/ui/wheel.js`
- [Top bar](https://github.com/kasfreedom/sabura-editor/blob/main/src/ui/topbar.js): `src/ui/topbar.js`
- [Keyboard shortcuts](https://github.com/kasfreedom/sabura-editor/blob/main/src/ui/shortcuts.js): `src/ui/shortcuts.js`
- [Text editing](https://github.com/kasfreedom/sabura-editor/blob/main/src/ui/text-editor.js): `src/ui/text-editor.js`
- [Zoom controls](https://github.com/kasfreedom/sabura-editor/blob/main/src/ui/zoom-toolbar.js): `src/ui/zoom-toolbar.js`
- [Help and shortcuts](https://github.com/kasfreedom/sabura-editor/blob/main/src/ui/help-modal.js): `src/ui/help-modal.js`
- [SVG renderer](https://github.com/kasfreedom/sabura-editor/blob/main/src/renderer/svg-renderer.js): `src/renderer/svg-renderer.js`
- [Presentation laser](https://github.com/kasfreedom/sabura-editor/blob/main/src/renderer/laser.js): `src/renderer/laser.js`

### Canvas model

- [Command engine](https://github.com/kasfreedom/sabura-editor/blob/main/src/core/commands.js): `src/core/commands.js`
- [Document schema](https://github.com/kasfreedom/sabura-editor/blob/main/src/core/document.js): `src/core/document.js`
- [Geometry engine](https://github.com/kasfreedom/sabura-editor/blob/main/src/core/geometry.js): `src/core/geometry.js`
- [Revision lineage](https://github.com/kasfreedom/sabura-editor/blob/main/src/core/revision.js): `src/core/revision.js`
- [Schemas and themes](https://github.com/kasfreedom/sabura-editor/blob/main/src/core/types.js): `src/core/types.js`
- [Sketch paths](https://github.com/kasfreedom/sabura-editor/blob/main/src/core/sketch.js): `src/core/sketch.js`
- [Contrast colors](https://github.com/kasfreedom/sabura-editor/blob/main/src/core/color.js): `src/core/color.js`
- [Theme palettes](https://github.com/kasfreedom/sabura-editor/blob/main/src/core/theme-colors.js): `src/core/theme-colors.js`

### Portable files

- [HTML file packer](https://github.com/kasfreedom/sabura-editor/blob/main/src/storage/file-packer.js): `src/storage/file-packer.js`

### Agent automation

- [Versioned agent API](https://github.com/kasfreedom/sabura-editor/blob/main/src/agent-api.js): `src/agent-api.js`
- [WebMCP tools](https://github.com/kasfreedom/sabura-editor/blob/main/src/webmcp.js): `src/webmcp.js`

### Other components

- **Board user**
- **Browser download**
- **Browser agent**

## Connections

- Board user → App coordinator: opens and edits (evidence: `README.md`)
- App coordinator → Workspace gestures: coordinates (evidence: `src/main.js`)
- App coordinator → Tool wheel: coordinates (evidence: `src/main.js`)
- App coordinator → Top bar: coordinates (evidence: `src/main.js`)
- App coordinator → Keyboard shortcuts: coordinates (evidence: `src/main.js`)
- App coordinator → Text editing: coordinates (evidence: `src/main.js`)
- App coordinator → Zoom controls: coordinates (evidence: `src/main.js`)
- App coordinator → Help and shortcuts: coordinates (evidence: `src/main.js`)
- Workspace gestures → SVG renderer: renders scene (evidence: `src/ui/workspace.js`)
- Workspace gestures → Geometry engine: uses transforms (evidence: `src/ui/workspace.js`)
- Workspace gestures → Document schema: clones objects (evidence: `src/ui/workspace.js`)
- App coordinator → Command engine: dispatches edits (evidence: `src/main.js`)
- Command engine → Document schema: clones documents (evidence: `src/core/commands.js`)
- Document schema → Revision lineage: validates lineage (evidence: `src/core/document.js`)
- Document schema → Schemas and themes: uses schema (evidence: `src/core/document.js`)
- Geometry engine → Schemas and themes: uses constants (evidence: `src/core/geometry.js`)
- SVG renderer → Geometry engine: resolves connectors (evidence: `src/renderer/svg-renderer.js`)
- SVG renderer → Sketch paths: generates paths (evidence: `src/renderer/svg-renderer.js`)
- SVG renderer → Contrast colors: resolves contrast (evidence: `src/renderer/svg-renderer.js`)
- Tool wheel → Sketch paths: draws decoration (evidence: `src/ui/wheel.js`)
- Tool wheel → Theme palettes: gets palettes (evidence: `src/ui/wheel.js`)
- App coordinator → HTML file packer: packages save copy (evidence: `src/main.js`)
- HTML file packer → Document schema: validates and serializes (evidence: `src/storage/file-packer.js`)
- HTML file packer → Browser download: downloads HTML (evidence: `src/storage/file-packer.js`)
- App coordinator → Versioned agent API: exposes API (evidence: `src/main.js`)
- Versioned agent API → Command engine: dispatches batches (evidence: `src/agent-api.js`)
- App coordinator → WebMCP tools: registers tools (evidence: `src/main.js`)
- WebMCP tools → Versioned agent API: exposes capabilities (evidence: `src/webmcp.js`)
- Browser agent → Versioned agent API: uses API (evidence: `README.md`)
