# exmachina100/witness-3d architecture

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

- Interactive diagram: https://gitdiagram.com/exmachina100/witness-3d
- Repository: https://github.com/exmachina100/witness-3d

## Overview

Witness 3D is a direct-modeling CAD application built around exact OpenCascade geometry, with browser and Tauri desktop front ends. The main workflow is selecting or drawing geometry, previewing and committing modeling operations, then organizing and saving the document or exporting it. The map preserves the documented curve, surface, solid, and interoperability capabilities. Some web and desktop wiring is unsampled; those relationships are omitted or marked unverified rather than inferred from names alone.

Main entry points: [`crates/w3d-kernel/src/document.rs`](https://github.com/exmachina100/witness-3d/blob/main/crates/w3d-kernel/src/document.rs) (Document), [`web/src/app/LocalBackend.js`](https://github.com/exmachina100/witness-3d/blob/main/web/src/app/LocalBackend.js) (Local Backend), [`web/src/app/App.js`](https://github.com/exmachina100/witness-3d/blob/main/web/src/app/App.js) (Web App), [`apps/desktop/ui/main.js`](https://github.com/exmachina100/witness-3d/blob/main/apps/desktop/ui/main.js) (Desktop UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Modeling UI"]
  node_desktop_ui["Desktop UI<br/>[main.js]"]
  node_web_app["Web App<br/>[App.js]"]
  node_ai_tools["AI Commands<br/>[ai.js]"]
end

subgraph group_webmodel["Browser Modeling"]
  node_web_backend["Local Backend<br/>[LocalBackend.js]"]
  node_web_kernel["Web Kernel<br/>[Kernel.js]"]
  node_forms["Curve Forms<br/>[Forms.js]"]
  node_surface_patch["Surface Patch<br/>[Patch.js]"]
  node_curve_edit["Curve Editing<br/>[curveEdit.js]"]
  node_curves["Curve Geometry<br/>[curves.js]"]
  node_project["Project Operations<br/>[Project.js]"]
end

subgraph group_kernel["Geometry Core"]
  node_engine["Model Engine<br/>[engine.rs]"]
  node_document[("Document<br/>[document.rs]")]
  node_extrude["Extrusion<br/>[extrude.rs]"]
  node_form_kernel["Form Operations<br/>[form.rs]"]
  node_blend["Fillet Chamfer<br/>[blend.rs]"]
  node_join["Join Operations<br/>[join.rs]"]
  node_solids["Solid Operations<br/>[solids.rs]"]
  node_native_file["W3D Files<br/>[file.rs]"]
end

subgraph group_desktop["Desktop Services"]
  node_rust_api["Desktop API<br/>[api.rs]"]
  node_bridge["Live Link Bridge<br/>[bridge.rs]"]
end

subgraph group_integrations["External Integrations"]
  node_blender["Blender Add-on"]
  node_cinema4d["Cinema 4D Plugin<br/>[w3d_link.py]"]
end

node_user(("CAD User"))
node_claude{{"Claude Service"}}

node_user -->|"models in"| node_desktop_ui
node_user -->|"models in"| node_web_app
node_desktop_ui -->|"mounts"| node_web_app
node_desktop_ui -->|"invokes"| node_rust_api
node_web_app -.->|"uses"| node_web_backend
node_web_backend -->|"calls"| node_web_kernel
node_web_backend -->|"uses"| node_forms
node_web_backend -->|"uses"| node_surface_patch
node_web_backend -->|"uses"| node_project
node_forms -->|"calls"| node_web_kernel
node_surface_patch -->|"calls"| node_web_kernel
node_forms -->|"uses"| node_curves
node_curve_edit -->|"uses"| node_curves
node_web_app -.->|"offers"| node_ai_tools
node_ai_tools -.->|"requests commands"| node_claude
node_rust_api -.->|"dispatches model calls"| node_engine
node_engine -->|"runs jobs on"| node_document
node_rust_api -->|"accesses"| node_document
node_document -->|"uses"| node_extrude
node_document -->|"uses"| node_form_kernel
node_document -->|"uses"| node_blend
node_document -->|"uses"| node_join
node_document -->|"uses"| node_solids
node_document -.->|"persists as"| node_native_file
node_bridge -->|"streams meshes"| node_blender
node_bridge -->|"streams meshes"| node_cinema4d
node_user -->|"installs add-on"| node_blender
node_user -->|"installs plugin"| node_cinema4d

click node_desktop_ui "https://github.com/exmachina100/witness-3d/blob/main/apps/desktop/ui/main.js"
click node_web_app "https://github.com/exmachina100/witness-3d/blob/main/web/src/app/App.js"
click node_ai_tools "https://github.com/exmachina100/witness-3d/blob/main/web/src/app/ai.js"
click node_web_backend "https://github.com/exmachina100/witness-3d/blob/main/web/src/app/LocalBackend.js"
click node_web_kernel "https://github.com/exmachina100/witness-3d/blob/main/web/src/Kernel.js"
click node_forms "https://github.com/exmachina100/witness-3d/blob/main/web/src/Forms.js"
click node_surface_patch "https://github.com/exmachina100/witness-3d/blob/main/web/src/Patch.js"
click node_curve_edit "https://github.com/exmachina100/witness-3d/blob/main/web/src/curveEdit.js"
click node_curves "https://github.com/exmachina100/witness-3d/blob/main/web/src/curves.js"
click node_project "https://github.com/exmachina100/witness-3d/blob/main/web/src/Project.js"
click node_rust_api "https://github.com/exmachina100/witness-3d/blob/main/apps/desktop/src-tauri/src/api.rs"
click node_bridge "https://github.com/exmachina100/witness-3d/blob/main/apps/desktop/src-tauri/src/bridge.rs"
click node_engine "https://github.com/exmachina100/witness-3d/blob/main/crates/w3d-kernel/src/engine.rs"
click node_document "https://github.com/exmachina100/witness-3d/blob/main/crates/w3d-kernel/src/document.rs"
click node_extrude "https://github.com/exmachina100/witness-3d/blob/main/crates/w3d-kernel/src/extrude.rs"
click node_form_kernel "https://github.com/exmachina100/witness-3d/blob/main/crates/w3d-kernel/src/form.rs"
click node_blend "https://github.com/exmachina100/witness-3d/blob/main/crates/w3d-kernel/src/blend.rs"
click node_join "https://github.com/exmachina100/witness-3d/blob/main/crates/w3d-kernel/src/join.rs"
click node_solids "https://github.com/exmachina100/witness-3d/blob/main/crates/w3d-kernel/src/solids.rs"
click node_native_file "https://github.com/exmachina100/witness-3d/blob/main/crates/w3d-kernel/src/file.rs"
click node_blender "https://github.com/exmachina100/witness-3d/blob/main/tools/blender/witness3d_bridge.py"
click node_cinema4d "https://github.com/exmachina100/witness-3d/blob/main/tools/cinema4d/Witness3DBridge/w3d_link.py"

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_ui,node_web_app,node_ai_tools,node_user toneBlue
class node_web_backend,node_web_kernel,node_forms,node_surface_patch,node_curve_edit,node_curves,node_project toneAmber
class node_engine,node_document,node_extrude,node_form_kernel,node_blend,node_join,node_solids,node_native_file toneMint
class node_rust_api,node_bridge toneRose
class node_blender,node_cinema4d,node_claude toneIndigo
```

## Components

### Modeling UI

- [Desktop UI](https://github.com/exmachina100/witness-3d/blob/main/apps/desktop/ui/main.js): `apps/desktop/ui/main.js`
- [Web App](https://github.com/exmachina100/witness-3d/blob/main/web/src/app/App.js): `web/src/app/App.js`
- [AI Commands](https://github.com/exmachina100/witness-3d/blob/main/web/src/app/ai.js): `web/src/app/ai.js`

### Browser Modeling

- [Local Backend](https://github.com/exmachina100/witness-3d/blob/main/web/src/app/LocalBackend.js): `web/src/app/LocalBackend.js`
- [Web Kernel](https://github.com/exmachina100/witness-3d/blob/main/web/src/Kernel.js): `web/src/Kernel.js`
- [Curve Forms](https://github.com/exmachina100/witness-3d/blob/main/web/src/Forms.js): `web/src/Forms.js`
- [Surface Patch](https://github.com/exmachina100/witness-3d/blob/main/web/src/Patch.js): `web/src/Patch.js`
- [Curve Editing](https://github.com/exmachina100/witness-3d/blob/main/web/src/curveEdit.js): `web/src/curveEdit.js`
- [Curve Geometry](https://github.com/exmachina100/witness-3d/blob/main/web/src/curves.js): `web/src/curves.js`
- [Project Operations](https://github.com/exmachina100/witness-3d/blob/main/web/src/Project.js): `web/src/Project.js`

### Geometry Core

- [Model Engine](https://github.com/exmachina100/witness-3d/blob/main/crates/w3d-kernel/src/engine.rs): `crates/w3d-kernel/src/engine.rs`
- [Document](https://github.com/exmachina100/witness-3d/blob/main/crates/w3d-kernel/src/document.rs): `crates/w3d-kernel/src/document.rs`
- [Extrusion](https://github.com/exmachina100/witness-3d/blob/main/crates/w3d-kernel/src/extrude.rs): `crates/w3d-kernel/src/extrude.rs`
- [Form Operations](https://github.com/exmachina100/witness-3d/blob/main/crates/w3d-kernel/src/form.rs): `crates/w3d-kernel/src/form.rs`
- [Fillet Chamfer](https://github.com/exmachina100/witness-3d/blob/main/crates/w3d-kernel/src/blend.rs): `crates/w3d-kernel/src/blend.rs`
- [Join Operations](https://github.com/exmachina100/witness-3d/blob/main/crates/w3d-kernel/src/join.rs): `crates/w3d-kernel/src/join.rs`
- [Solid Operations](https://github.com/exmachina100/witness-3d/blob/main/crates/w3d-kernel/src/solids.rs): `crates/w3d-kernel/src/solids.rs`
- [W3D Files](https://github.com/exmachina100/witness-3d/blob/main/crates/w3d-kernel/src/file.rs): `crates/w3d-kernel/src/file.rs`

### Desktop Services

- [Desktop API](https://github.com/exmachina100/witness-3d/blob/main/apps/desktop/src-tauri/src/api.rs): `apps/desktop/src-tauri/src/api.rs`
- [Live Link Bridge](https://github.com/exmachina100/witness-3d/blob/main/apps/desktop/src-tauri/src/bridge.rs): `apps/desktop/src-tauri/src/bridge.rs`

### External Integrations

- [Blender Add-on](https://github.com/exmachina100/witness-3d/blob/main/tools/blender/witness3d_bridge.py): `tools/blender/witness3d_bridge.py`
- [Cinema 4D Plugin](https://github.com/exmachina100/witness-3d/blob/main/tools/cinema4d/Witness3DBridge/w3d_link.py): `tools/cinema4d/Witness3DBridge/w3d_link.py`

### Other components

- **CAD User**
- **Claude Service**

## Connections

- CAD User → Desktop UI: models in (evidence: `README.md`)
- CAD User → Web App: models in (evidence: `README.md`)
- Desktop UI → Web App: mounts (evidence: `apps/desktop/ui/main.js`)
- Desktop UI → Desktop API: invokes (evidence: `apps/desktop/ui/main.js`)
- Web App → Local Backend: uses
- Local Backend → Web Kernel: calls (evidence: `web/src/app/LocalBackend.js`)
- Local Backend → Curve Forms: uses (evidence: `web/src/app/LocalBackend.js`)
- Local Backend → Surface Patch: uses (evidence: `web/src/app/LocalBackend.js`)
- Local Backend → Project Operations: uses (evidence: `web/src/app/LocalBackend.js`)
- Curve Forms → Web Kernel: calls (evidence: `web/src/Forms.js`)
- Surface Patch → Web Kernel: calls (evidence: `web/src/Patch.js`)
- Curve Forms → Curve Geometry: uses (evidence: `web/src/Forms.js`)
- Curve Editing → Curve Geometry: uses (evidence: `web/src/curveEdit.js`)
- Web App → AI Commands: offers
- AI Commands → Claude Service: requests commands (evidence: `README.md`)
- Desktop API → Model Engine: dispatches model calls
- Model Engine → Document: runs jobs on (evidence: `crates/w3d-kernel/src/engine.rs`)
- Desktop API → Document: accesses (evidence: `apps/desktop/src-tauri/src/api.rs`)
- Document → Extrusion: uses (evidence: `crates/w3d-kernel/src/document.rs`)
- Document → Form Operations: uses (evidence: `crates/w3d-kernel/src/document.rs`)
- Document → Fillet Chamfer: uses (evidence: `crates/w3d-kernel/src/document.rs`)
- Document → Join Operations: uses (evidence: `crates/w3d-kernel/src/document.rs`)
- Document → Solid Operations: uses (evidence: `crates/w3d-kernel/src/document.rs`)
- Document → W3D Files: persists as (evidence: `README.md`)
- Live Link Bridge → Blender Add-on: streams meshes (evidence: `apps/desktop/src-tauri/src/bridge.rs`)
- Live Link Bridge → Cinema 4D Plugin: streams meshes (evidence: `apps/desktop/src-tauri/src/bridge.rs`)
- CAD User → Blender Add-on: installs add-on (evidence: `README.md`)
- CAD User → Cinema 4D Plugin: installs plugin (evidence: `README.md`)
