# amagine-ai/amagine3d architecture

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

- Interactive diagram: https://gitdiagram.com/amagine-ai/amagine3d
- Repository: https://github.com/amagine-ai/amagine3d

## Overview

Amagine3D is a web-based, AI-assisted CAD workbench for turning hardware requirements, images, and dimensions into editable designs and manufacturing artifacts. Users submit a chat request, review iterative CAD generation and checks, inspect previews and reports, adjust parameters, then retrieve or export artifacts. The graph retains documented intent/scene authoring, CAD compilation, geometry validation, rendering, and manufacturing exports as distinct product stages. Some skill internals are unsampled; README capability descriptions support the broader branches, while uncertain implementation links are omitted.

Main entry points: [`packages/a3d-runtime/src/runtime.ts`](https://github.com/amagine-ai/amagine3d/blob/main/packages/a3d-runtime/src/runtime.ts) (Agent runtime), [`skills/a3d-public/authoring.py`](https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/authoring.py) (Intent authoring), [`src/components/CadWorkbench.tsx`](https://github.com/amagine-ai/amagine3d/blob/main/src/components/CadWorkbench.tsx) (CAD workbench), [`server/app.ts`](https://github.com/amagine-ai/amagine3d/blob/main/server/app.ts) (HTTP application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Workbench"]
  node_app["Workbench shell<br/>[App.tsx]"]
  node_workbench["CAD workbench<br/>[CadWorkbench.tsx]"]
  node_preview["Model preview<br/>[PreviewPanel.tsx]"]
  node_viewer["3D viewer<br/>[CadViewer.tsx]"]
  node_api["Agent API client<br/>[agent-api.ts]"]
end

subgraph group_server["Application server"]
  node_http["HTTP application<br/>[app.ts]"]
  node_chat["Chat route<br/>[chat.ts]"]
  node_rpc["Workbench RPC<br/>[router.ts]"]
  node_sessions[("Session management<br/>[sessions.ts]")]
  node_artifacts[("Artifact management<br/>[artifacts.ts]")]
end

subgraph group_runtime["Agent runtime"]
  node_runtime_core["Agent runtime<br/>[runtime.ts]"]
  node_search["Web search broker"]
end

subgraph group_design["Design and CAD"]
  node_intent["Intent authoring<br/>[authoring.py]"]
  node_intent_contract["Intent contract<br/>[intent_contract.py]"]
  node_scene["Semantic scene<br/>[scene_contract.py]"]
  node_build_session["Build session<br/>[build_session.py]"]
  node_compiler["CAD compiler<br/>[cad_compile.py]"]
  node_diagnostics["CAD diagnostics<br/>[cad_diagnostics.py]"]
  node_manifest["Build manifest<br/>[build_manifest.py]"]
end

subgraph group_outputs["Review and outputs"]
  node_render["Preview rendering<br/>[render_preview.py]"]
  node_export["3MF export<br/>[export_3mf.py]"]
  node_qa["Color and print QA<br/>[qa_check.py]"]
  node_storage[("Artifact storage<br/>[artifacts.ts]")]
end

node_user(("Hardware designer"))

node_user -->|"opens"| node_app
node_app -->|"renders"| node_workbench
node_workbench -->|"requests"| node_api
node_api -->|"calls"| node_http
node_http -->|"registers"| node_chat
node_http -->|"registers"| node_rpc
node_chat -->|"executes turns"| node_runtime_core
node_chat -->|"persists turns"| node_sessions
node_rpc -->|"reads sessions"| node_sessions
node_sessions -->|"scans artifacts"| node_artifacts
node_runtime_core -->|"uses broker"| node_search
node_user -.->|"supplies requirements"| node_intent
node_runtime_core -.->|"authors design"| node_intent
node_intent -->|"writes contract"| node_intent_contract
node_intent -->|"authors scene"| node_scene
node_runtime_core -.->|"runs design"| node_build_session
node_build_session -->|"uses authoring"| node_intent
node_build_session -.->|"builds geometry"| node_compiler
node_compiler -.->|"checks geometry"| node_diagnostics
node_compiler -.->|"records build"| node_manifest
node_runtime_core -.->|"requests preview"| node_render
node_render -.->|"provides preview"| node_preview
node_preview -->|"loads viewer"| node_viewer
node_runtime_core -.->|"exports geometry"| node_export
node_export -->|"supports checks"| node_qa
node_qa -->|"uses diagnostics"| node_diagnostics
node_runtime_core -.->|"saves artifacts"| node_storage
node_workbench -.->|"shows results"| node_preview
node_workbench -.->|"loads workspace"| node_rpc

click node_app "https://github.com/amagine-ai/amagine3d/blob/main/src/App.tsx"
click node_workbench "https://github.com/amagine-ai/amagine3d/blob/main/src/components/CadWorkbench.tsx"
click node_preview "https://github.com/amagine-ai/amagine3d/blob/main/src/components/cad-workbench/PreviewPanel.tsx"
click node_viewer "https://github.com/amagine-ai/amagine3d/blob/main/src/components/CadViewer.tsx"
click node_api "https://github.com/amagine-ai/amagine3d/blob/main/src/lib/agent-api.ts"
click node_http "https://github.com/amagine-ai/amagine3d/blob/main/server/app.ts"
click node_chat "https://github.com/amagine-ai/amagine3d/blob/main/server/routes/chat.ts"
click node_rpc "https://github.com/amagine-ai/amagine3d/blob/main/server/trpc/router.ts"
click node_sessions "https://github.com/amagine-ai/amagine3d/blob/main/server/sessions.ts"
click node_artifacts "https://github.com/amagine-ai/amagine3d/blob/main/server/artifacts.ts"
click node_runtime_core "https://github.com/amagine-ai/amagine3d/blob/main/packages/a3d-runtime/src/runtime.ts"
click node_search "https://github.com/amagine-ai/amagine3d/blob/main/packages/a3d-runtime/src/tavily-search-broker.ts"
click node_intent "https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/authoring.py"
click node_intent_contract "https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/intent_contract.py"
click node_scene "https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/scene_contract.py"
click node_build_session "https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/build_session.py"
click node_compiler "https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/cad_compile.py"
click node_diagnostics "https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/cad_diagnostics.py"
click node_manifest "https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/build_manifest.py"
click node_render "https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/render_preview.py"
click node_export "https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/color/export_3mf.py"
click node_qa "https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/color/qa_check.py"
click node_storage "https://github.com/amagine-ai/amagine3d/blob/main/server/artifacts.ts"

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_workbench,node_preview,node_viewer,node_api toneBlue
class node_http,node_chat,node_rpc,node_sessions,node_artifacts toneAmber
class node_runtime_core,node_search toneMint
class node_intent,node_intent_contract,node_scene,node_build_session,node_compiler,node_diagnostics,node_manifest toneRose
class node_render,node_export,node_qa,node_storage,node_user toneIndigo
```

## Components

### Workbench

- [Workbench shell](https://github.com/amagine-ai/amagine3d/blob/main/src/App.tsx): `src/App.tsx`
- [CAD workbench](https://github.com/amagine-ai/amagine3d/blob/main/src/components/CadWorkbench.tsx): `src/components/CadWorkbench.tsx`
- [Model preview](https://github.com/amagine-ai/amagine3d/blob/main/src/components/cad-workbench/PreviewPanel.tsx): `src/components/cad-workbench/PreviewPanel.tsx`
- [3D viewer](https://github.com/amagine-ai/amagine3d/blob/main/src/components/CadViewer.tsx): `src/components/CadViewer.tsx`
- [Agent API client](https://github.com/amagine-ai/amagine3d/blob/main/src/lib/agent-api.ts): `src/lib/agent-api.ts`

### Application server

- [HTTP application](https://github.com/amagine-ai/amagine3d/blob/main/server/app.ts): `server/app.ts`
- [Chat route](https://github.com/amagine-ai/amagine3d/blob/main/server/routes/chat.ts): `server/routes/chat.ts`
- [Workbench RPC](https://github.com/amagine-ai/amagine3d/blob/main/server/trpc/router.ts): `server/trpc/router.ts`
- [Session management](https://github.com/amagine-ai/amagine3d/blob/main/server/sessions.ts): `server/sessions.ts`
- [Artifact management](https://github.com/amagine-ai/amagine3d/blob/main/server/artifacts.ts): `server/artifacts.ts`

### Agent runtime

- [Agent runtime](https://github.com/amagine-ai/amagine3d/blob/main/packages/a3d-runtime/src/runtime.ts): `packages/a3d-runtime/src/runtime.ts`
- [Web search broker](https://github.com/amagine-ai/amagine3d/blob/main/packages/a3d-runtime/src/tavily-search-broker.ts): `packages/a3d-runtime/src/tavily-search-broker.ts`

### Design and CAD

- [Intent authoring](https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/authoring.py): `skills/a3d-public/authoring.py`
- [Intent contract](https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/intent_contract.py): `skills/a3d-public/intent_contract.py`
- [Semantic scene](https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/scene_contract.py): `skills/a3d-public/scene_contract.py`
- [Build session](https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/build_session.py): `skills/a3d-public/build_session.py`
- [CAD compiler](https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/cad_compile.py): `skills/a3d-public/cad_compile.py`
- [CAD diagnostics](https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/cad_diagnostics.py): `skills/a3d-public/cad_diagnostics.py`
- [Build manifest](https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/build_manifest.py): `skills/a3d-public/build_manifest.py`

### Review and outputs

- [Preview rendering](https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/render_preview.py): `skills/a3d-public/render_preview.py`
- [3MF export](https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/color/export_3mf.py): `skills/a3d-public/color/export_3mf.py`
- [Color and print QA](https://github.com/amagine-ai/amagine3d/blob/main/skills/a3d-public/color/qa_check.py): `skills/a3d-public/color/qa_check.py`
- [Artifact storage](https://github.com/amagine-ai/amagine3d/blob/main/server/artifacts.ts): `server/artifacts.ts`

### Other components

- **Hardware designer**

## Connections

- Hardware designer → Workbench shell: opens
- Workbench shell → CAD workbench: renders (evidence: `src/App.tsx`)
- CAD workbench → Agent API client: requests (evidence: `src/components/CadWorkbench.tsx`)
- Agent API client → HTTP application: calls (evidence: `src/lib/agent-api.ts`)
- HTTP application → Chat route: registers (evidence: `server/app.ts`)
- HTTP application → Workbench RPC: registers (evidence: `server/app.ts`)
- Chat route → Agent runtime: executes turns (evidence: `server/routes/chat.ts`)
- Chat route → Session management: persists turns (evidence: `server/routes/chat.ts`)
- Workbench RPC → Session management: reads sessions (evidence: `server/trpc/router.ts`)
- Session management → Artifact management: scans artifacts (evidence: `server/sessions.ts`)
- Agent runtime → Web search broker: uses broker (evidence: `packages/a3d-runtime/src/runtime.ts`)
- Hardware designer → Intent authoring: supplies requirements
- Agent runtime → Intent authoring: authors design
- Intent authoring → Intent contract: writes contract (evidence: `skills/a3d-public/authoring.py`)
- Intent authoring → Semantic scene: authors scene (evidence: `skills/a3d-public/authoring.py`)
- Agent runtime → Build session: runs design
- Build session → Intent authoring: uses authoring (evidence: `skills/a3d-public/build_session.py`)
- Build session → CAD compiler: builds geometry
- CAD compiler → CAD diagnostics: checks geometry
- CAD compiler → Build manifest: records build
- Agent runtime → Preview rendering: requests preview
- Preview rendering → Model preview: provides preview
- Model preview → 3D viewer: loads viewer (evidence: `src/components/cad-workbench/PreviewPanel.tsx`)
- Agent runtime → 3MF export: exports geometry
- 3MF export → Color and print QA: supports checks (evidence: `skills/a3d-public/color/qa_check.py`)
- Color and print QA → CAD diagnostics: uses diagnostics
- Agent runtime → Artifact storage: saves artifacts
- CAD workbench → Model preview: shows results (evidence: `src/components/CadWorkbench.tsx`)
- CAD workbench → Workbench RPC: loads workspace (evidence: `src/components/CadWorkbench.tsx`)
