# shinshin86/mesh-avatar-studio architecture

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

- Interactive diagram: https://gitdiagram.com/shinshin86/mesh-avatar-studio
- Repository: https://github.com/shinshin86/mesh-avatar-studio

## Overview

Mesh Avatar Studio turns an illustration into a rigged, animated 2D avatar, then supports editing, preview, export/import, and camera-driven streaming. The main user workflow runs from opening a project through rig editing and preview to saving or sharing; agent-assisted avatar preparation and drawn-expression variants are separate authoring capabilities. Runtime modules provide mesh animation, rendering, lighting, and archive validation. Live tracking and the OBS stream view form another branch. Some links reflect README descriptions because the corresponding implementation excerpts were not provided.

Main entry points: [`src/editor/App.tsx`](https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/editor/App.tsx) (Editor workspace), [`packages/runtime/src/format/project-archive.ts`](https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/format/project-archive.ts) (Avatar archive), [`src/editor/Preview.tsx`](https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/editor/Preview.tsx) (Avatar preview), [`packages/runtime/src/engine/rig.js`](https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/engine/rig.js) (Avatar animation engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_studio["Editor &amp; Projects"]
  node_editor["Editor workspace<br/>[App.tsx]"]
  node_project_io["Project access<br/>[project.ts]"]
  node_project_server["Local project service<br/>[local-projects.ts]"]
  node_canvas["Rig editing canvas<br/>[EditorCanvas.tsx]"]
  node_preview["Avatar preview<br/>[Preview.tsx]"]
  node_transfer["Avatar transfer<br/>[AvatarTransfer.tsx]"]
  node_jobs["Layer rebuild jobs<br/>[project-jobs.ts]"]
end

subgraph group_runtime["Avatar Runtime"]
  node_rig["Rig model &amp; validation<br/>[validate.ts]"]
  node_engine["Avatar animation engine<br/>[rig.js]"]
  node_renderer["Mesh renderer<br/>[renderer.js]"]
  node_motion["Motion tracks<br/>[motions.js]"]
  node_archive["Avatar archive<br/>[project-archive.ts]"]
  node_manifest["Archive manifest<br/>[manifest.ts]"]
  node_archive_validation["Archive validation<br/>[validate.ts]"]
  node_zip["ZIP packing<br/>[zip.ts]"]
end

subgraph group_authoring["Avatar Authoring"]
  node_layer_authoring["Layer preparation<br/>[build-layers.py]"]
  node_variants["Drawn expression variants<br/>[VariantsPanel.tsx]"]
end

subgraph group_live["Live &amp; Streaming"]
  node_live_page["Live controls<br/>[LiveApp.tsx]"]
  node_tracking["Face tracking<br/>[tracking.ts]"]
  node_relay["Motion relay<br/>[live-relay.ts]"]
  node_stream["Stream avatar view<br/>[avatar-view.ts]"]
end

subgraph group_lighting["Lighting"]
  node_lighting_settings["Lighting settings<br/>[settings.ts]"]
  node_lighting_render["Lighting renderer<br/>[shading.ts]"]
  node_lighting_controls["Lighting controls<br/>[Controls.tsx]"]
end

node_user(("Studio user"))
node_agent(("Coding agent"))

node_user -->|"opens"| node_editor
node_editor -->|"opens projects"| node_project_io
node_project_io -->|"requests projects"| node_project_server
node_editor -->|"edits rig"| node_canvas
node_editor -->|"shows preview"| node_preview
node_editor -->|"imports exports"| node_transfer
node_editor -->|"requests rebuild"| node_jobs
node_agent -->|"prepares layers"| node_layer_authoring
node_agent -->|"creates variants"| node_variants
node_canvas -.->|"edits rig data"| node_rig
node_preview -->|"creates avatar"| node_engine
node_engine -.->|"renders mesh"| node_renderer
node_engine -.->|"applies motion"| node_motion
node_transfer -->|"imports exports"| node_archive
node_project_io -->|"opens archives"| node_archive
node_project_server -->|"uses archive format"| node_archive
node_archive -->|"uses manifest"| node_manifest
node_archive -->|"packs archive"| node_zip
node_zip -->|"validates files"| node_archive_validation
node_archive_validation -->|"validates rig"| node_rig
node_live_page -.->|"tracks face"| node_tracking
node_live_page -->|"sends motion"| node_relay
node_relay -.->|"relays motion"| node_stream
node_stream -.->|"animates avatar"| node_engine
node_preview -->|"offers controls"| node_lighting_controls
node_preview -->|"sets lighting"| node_lighting_settings
node_renderer -->|"shades mesh"| node_lighting_render
node_renderer -->|"parses settings"| node_lighting_settings
node_live_page -.->|"configures lighting"| node_lighting_controls

click node_editor "https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/editor/App.tsx"
click node_project_io "https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/editor/project.ts"
click node_project_server "https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/server/local-projects.ts"
click node_canvas "https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/editor/EditorCanvas.tsx"
click node_preview "https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/editor/Preview.tsx"
click node_transfer "https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/editor/AvatarTransfer.tsx"
click node_jobs "https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/server/project-jobs.ts"
click node_layer_authoring "https://github.com/shinshin86/mesh-avatar-studio/blob/main/tools/build-layers.py"
click node_variants "https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/editor/VariantsPanel.tsx"
click node_rig "https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/rig/validate.ts"
click node_engine "https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/engine/rig.js"
click node_renderer "https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/engine/renderer.js"
click node_motion "https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/engine/motions.js"
click node_archive "https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/format/project-archive.ts"
click node_manifest "https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/format/manifest.ts"
click node_archive_validation "https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/format/validate.ts"
click node_zip "https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/format/zip.ts"
click node_live_page "https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/live/LiveApp.tsx"
click node_tracking "https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/live/tracking.ts"
click node_relay "https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/server/live-relay.ts"
click node_stream "https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/live/avatar-view.ts"
click node_lighting_settings "https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/lighting/settings.ts"
click node_lighting_render "https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/lighting/shading.ts"
click node_lighting_controls "https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/lighting/Controls.tsx"

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_editor,node_project_io,node_project_server,node_canvas,node_preview,node_transfer,node_jobs,node_user toneBlue
class node_rig,node_engine,node_renderer,node_motion,node_archive,node_manifest,node_archive_validation,node_zip toneAmber
class node_layer_authoring,node_variants toneMint
class node_live_page,node_tracking,node_relay,node_stream toneRose
class node_lighting_settings,node_lighting_render,node_lighting_controls,node_agent toneIndigo
```

## Components

### Editor & Projects

- [Editor workspace](https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/editor/App.tsx): `src/editor/App.tsx`
- [Project access](https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/editor/project.ts): `src/editor/project.ts`
- [Local project service](https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/server/local-projects.ts): `src/server/local-projects.ts`
- [Rig editing canvas](https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/editor/EditorCanvas.tsx): `src/editor/EditorCanvas.tsx`
- [Avatar preview](https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/editor/Preview.tsx): `src/editor/Preview.tsx`
- [Avatar transfer](https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/editor/AvatarTransfer.tsx): `src/editor/AvatarTransfer.tsx`
- [Layer rebuild jobs](https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/server/project-jobs.ts): `src/server/project-jobs.ts`

### Avatar Runtime

- [Rig model & validation](https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/rig/validate.ts): `packages/runtime/src/rig/validate.ts`
- [Avatar animation engine](https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/engine/rig.js): `packages/runtime/src/engine/rig.js`
- [Mesh renderer](https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/engine/renderer.js): `packages/runtime/src/engine/renderer.js`
- [Motion tracks](https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/engine/motions.js): `packages/runtime/src/engine/motions.js`
- [Avatar archive](https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/format/project-archive.ts): `packages/runtime/src/format/project-archive.ts`
- [Archive manifest](https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/format/manifest.ts): `packages/runtime/src/format/manifest.ts`
- [Archive validation](https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/format/validate.ts): `packages/runtime/src/format/validate.ts`
- [ZIP packing](https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/format/zip.ts): `packages/runtime/src/format/zip.ts`

### Avatar Authoring

- [Layer preparation](https://github.com/shinshin86/mesh-avatar-studio/blob/main/tools/build-layers.py): `tools/build-layers.py`
- [Drawn expression variants](https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/editor/VariantsPanel.tsx): `src/editor/VariantsPanel.tsx`

### Live & Streaming

- [Live controls](https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/live/LiveApp.tsx): `src/live/LiveApp.tsx`
- [Face tracking](https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/live/tracking.ts): `src/live/tracking.ts`
- [Motion relay](https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/server/live-relay.ts): `src/server/live-relay.ts`
- [Stream avatar view](https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/live/avatar-view.ts): `src/live/avatar-view.ts`

### Lighting

- [Lighting settings](https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/lighting/settings.ts): `packages/runtime/src/lighting/settings.ts`
- [Lighting renderer](https://github.com/shinshin86/mesh-avatar-studio/blob/main/packages/runtime/src/lighting/shading.ts): `packages/runtime/src/lighting/shading.ts`
- [Lighting controls](https://github.com/shinshin86/mesh-avatar-studio/blob/main/src/lighting/Controls.tsx): `src/lighting/Controls.tsx`

### Other components

- **Studio user**
- **Coding agent**

## Connections

- Studio user → Editor workspace: opens (evidence: `README.md`)
- Editor workspace → Project access: opens projects (evidence: `src/editor/App.tsx`)
- Project access → Local project service: requests projects (evidence: `src/editor/project.ts`)
- Editor workspace → Rig editing canvas: edits rig (evidence: `src/editor/App.tsx`)
- Editor workspace → Avatar preview: shows preview (evidence: `src/editor/App.tsx`)
- Editor workspace → Avatar transfer: imports exports (evidence: `README.md`)
- Editor workspace → Layer rebuild jobs: requests rebuild (evidence: `README.md`)
- Coding agent → Layer preparation: prepares layers (evidence: `README.md`)
- Coding agent → Drawn expression variants: creates variants (evidence: `README.md`)
- Rig editing canvas → Rig model & validation: edits rig data
- Avatar preview → Avatar animation engine: creates avatar (evidence: `src/editor/Preview.tsx`)
- Avatar animation engine → Mesh renderer: renders mesh (evidence: `packages/runtime/src/engine/renderer.js`)
- Avatar animation engine → Motion tracks: applies motion
- Avatar transfer → Avatar archive: imports exports (evidence: `README.md`)
- Project access → Avatar archive: opens archives (evidence: `src/editor/project.ts`)
- Local project service → Avatar archive: uses archive format (evidence: `src/server/local-projects.ts`)
- Avatar archive → Archive manifest: uses manifest (evidence: `packages/runtime/src/format/project-archive.ts`)
- Avatar archive → ZIP packing: packs archive (evidence: `packages/runtime/src/format/project-archive.ts`)
- ZIP packing → Archive validation: validates files (evidence: `packages/runtime/src/format/zip.ts`)
- Archive validation → Rig model & validation: validates rig (evidence: `packages/runtime/src/format/validate.ts`)
- Live controls → Face tracking: tracks face
- Live controls → Motion relay: sends motion (evidence: `README.md`)
- Motion relay → Stream avatar view: relays motion
- Stream avatar view → Avatar animation engine: animates avatar
- Avatar preview → Lighting controls: offers controls (evidence: `src/editor/Preview.tsx`)
- Avatar preview → Lighting settings: sets lighting (evidence: `src/editor/Preview.tsx`)
- Mesh renderer → Lighting renderer: shades mesh (evidence: `packages/runtime/src/engine/renderer.js`)
- Mesh renderer → Lighting settings: parses settings (evidence: `packages/runtime/src/engine/renderer.js`)
- Live controls → Lighting controls: configures lighting
