# storytold/vectorcraft architecture

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

- Interactive diagram: https://gitdiagram.com/storytold/vectorcraft
- Repository: https://github.com/storytold/vectorcraft

## Overview

VectorCraft is a Rust vector-illustration application with desktop, browser, command-line, and agent-driven entry points. The principal editing flow is pointer or command input, tool actions, engine operations on artwork, rendering, and export. The README documents broad illustration, typography, effects, color, and file-format capabilities; the graph preserves these alongside MCP and web access. Some domain links are documented rather than visible in sampled implementation, so those edges are dashed and uncited; unsampled subsystems are represented only where the tree supports a path.

Main entry points: [`crates/engine/src/cmd`](https://github.com/storytold/vectorcraft/tree/main/crates/engine/src/cmd) (Command engine), [`crates/render/src/lib.rs`](https://github.com/storytold/vectorcraft/blob/main/crates/render/src/lib.rs) (Renderer), [`crates/ui-egui/src`](https://github.com/storytold/vectorcraft/tree/main/crates/ui-egui/src) (Editing UI), [`apps/vectorcraft/src/main.rs`](https://github.com/storytold/vectorcraft/blob/main/apps/vectorcraft/src/main.rs) (Desktop app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry points"]
  node_desktop["Desktop app<br/>[main.rs]"]
  node_browser["Browser app<br/>[web.rs]"]
  node_cli["CLI<br/>[main.rs]"]
end

subgraph group_editing["Editing and document"]
  node_ui["Editing UI"]
  node_tools["Gesture tools"]
  node_engine["Command engine"]
  node_flatten["Flatten preview"]
  node_textui["Paragraph editing<br/>[paragraph.rs]"]
end

subgraph group_artwork["Artwork services"]
  node_text["Text layout<br/>[layout.rs]"]
  node_fontdb[("Font database<br/>[fontdb.rs]")]
  node_effects["Live effects<br/>[lib.rs]"]
  node_color["Color management<br/>[lib.rs]"]
  node_render["Renderer<br/>[lib.rs]"]
  node_svgimport["SVG import<br/>[import.rs]"]
  node_svgexport["SVG export<br/>[export.rs]"]
  node_fileio["Document file I/O"]
  node_webexport["Image encoders<br/>[mod.rs]"]
end

subgraph group_interfaces["Agent interfaces"]
  node_mcp["MCP server<br/>[server.rs]"]
  node_mcptools["MCP tools<br/>[tools.rs]"]
  node_control["JSON control<br/>[control_server.rs]"]
end

node_artist(("Artist"))

node_artist -->|"edits in"| node_desktop
node_artist -->|"edits in"| node_browser
node_desktop -.->|"hosts UI"| node_ui
node_browser -->|"shares UI"| node_ui
node_ui -.->|"sends gestures"| node_tools
node_tools -->|"emits actions"| node_engine
node_engine -.->|"updates artwork"| node_render
node_render -->|"encodes output"| node_webexport
node_engine -.->|"runs file commands"| node_fileio
node_artist -->|"runs batch jobs"| node_cli
node_cli -->|"exports artwork"| node_render
node_desktop -->|"starts channel"| node_control
node_control -.->|"dispatches commands"| node_engine
node_artist -->|"requests edits"| node_mcp
node_mcp -->|"dispatches tools"| node_mcptools
node_mcptools -->|"uses command API"| node_engine
node_ui -.->|"shows panel"| node_textui
node_textui -.->|"uses text layout"| node_text
node_text -->|"queries fonts"| node_fontdb
node_flatten -->|"requests preview"| node_engine
node_engine -.->|"applies effects"| node_effects
node_render -->|"evaluates appearance"| node_effects
node_render -->|"converts colors"| node_color
node_engine -.->|"imports SVG"| node_svgimport
node_engine -.->|"exports SVG"| node_svgexport

click node_desktop "https://github.com/storytold/vectorcraft/blob/main/apps/vectorcraft/src/main.rs"
click node_browser "https://github.com/storytold/vectorcraft/blob/main/apps/vectorcraft-web/src/web.rs"
click node_cli "https://github.com/storytold/vectorcraft/blob/main/apps/vectorcraft-cli/src/main.rs"
click node_ui "https://github.com/storytold/vectorcraft/tree/main/crates/ui-egui/src"
click node_tools "https://github.com/storytold/vectorcraft/tree/main/crates/tools/src"
click node_engine "https://github.com/storytold/vectorcraft/tree/main/crates/engine/src/cmd"
click node_flatten "https://github.com/storytold/vectorcraft/blob/main/crates/ui-egui/src/panels/flattener_preview.rs"
click node_textui "https://github.com/storytold/vectorcraft/blob/main/crates/ui-egui/src/panels/paragraph.rs"
click node_text "https://github.com/storytold/vectorcraft/blob/main/crates/text/src/layout.rs"
click node_fontdb "https://github.com/storytold/vectorcraft/blob/main/crates/text/src/fontdb.rs"
click node_effects "https://github.com/storytold/vectorcraft/blob/main/crates/effects/src/lib.rs"
click node_color "https://github.com/storytold/vectorcraft/blob/main/crates/color/src/lib.rs"
click node_render "https://github.com/storytold/vectorcraft/blob/main/crates/render/src/lib.rs"
click node_svgimport "https://github.com/storytold/vectorcraft/blob/main/crates/svg/src/import.rs"
click node_svgexport "https://github.com/storytold/vectorcraft/blob/main/crates/svg/src/export.rs"
click node_fileio "https://github.com/storytold/vectorcraft/tree/main/crates/engine/src/cmd/fileio"
click node_mcp "https://github.com/storytold/vectorcraft/blob/main/crates/mcp/src/server.rs"
click node_mcptools "https://github.com/storytold/vectorcraft/blob/main/crates/mcp/src/tools.rs"
click node_control "https://github.com/storytold/vectorcraft/blob/main/apps/vectorcraft/src/control_server.rs"
click node_webexport "https://github.com/storytold/vectorcraft/blob/main/crates/render/src/encode/mod.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_desktop,node_browser,node_cli toneBlue
class node_ui,node_tools,node_engine,node_flatten,node_textui toneAmber
class node_text,node_fontdb,node_effects,node_color,node_render,node_svgimport,node_svgexport,node_fileio,node_webexport toneMint
class node_mcp,node_mcptools,node_control toneRose
class node_artist toneIndigo
```

## Components

### App entry points

- [Desktop app](https://github.com/storytold/vectorcraft/blob/main/apps/vectorcraft/src/main.rs): `apps/vectorcraft/src/main.rs`
- [Browser app](https://github.com/storytold/vectorcraft/blob/main/apps/vectorcraft-web/src/web.rs): `apps/vectorcraft-web/src/web.rs`
- [CLI](https://github.com/storytold/vectorcraft/blob/main/apps/vectorcraft-cli/src/main.rs): `apps/vectorcraft-cli/src/main.rs`

### Editing and document

- [Editing UI](https://github.com/storytold/vectorcraft/tree/main/crates/ui-egui/src): `crates/ui-egui/src`
- [Gesture tools](https://github.com/storytold/vectorcraft/tree/main/crates/tools/src): `crates/tools/src`
- [Command engine](https://github.com/storytold/vectorcraft/tree/main/crates/engine/src/cmd): `crates/engine/src/cmd`
- [Flatten preview](https://github.com/storytold/vectorcraft/blob/main/crates/ui-egui/src/panels/flattener_preview.rs): `crates/ui-egui/src/panels/flattener_preview.rs`
- [Paragraph editing](https://github.com/storytold/vectorcraft/blob/main/crates/ui-egui/src/panels/paragraph.rs): `crates/ui-egui/src/panels/paragraph.rs`

### Artwork services

- [Text layout](https://github.com/storytold/vectorcraft/blob/main/crates/text/src/layout.rs): `crates/text/src/layout.rs`
- [Font database](https://github.com/storytold/vectorcraft/blob/main/crates/text/src/fontdb.rs): `crates/text/src/fontdb.rs`
- [Live effects](https://github.com/storytold/vectorcraft/blob/main/crates/effects/src/lib.rs): `crates/effects/src/lib.rs`
- [Color management](https://github.com/storytold/vectorcraft/blob/main/crates/color/src/lib.rs): `crates/color/src/lib.rs`
- [Renderer](https://github.com/storytold/vectorcraft/blob/main/crates/render/src/lib.rs): `crates/render/src/lib.rs`
- [SVG import](https://github.com/storytold/vectorcraft/blob/main/crates/svg/src/import.rs): `crates/svg/src/import.rs`
- [SVG export](https://github.com/storytold/vectorcraft/blob/main/crates/svg/src/export.rs): `crates/svg/src/export.rs`
- [Document file I/O](https://github.com/storytold/vectorcraft/tree/main/crates/engine/src/cmd/fileio): `crates/engine/src/cmd/fileio`
- [Image encoders](https://github.com/storytold/vectorcraft/blob/main/crates/render/src/encode/mod.rs): `crates/render/src/encode/mod.rs`

### Agent interfaces

- [MCP server](https://github.com/storytold/vectorcraft/blob/main/crates/mcp/src/server.rs): `crates/mcp/src/server.rs`
- [MCP tools](https://github.com/storytold/vectorcraft/blob/main/crates/mcp/src/tools.rs): `crates/mcp/src/tools.rs`
- [JSON control](https://github.com/storytold/vectorcraft/blob/main/apps/vectorcraft/src/control_server.rs): `apps/vectorcraft/src/control_server.rs`

### Other components

- **Artist**

## Connections

- Artist → Desktop app: edits in (evidence: `README.md`)
- Artist → Browser app: edits in (evidence: `README.md`)
- Desktop app → Editing UI: hosts UI
- Browser app → Editing UI: shares UI (evidence: `README.md`)
- Editing UI → Gesture tools: sends gestures
- Gesture tools → Command engine: emits actions (evidence: `crates/tools/src/lib.rs`)
- Command engine → Renderer: updates artwork
- Renderer → Image encoders: encodes output (evidence: `crates/render/src/encode/mod.rs`)
- Command engine → Document file I/O: runs file commands
- Artist → CLI: runs batch jobs (evidence: `README.md`)
- CLI → Renderer: exports artwork (evidence: `README.md`)
- Desktop app → JSON control: starts channel (evidence: `apps/vectorcraft/src/main.rs`)
- JSON control → Command engine: dispatches commands
- Artist → MCP server: requests edits (evidence: `README.md`)
- MCP server → MCP tools: dispatches tools (evidence: `crates/mcp/src/server.rs`)
- MCP tools → Command engine: uses command API (evidence: `README.md`)
- Editing UI → Paragraph editing: shows panel (evidence: `crates/ui-egui/src/panels/paragraph.rs`)
- Paragraph editing → Text layout: uses text layout
- Text layout → Font database: queries fonts (evidence: `crates/text/src/lib.rs`)
- Flatten preview → Command engine: requests preview (evidence: `crates/ui-egui/src/panels/flattener_preview.rs`)
- Command engine → Live effects: applies effects
- Renderer → Live effects: evaluates appearance (evidence: `crates/render/src/lib.rs`)
- Renderer → Color management: converts colors (evidence: `crates/color/src/lib.rs`)
- Command engine → SVG import: imports SVG
- Command engine → SVG export: exports SVG
