# nexu-io/openmotion architecture

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

- Interactive diagram: https://gitdiagram.com/nexu-io/openmotion
- Repository: https://github.com/nexu-io/openmotion

## Overview

OpenMotion is an agentic video-recreation studio: a user asks a connected agent to create or recreate a video, the project is represented and edited in Studio, and the same project can be rendered to MP4. The README also describes templates, Motion.md, brand kits, media generation, project import, and review workflows. The graph combines those documented capabilities with sampled server routing and Studio behavior; links for unsampled subsystems are marked dashed with no evidence path rather than asserted as inspected calls.

Main entry points: [`server.ts`](https://github.com/nexu-io/openmotion/blob/main/server.ts) (HTTP server), [`editor-runtime.ts`](https://github.com/nexu-io/openmotion/blob/main/editor-runtime.ts) (Studio editor), [`mcp-tools.ts`](https://github.com/nexu-io/openmotion/blob/main/mcp-tools.ts) (MCP tools), [`mcp.ts`](https://github.com/nexu-io/openmotion/blob/main/mcp.ts) (MCP service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_creation["Agent creation"]
  node_mcp["MCP tools<br/>[mcp-tools.ts]"]
  node_mcpserver["MCP service<br/>[mcp.ts]"]
end

subgraph group_projects["Projects and assets"]
  node_workspace[("Workspace projects<br/>[workspace.ts]")]
  node_template["Template library"]
  node_brand["Brand kits<br/>[brand-kits.ts]"]
  node_assets["Project assets<br/>[asset-library.ts]"]
  node_archives["Project archives"]
end

subgraph group_studio["Studio editing"]
  node_studio["Studio editor<br/>[editor-runtime.ts]"]
  node_files["File manager<br/>[useFileManager.ts]"]
  node_timeline["Timeline editing"]
  node_keyframes["Keyframe editing"]
  node_grading["Color grading"]
  node_preview["Live preview"]
  node_review["Review comments"]
end

subgraph group_runtime["Runtime and services"]
  node_server["HTTP server<br/>[server.ts]"]
  node_gateway["Model gateway<br/>[service.ts]"]
  node_hyperframes["Hyperframes project<br/>[hyperframes.ts]"]
  node_render["Video rendering<br/>[server.ts]"]
end

subgraph group_capabilities["Product capabilities"]
  node_scenarios["Scenario runs<br/>[scenario-runs.ts]"]
  node_games["Game projects<br/>[game-projects.ts]"]
  node_design["Design projects<br/>[design-projects.ts]"]
  node_motionmd["Motion.md format<br/>[hyperframes.ts]"]
end

node_user(("Creator"))
node_agent(("Local agent"))

node_user -.->|"requests creation"| node_agent
node_agent -.->|"uses tools"| node_mcp
node_mcp -.->|"dispatches"| node_mcpserver
node_mcpserver -.->|"serves requests"| node_server
node_server -.->|"manages projects"| node_workspace
node_agent -.->|"starts from template"| node_template
node_agent -.->|"supplies brand kit"| node_brand
node_agent -.->|"generates media"| node_gateway
node_gateway -.->|"stores generated media"| node_assets
node_server -->|"routes archives"| node_archives
node_server -->|"routes asset requests"| node_assets
node_server -->|"routes scenarios"| node_scenarios
node_server -->|"routes game requests"| node_games
node_server -->|"routes design requests"| node_design
node_workspace -.->|"holds project"| node_hyperframes
node_user -.->|"opens project"| node_studio
node_studio -.->|"manages project files"| node_files
node_files -.->|"uploads and writes"| node_server
node_studio -.->|"edits timing"| node_timeline
node_timeline -.->|"edits keyframes"| node_keyframes
node_studio -.->|"adjusts color"| node_grading
node_studio -.->|"refreshes preview"| node_preview
node_user -.->|"reviews project"| node_review
node_studio -.->|"renders MP4"| node_render
node_server -->|"runs export jobs"| node_render
node_agent -.->|"authors shot plan"| node_motionmd

click node_mcp "https://github.com/nexu-io/openmotion/blob/main/mcp-tools.ts"
click node_mcpserver "https://github.com/nexu-io/openmotion/blob/main/mcp.ts"
click node_workspace "https://github.com/nexu-io/openmotion/blob/main/workspace.ts"
click node_template "https://github.com/nexu-io/openmotion/blob/main/shared/repository-template-catalog.ts"
click node_brand "https://github.com/nexu-io/openmotion/blob/main/gateway/brand-kits.ts"
click node_assets "https://github.com/nexu-io/openmotion/blob/main/gateway/asset-library.ts"
click node_archives "https://github.com/nexu-io/openmotion/blob/main/gateway/project-archive-http.ts"
click node_studio "https://github.com/nexu-io/openmotion/blob/main/editor-runtime.ts"
click node_files "https://github.com/nexu-io/openmotion/blob/main/studio/src/hooks/useFileManager.ts"
click node_timeline "https://github.com/nexu-io/openmotion/blob/main/studio/src/player/components/useTimelineClipDrag.ts"
click node_keyframes "https://github.com/nexu-io/openmotion/blob/main/studio/src/player/components/useTimelineKeyframeHandlers.ts"
click node_grading "https://github.com/nexu-io/openmotion/blob/main/studio/src/components/editor/useColorGradingController.ts"
click node_preview "https://github.com/nexu-io/openmotion/blob/main/studio/src/player/hooks/useShadowPreviewReload.ts"
click node_review "https://github.com/nexu-io/openmotion/blob/main/studio/src/motion/useReviewComments.ts"
click node_server "https://github.com/nexu-io/openmotion/blob/main/server.ts"
click node_gateway "https://github.com/nexu-io/openmotion/blob/main/gateway/service.ts"
click node_hyperframes "https://github.com/nexu-io/openmotion/blob/main/hyperframes.ts"
click node_render "https://github.com/nexu-io/openmotion/blob/main/server.ts"
click node_scenarios "https://github.com/nexu-io/openmotion/blob/main/gateway/scenario-runs.ts"
click node_games "https://github.com/nexu-io/openmotion/blob/main/game-projects.ts"
click node_design "https://github.com/nexu-io/openmotion/blob/main/design-projects.ts"
click node_motionmd "https://github.com/nexu-io/openmotion/blob/main/hyperframes.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_mcp,node_mcpserver toneBlue
class node_workspace,node_template,node_brand,node_assets,node_archives toneAmber
class node_studio,node_files,node_timeline,node_keyframes,node_grading,node_preview,node_review toneMint
class node_server,node_gateway,node_hyperframes,node_render toneRose
class node_scenarios,node_games,node_design,node_motionmd,node_user,node_agent toneIndigo
```

## Components

### Agent creation

- [MCP tools](https://github.com/nexu-io/openmotion/blob/main/mcp-tools.ts): `mcp-tools.ts`
- [MCP service](https://github.com/nexu-io/openmotion/blob/main/mcp.ts): `mcp.ts`

### Projects and assets

- [Workspace projects](https://github.com/nexu-io/openmotion/blob/main/workspace.ts): `workspace.ts`
- [Template library](https://github.com/nexu-io/openmotion/blob/main/shared/repository-template-catalog.ts): `shared/repository-template-catalog.ts`
- [Brand kits](https://github.com/nexu-io/openmotion/blob/main/gateway/brand-kits.ts): `gateway/brand-kits.ts`
- [Project assets](https://github.com/nexu-io/openmotion/blob/main/gateway/asset-library.ts): `gateway/asset-library.ts`
- [Project archives](https://github.com/nexu-io/openmotion/blob/main/gateway/project-archive-http.ts): `gateway/project-archive-http.ts`

### Studio editing

- [Studio editor](https://github.com/nexu-io/openmotion/blob/main/editor-runtime.ts): `editor-runtime.ts`
- [File manager](https://github.com/nexu-io/openmotion/blob/main/studio/src/hooks/useFileManager.ts): `studio/src/hooks/useFileManager.ts`
- [Timeline editing](https://github.com/nexu-io/openmotion/blob/main/studio/src/player/components/useTimelineClipDrag.ts): `studio/src/player/components/useTimelineClipDrag.ts`
- [Keyframe editing](https://github.com/nexu-io/openmotion/blob/main/studio/src/player/components/useTimelineKeyframeHandlers.ts): `studio/src/player/components/useTimelineKeyframeHandlers.ts`
- [Color grading](https://github.com/nexu-io/openmotion/blob/main/studio/src/components/editor/useColorGradingController.ts): `studio/src/components/editor/useColorGradingController.ts`
- [Live preview](https://github.com/nexu-io/openmotion/blob/main/studio/src/player/hooks/useShadowPreviewReload.ts): `studio/src/player/hooks/useShadowPreviewReload.ts`
- [Review comments](https://github.com/nexu-io/openmotion/blob/main/studio/src/motion/useReviewComments.ts): `studio/src/motion/useReviewComments.ts`

### Runtime and services

- [HTTP server](https://github.com/nexu-io/openmotion/blob/main/server.ts): `server.ts`
- [Model gateway](https://github.com/nexu-io/openmotion/blob/main/gateway/service.ts): `gateway/service.ts`
- [Hyperframes project](https://github.com/nexu-io/openmotion/blob/main/hyperframes.ts): `hyperframes.ts`
- [Video rendering](https://github.com/nexu-io/openmotion/blob/main/server.ts): `server.ts`

### Product capabilities

- [Scenario runs](https://github.com/nexu-io/openmotion/blob/main/gateway/scenario-runs.ts): `gateway/scenario-runs.ts`
- [Game projects](https://github.com/nexu-io/openmotion/blob/main/game-projects.ts): `game-projects.ts`
- [Design projects](https://github.com/nexu-io/openmotion/blob/main/design-projects.ts): `design-projects.ts`
- [Motion.md format](https://github.com/nexu-io/openmotion/blob/main/hyperframes.ts): `hyperframes.ts`

### Other components

- **Creator**
- **Local agent**

## Connections

- Creator → Local agent: requests creation (evidence: `README.md`)
- Local agent → MCP tools: uses tools (evidence: `README.md`)
- MCP tools → MCP service: dispatches
- MCP service → HTTP server: serves requests (evidence: `server.ts`)
- HTTP server → Workspace projects: manages projects (evidence: `server.ts`)
- Local agent → Template library: starts from template (evidence: `README.md`)
- Local agent → Brand kits: supplies brand kit (evidence: `README.md`)
- Local agent → Model gateway: generates media (evidence: `README.md`)
- Model gateway → Project assets: stores generated media (evidence: `gateway/service.ts`)
- HTTP server → Project archives: routes archives (evidence: `server.ts`)
- HTTP server → Project assets: routes asset requests (evidence: `server.ts`)
- HTTP server → Scenario runs: routes scenarios (evidence: `server.ts`)
- HTTP server → Game projects: routes game requests (evidence: `server.ts`)
- HTTP server → Design projects: routes design requests (evidence: `server.ts`)
- Workspace projects → Hyperframes project: holds project (evidence: `README.md`)
- Creator → Studio editor: opens project (evidence: `README.md`)
- Studio editor → File manager: manages project files
- File manager → HTTP server: uploads and writes (evidence: `studio/src/hooks/useFileManager.ts`)
- Studio editor → Timeline editing: edits timing (evidence: `README.md`)
- Timeline editing → Keyframe editing: edits keyframes
- Studio editor → Color grading: adjusts color
- Studio editor → Live preview: refreshes preview
- Creator → Review comments: reviews project (evidence: `README.md`)
- Studio editor → Video rendering: renders MP4 (evidence: `README.md`)
- HTTP server → Video rendering: runs export jobs (evidence: `server.ts`)
- Local agent → Motion.md format: authors shot plan (evidence: `README.md`)
