# bohatman/rustflow-draw architecture

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

- Interactive diagram: https://gitdiagram.com/bohatman/rustflow-draw
- Repository: https://github.com/bohatman/rustflow-draw

## Overview

Bohat Draw.io is a cross-platform diagramming studio. Users create and edit diagrams in the native or WebAssembly studio, work with symbols and canvas interactions, then export or copy results; collaboration can connect studio clients through the server. The graph also preserves documented layout, file-format, rendering, and collaboration capabilities. The README and sampled source support the main workflow, but several engine and server internals were not excerpted, so their internal call paths are not asserted.

Main entry points: [`apps/studio/src/app.rs`](https://github.com/bohatman/rustflow-draw/blob/main/apps/studio/src/app.rs) (Studio app), [`crates/core/src/scene.rs`](https://github.com/bohatman/rustflow-draw/blob/main/crates/core/src/scene.rs) (Scene graph), [`apps/studio/src/panels.rs`](https://github.com/bohatman/rustflow-draw/blob/main/apps/studio/src/panels.rs) (Studio panels), [`apps/studio/src/canvas.rs`](https://github.com/bohatman/rustflow-draw/blob/main/apps/studio/src/canvas.rs) (Interactive canvas)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_studio["Studio experience"]
  node_studio_app["Studio app<br/>[app.rs]"]
  node_studio_canvas["Interactive canvas<br/>[canvas.rs]"]
  node_studio_panels["Studio panels<br/>[panels.rs]"]
  node_studio_theme["Theme and icons<br/>[theme.rs]"]
  node_studio_platform["Platform services<br/>[platform.rs]"]
  node_desktop_web["Native and web entry<br/>[main.rs]"]
end

subgraph group_engine["Diagram engine"]
  node_scene["Scene graph<br/>[scene.rs]"]
  node_commands["Undo and commands<br/>[command.rs]"]
  node_selection["Selection tools<br/>[selection.rs]"]
  node_document["Document model<br/>[document.rs]"]
  node_crdt["CRDT state<br/>[crdt.rs]"]
  node_spatial["Spatial index<br/>[spatial.rs]"]
  node_plugins["Plugin hooks<br/>[plugin.rs]"]
  node_telemetry["Telemetry<br/>[telemetry.rs]"]
end

subgraph group_visual["Visual assets"]
  node_palette["Symbol catalog<br/>[palette.rs]"]
  node_inspector["Inspector bridge<br/>[inspector.rs]"]
  node_renderer["Diagram renderer<br/>[lib.rs]"]
  node_raster["Raster export<br/>[raster.rs]"]
end

subgraph group_collaboration["Collaboration"]
  node_collab_client["Collaboration client<br/>[collab.rs]"]
  node_protocol["Collaboration protocol<br/>[lib.rs]"]
  node_server_entry["Server entry<br/>[main.rs]"]
  node_server["HTTP and WebSocket server<br/>[lib.rs]"]
end

subgraph group_delivery["Export and layout"]
  node_formats["Import and export<br/>[lib.rs]"]
  node_layout["Diagram layout<br/>[lib.rs]"]
end

node_user(("Diagram user"))

node_user -->|"launches"| node_desktop_web
node_desktop_web -->|"starts"| node_studio_app
node_studio_app -->|"renders"| node_studio_canvas
node_studio_app -->|"renders"| node_studio_panels
node_studio_app -->|"applies"| node_studio_theme
node_studio_app -->|"connects and sends"| node_collab_client
node_studio_panels -->|"connects"| node_collab_client
node_studio_canvas -->|"draws with"| node_studio_theme
node_studio_panels -->|"draws with"| node_studio_theme
node_studio_app -->|"imports and exports"| node_formats
node_studio_app -->|"uses"| node_studio_platform
node_studio_app -->|"edits"| node_scene
node_studio_canvas -->|"renders and interacts"| node_scene
node_studio_panels -->|"browses symbols"| node_palette
node_studio_panels -.->|"uses"| node_inspector
node_studio_canvas -.->|"uses"| node_renderer
node_renderer -->|"rasterizes"| node_raster
node_scene -->|"indexes"| node_spatial
node_commands -->|"updates"| node_scene
node_selection -->|"executes"| node_commands
node_selection -->|"queries"| node_scene
node_document -->|"contains"| node_scene
node_document -->|"uses"| node_commands
node_document -->|"uses"| node_selection
node_crdt -->|"synchronizes"| node_scene
node_plugins -->|"extends"| node_scene
node_telemetry -->|"observes"| node_scene
node_studio_app -.->|"arranges"| node_layout
node_studio_app -.->|"exports images"| node_renderer
node_studio_app -->|"exports diagram formats"| node_formats
node_user -->|"copies selection"| node_studio_app
node_studio_app -.->|"copies image"| node_studio_platform
node_desktop_web -->|"runs server"| node_server
node_server_entry -.->|"starts"| node_server
node_server -->|"serves WebSocket sync"| node_collab_client
node_collab_client -.->|"uses messages"| node_protocol

click node_studio_app "https://github.com/bohatman/rustflow-draw/blob/main/apps/studio/src/app.rs"
click node_studio_canvas "https://github.com/bohatman/rustflow-draw/blob/main/apps/studio/src/canvas.rs"
click node_studio_panels "https://github.com/bohatman/rustflow-draw/blob/main/apps/studio/src/panels.rs"
click node_studio_theme "https://github.com/bohatman/rustflow-draw/blob/main/apps/studio/src/theme.rs"
click node_studio_platform "https://github.com/bohatman/rustflow-draw/blob/main/apps/studio/src/platform.rs"
click node_desktop_web "https://github.com/bohatman/rustflow-draw/blob/main/apps/studio/src/main.rs"
click node_scene "https://github.com/bohatman/rustflow-draw/blob/main/crates/core/src/scene.rs"
click node_commands "https://github.com/bohatman/rustflow-draw/blob/main/crates/core/src/command.rs"
click node_selection "https://github.com/bohatman/rustflow-draw/blob/main/crates/core/src/selection.rs"
click node_document "https://github.com/bohatman/rustflow-draw/blob/main/crates/core/src/document.rs"
click node_crdt "https://github.com/bohatman/rustflow-draw/blob/main/crates/core/src/crdt.rs"
click node_spatial "https://github.com/bohatman/rustflow-draw/blob/main/crates/core/src/spatial.rs"
click node_plugins "https://github.com/bohatman/rustflow-draw/blob/main/crates/core/src/plugin.rs"
click node_telemetry "https://github.com/bohatman/rustflow-draw/blob/main/crates/core/src/telemetry.rs"
click node_palette "https://github.com/bohatman/rustflow-draw/blob/main/crates/ui-bridge/src/palette.rs"
click node_inspector "https://github.com/bohatman/rustflow-draw/blob/main/crates/ui-bridge/src/inspector.rs"
click node_renderer "https://github.com/bohatman/rustflow-draw/blob/main/crates/renderer/src/lib.rs"
click node_raster "https://github.com/bohatman/rustflow-draw/blob/main/crates/renderer/src/raster.rs"
click node_formats "https://github.com/bohatman/rustflow-draw/blob/main/crates/io-formats/src/lib.rs"
click node_layout "https://github.com/bohatman/rustflow-draw/blob/main/crates/layout/src/lib.rs"
click node_collab_client "https://github.com/bohatman/rustflow-draw/blob/main/apps/studio/src/collab.rs"
click node_protocol "https://github.com/bohatman/rustflow-draw/blob/main/crates/collab-protocol/src/lib.rs"
click node_server_entry "https://github.com/bohatman/rustflow-draw/blob/main/apps/server/src/main.rs"
click node_server "https://github.com/bohatman/rustflow-draw/blob/main/apps/server/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_studio_app,node_studio_canvas,node_studio_panels,node_studio_theme,node_studio_platform,node_desktop_web,node_user toneBlue
class node_scene,node_commands,node_selection,node_document,node_crdt,node_spatial,node_plugins,node_telemetry toneAmber
class node_palette,node_inspector,node_renderer,node_raster toneMint
class node_collab_client,node_protocol,node_server_entry,node_server toneRose
class node_formats,node_layout toneIndigo
```

## Components

### Studio experience

- [Studio app](https://github.com/bohatman/rustflow-draw/blob/main/apps/studio/src/app.rs): `apps/studio/src/app.rs`
- [Interactive canvas](https://github.com/bohatman/rustflow-draw/blob/main/apps/studio/src/canvas.rs): `apps/studio/src/canvas.rs`
- [Studio panels](https://github.com/bohatman/rustflow-draw/blob/main/apps/studio/src/panels.rs): `apps/studio/src/panels.rs`
- [Theme and icons](https://github.com/bohatman/rustflow-draw/blob/main/apps/studio/src/theme.rs): `apps/studio/src/theme.rs`
- [Platform services](https://github.com/bohatman/rustflow-draw/blob/main/apps/studio/src/platform.rs): `apps/studio/src/platform.rs`
- [Native and web entry](https://github.com/bohatman/rustflow-draw/blob/main/apps/studio/src/main.rs): `apps/studio/src/main.rs`

### Diagram engine

- [Scene graph](https://github.com/bohatman/rustflow-draw/blob/main/crates/core/src/scene.rs): `crates/core/src/scene.rs`
- [Undo and commands](https://github.com/bohatman/rustflow-draw/blob/main/crates/core/src/command.rs): `crates/core/src/command.rs`
- [Selection tools](https://github.com/bohatman/rustflow-draw/blob/main/crates/core/src/selection.rs): `crates/core/src/selection.rs`
- [Document model](https://github.com/bohatman/rustflow-draw/blob/main/crates/core/src/document.rs): `crates/core/src/document.rs`
- [CRDT state](https://github.com/bohatman/rustflow-draw/blob/main/crates/core/src/crdt.rs): `crates/core/src/crdt.rs`
- [Spatial index](https://github.com/bohatman/rustflow-draw/blob/main/crates/core/src/spatial.rs): `crates/core/src/spatial.rs`
- [Plugin hooks](https://github.com/bohatman/rustflow-draw/blob/main/crates/core/src/plugin.rs): `crates/core/src/plugin.rs`
- [Telemetry](https://github.com/bohatman/rustflow-draw/blob/main/crates/core/src/telemetry.rs): `crates/core/src/telemetry.rs`

### Visual assets

- [Symbol catalog](https://github.com/bohatman/rustflow-draw/blob/main/crates/ui-bridge/src/palette.rs): `crates/ui-bridge/src/palette.rs`
- [Inspector bridge](https://github.com/bohatman/rustflow-draw/blob/main/crates/ui-bridge/src/inspector.rs): `crates/ui-bridge/src/inspector.rs`
- [Diagram renderer](https://github.com/bohatman/rustflow-draw/blob/main/crates/renderer/src/lib.rs): `crates/renderer/src/lib.rs`
- [Raster export](https://github.com/bohatman/rustflow-draw/blob/main/crates/renderer/src/raster.rs): `crates/renderer/src/raster.rs`

### Collaboration

- [Collaboration client](https://github.com/bohatman/rustflow-draw/blob/main/apps/studio/src/collab.rs): `apps/studio/src/collab.rs`
- [Collaboration protocol](https://github.com/bohatman/rustflow-draw/blob/main/crates/collab-protocol/src/lib.rs): `crates/collab-protocol/src/lib.rs`
- [Server entry](https://github.com/bohatman/rustflow-draw/blob/main/apps/server/src/main.rs): `apps/server/src/main.rs`
- [HTTP and WebSocket server](https://github.com/bohatman/rustflow-draw/blob/main/apps/server/src/lib.rs): `apps/server/src/lib.rs`

### Export and layout

- [Import and export](https://github.com/bohatman/rustflow-draw/blob/main/crates/io-formats/src/lib.rs): `crates/io-formats/src/lib.rs`
- [Diagram layout](https://github.com/bohatman/rustflow-draw/blob/main/crates/layout/src/lib.rs): `crates/layout/src/lib.rs`

### Other components

- **Diagram user**

## Connections

- Diagram user → Native and web entry: launches (evidence: `README.md`)
- Native and web entry → Studio app: starts (evidence: `apps/studio/src/main.rs`)
- Studio app → Interactive canvas: renders (evidence: `apps/studio/src/app.rs`)
- Studio app → Studio panels: renders (evidence: `apps/studio/src/app.rs`)
- Studio app → Theme and icons: applies (evidence: `apps/studio/src/app.rs`)
- Studio app → Collaboration client: connects and sends (evidence: `apps/studio/src/app.rs`)
- Studio panels → Collaboration client: connects (evidence: `apps/studio/src/panels.rs`)
- Interactive canvas → Theme and icons: draws with (evidence: `apps/studio/src/canvas.rs`)
- Studio panels → Theme and icons: draws with (evidence: `apps/studio/src/panels.rs`)
- Studio app → Import and export: imports and exports (evidence: `apps/studio/src/app.rs`)
- Studio app → Platform services: uses (evidence: `apps/studio/src/app.rs`)
- Studio app → Scene graph: edits (evidence: `apps/studio/src/app.rs`)
- Interactive canvas → Scene graph: renders and interacts (evidence: `README.md`)
- Studio panels → Symbol catalog: browses symbols (evidence: `README.md`)
- Studio panels → Inspector bridge: uses
- Interactive canvas → Diagram renderer: uses
- Diagram renderer → Raster export: rasterizes (evidence: `crates/renderer/src/lib.rs`)
- Scene graph → Spatial index: indexes (evidence: `crates/core/src/scene.rs`)
- Undo and commands → Scene graph: updates (evidence: `crates/core/src/command.rs`)
- Selection tools → Undo and commands: executes (evidence: `crates/core/src/selection.rs`)
- Selection tools → Scene graph: queries (evidence: `crates/core/src/selection.rs`)
- Document model → Scene graph: contains (evidence: `crates/core/src/document.rs`)
- Document model → Undo and commands: uses (evidence: `crates/core/src/document.rs`)
- Document model → Selection tools: uses (evidence: `crates/core/src/document.rs`)
- CRDT state → Scene graph: synchronizes (evidence: `crates/core/src/crdt.rs`)
- Plugin hooks → Scene graph: extends (evidence: `crates/core/src/plugin.rs`)
- Telemetry → Scene graph: observes (evidence: `crates/core/src/telemetry.rs`)
- Studio app → Diagram layout: arranges
- Studio app → Diagram renderer: exports images
- Studio app → Import and export: exports diagram formats (evidence: `README.md`)
- Diagram user → Studio app: copies selection (evidence: `README.md`)
- Studio app → Platform services: copies image (evidence: `apps/studio/src/app.rs`)
- Native and web entry → HTTP and WebSocket server: runs server (evidence: `apps/studio/src/main.rs`)
- Server entry → HTTP and WebSocket server: starts
- HTTP and WebSocket server → Collaboration client: serves WebSocket sync (evidence: `README.md`)
- Collaboration client → Collaboration protocol: uses messages
