# storytold/anicraft architecture

> Architecture diagram of the GitHub repository storytold/anicraft, 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/storytold/anicraft
- Repository: https://github.com/storytold/anicraft

## Overview

AniCraft is a native and WebAssembly 2D vector animation editor. An artist edits a document through the shell’s stage, tools, and timeline; actions are engine commands applied to a session, and the stage is rendered from the resulting document state. The repository also supports file import/export, command-line and agent access, plugins, and audio. The graph combines README-documented product capabilities with source-index references and excerpts; several subsystem links are dashed where implementation call sites were not shown.

Main entry points: [`src/app.rs`](https://github.com/storytold/anicraft/blob/main/src/app.rs) (Editor shell), [`crates/engine/src/lib.rs`](https://github.com/storytold/anicraft/blob/main/crates/engine/src/lib.rs) (Session commands), [`crates/engine/src/render_service.rs`](https://github.com/storytold/anicraft/blob/main/crates/engine/src/render_service.rs) (Render worker), [`src/stage.rs`](https://github.com/storytold/anicraft/blob/main/src/stage.rs) (Stage and tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_editor["Editor shell"]
  node_shell["Editor shell<br/>[app.rs]"]
  node_stage["Stage and tools<br/>[stage.rs]"]
  node_timeline["Timeline and panels<br/>[timeline.rs]"]
  node_dock["Dock and workspaces<br/>[dock_ui.rs]"]
  node_prefs["Preferences<br/>[prefs.rs]"]
end

subgraph group_engine["Animation engine"]
  node_session["Session commands<br/>[lib.rs]"]
  node_editing["Editing and history<br/>[editing.rs]"]
  node_animation["Timeline evaluation<br/>[anim.rs]"]
  node_render_service["Render worker<br/>[render_service.rs]"]
  node_document[("Animation document<br/>[lib.rs]")]
end

subgraph group_render["Rendering and geometry"]
  node_geometry["Vector geometry<br/>[brush.rs]"]
  node_renderer["CPU renderer<br/>[lib.rs]"]
  node_gpu["GPU rendering<br/>[lib.rs]"]
end

subgraph group_formats["Files and integrations"]
  node_file_commands["Document file commands<br/>[cmds_file.rs]"]
  node_xfl["Animate import<br/>[import.rs]"]
  node_exports["Animation exports<br/>[lib.rs]"]
  node_plugins["Plugin runtime<br/>[runtime.rs]"]
  node_audio["Audio playback<br/>[lib.rs]"]
end

subgraph group_interfaces["Other interfaces"]
  node_cli["CLI and MCP<br/>[lib.rs]"]
  node_guide["User guide<br/>[lib.rs]"]
end

node_artist(("Artist"))

node_artist -->|"edits in"| node_shell
node_shell -->|"shows"| node_stage
node_shell -->|"shows"| node_timeline
node_shell -->|"uses"| node_dock
node_shell -->|"loads"| node_prefs
node_shell -->|"executes commands"| node_session
node_stage -.->|"issues commands"| node_session
node_timeline -.->|"issues commands"| node_session
node_session -->|"delegates edits"| node_editing
node_editing -.->|"updates"| node_document
node_session -.->|"evaluates frames"| node_animation
node_shell -.->|"requests tiles"| node_render_service
node_render_service -.->|"renders jobs"| node_renderer
node_renderer -.->|"uses geometry"| node_geometry
node_render_service -.->|"selects renderer"| node_gpu
node_shell -.->|"opens and saves"| node_file_commands
node_file_commands -.->|"imports Animate files"| node_xfl
node_shell -.->|"requests exports"| node_exports
node_session -.->|"dispatches plugin commands"| node_plugins
node_session -.->|"handles sound"| node_audio
node_artist -->|"drives commands"| node_cli
node_cli -->|"uses same engine"| node_session
node_shell -.->|"opens contextual help"| node_guide

click node_shell "https://github.com/storytold/anicraft/blob/main/src/app.rs"
click node_stage "https://github.com/storytold/anicraft/blob/main/src/stage.rs"
click node_timeline "https://github.com/storytold/anicraft/blob/main/src/timeline.rs"
click node_dock "https://github.com/storytold/anicraft/blob/main/src/dock_ui.rs"
click node_prefs "https://github.com/storytold/anicraft/blob/main/src/prefs.rs"
click node_session "https://github.com/storytold/anicraft/blob/main/crates/engine/src/lib.rs"
click node_editing "https://github.com/storytold/anicraft/blob/main/crates/engine/src/editing.rs"
click node_animation "https://github.com/storytold/anicraft/blob/main/crates/engine/src/anim.rs"
click node_render_service "https://github.com/storytold/anicraft/blob/main/crates/engine/src/render_service.rs"
click node_geometry "https://github.com/storytold/anicraft/blob/main/crates/geom/src/brush.rs"
click node_renderer "https://github.com/storytold/anicraft/blob/main/crates/render/src/lib.rs"
click node_gpu "https://github.com/storytold/anicraft/blob/main/crates/gpu/src/lib.rs"
click node_file_commands "https://github.com/storytold/anicraft/blob/main/crates/engine/src/cmds_file.rs"
click node_xfl "https://github.com/storytold/anicraft/blob/main/crates/xfl/src/import.rs"
click node_exports "https://github.com/storytold/anicraft/blob/main/crates/render/src/lib.rs"
click node_plugins "https://github.com/storytold/anicraft/blob/main/crates/plugins/src/runtime.rs"
click node_audio "https://github.com/storytold/anicraft/blob/main/crates/audio/src/lib.rs"
click node_cli "https://github.com/storytold/anicraft/blob/main/crates/cli/src/lib.rs"
click node_guide "https://github.com/storytold/anicraft/blob/main/crates/guide/src/lib.rs"
click node_document "https://github.com/storytold/anicraft/blob/main/crates/engine/src/lib.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_shell,node_stage,node_timeline,node_dock,node_prefs toneBlue
class node_session,node_editing,node_animation,node_render_service,node_document toneAmber
class node_geometry,node_renderer,node_gpu toneMint
class node_file_commands,node_xfl,node_exports,node_plugins,node_audio toneRose
class node_cli,node_guide,node_artist toneIndigo
```

## Components

### Editor shell

- [Editor shell](https://github.com/storytold/anicraft/blob/main/src/app.rs): `src/app.rs`
- [Stage and tools](https://github.com/storytold/anicraft/blob/main/src/stage.rs): `src/stage.rs`
- [Timeline and panels](https://github.com/storytold/anicraft/blob/main/src/timeline.rs): `src/timeline.rs`
- [Dock and workspaces](https://github.com/storytold/anicraft/blob/main/src/dock_ui.rs): `src/dock_ui.rs`
- [Preferences](https://github.com/storytold/anicraft/blob/main/src/prefs.rs): `src/prefs.rs`

### Animation engine

- [Session commands](https://github.com/storytold/anicraft/blob/main/crates/engine/src/lib.rs): `crates/engine/src/lib.rs`
- [Editing and history](https://github.com/storytold/anicraft/blob/main/crates/engine/src/editing.rs): `crates/engine/src/editing.rs`
- [Timeline evaluation](https://github.com/storytold/anicraft/blob/main/crates/engine/src/anim.rs): `crates/engine/src/anim.rs`
- [Render worker](https://github.com/storytold/anicraft/blob/main/crates/engine/src/render_service.rs): `crates/engine/src/render_service.rs`
- [Animation document](https://github.com/storytold/anicraft/blob/main/crates/engine/src/lib.rs): `crates/engine/src/lib.rs`

### Rendering and geometry

- [Vector geometry](https://github.com/storytold/anicraft/blob/main/crates/geom/src/brush.rs): `crates/geom/src/brush.rs`
- [CPU renderer](https://github.com/storytold/anicraft/blob/main/crates/render/src/lib.rs): `crates/render/src/lib.rs`
- [GPU rendering](https://github.com/storytold/anicraft/blob/main/crates/gpu/src/lib.rs): `crates/gpu/src/lib.rs`

### Files and integrations

- [Document file commands](https://github.com/storytold/anicraft/blob/main/crates/engine/src/cmds_file.rs): `crates/engine/src/cmds_file.rs`
- [Animate import](https://github.com/storytold/anicraft/blob/main/crates/xfl/src/import.rs): `crates/xfl/src/import.rs`
- [Animation exports](https://github.com/storytold/anicraft/blob/main/crates/render/src/lib.rs): `crates/render/src/lib.rs`
- [Plugin runtime](https://github.com/storytold/anicraft/blob/main/crates/plugins/src/runtime.rs): `crates/plugins/src/runtime.rs`
- [Audio playback](https://github.com/storytold/anicraft/blob/main/crates/audio/src/lib.rs): `crates/audio/src/lib.rs`

### Other interfaces

- [CLI and MCP](https://github.com/storytold/anicraft/blob/main/crates/cli/src/lib.rs): `crates/cli/src/lib.rs`
- [User guide](https://github.com/storytold/anicraft/blob/main/crates/guide/src/lib.rs): `crates/guide/src/lib.rs`

### Other components

- **Artist**

## Connections

- Artist → Editor shell: edits in (evidence: `README.md`)
- Editor shell → Stage and tools: shows (evidence: `src/app.rs`)
- Editor shell → Timeline and panels: shows (evidence: `src/app.rs`)
- Editor shell → Dock and workspaces: uses (evidence: `src/app.rs`)
- Editor shell → Preferences: loads (evidence: `src/app.rs`)
- Editor shell → Session commands: executes commands (evidence: `src/app.rs`)
- Stage and tools → Session commands: issues commands
- Timeline and panels → Session commands: issues commands
- Session commands → Editing and history: delegates edits (evidence: `crates/engine/src/lib.rs`)
- Editing and history → Animation document: updates (evidence: `crates/engine/src/lib.rs`)
- Session commands → Timeline evaluation: evaluates frames (evidence: `crates/engine/src/lib.rs`)
- Editor shell → Render worker: requests tiles
- Render worker → CPU renderer: renders jobs
- CPU renderer → Vector geometry: uses geometry
- Render worker → GPU rendering: selects renderer
- Editor shell → Document file commands: opens and saves
- Document file commands → Animate import: imports Animate files
- Editor shell → Animation exports: requests exports
- Session commands → Plugin runtime: dispatches plugin commands
- Session commands → Audio playback: handles sound
- Artist → CLI and MCP: drives commands (evidence: `README.md`)
- CLI and MCP → Session commands: uses same engine (evidence: `README.md`)
- Editor shell → User guide: opens contextual help
