# nexu-io/opengame architecture

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

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

## Overview

OpenGame is a local AI-assisted game studio: users connect a coding agent through MCP, browse or remix playable templates, edit and preview projects, then verify and publish or export them. The README documents these capabilities; the sampled server imports the project and gateway modules, while excerpts show Studio editing and agent-client behavior. Some subsystem links are therefore documented at product level rather than traced through unsampled implementation.

Main entry points: [`studio/src`](https://github.com/nexu-io/opengame/tree/main/studio/src) (Game Studio), [`game-projects.ts`](https://github.com/nexu-io/opengame/blob/main/game-projects.ts) (Project management), [`gateway/service.ts`](https://github.com/nexu-io/opengame/blob/main/gateway/service.ts) (Gateway services), [`server.ts`](https://github.com/nexu-io/opengame/blob/main/server.ts) (Local server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Agent and Studio"]
  node_server["Local server<br/>[server.ts]"]
  node_studio["Game Studio"]
  node_mcp["MCP tools<br/>[mcp-tools.ts]"]
  node_agent_client["Agent client"]
end

subgraph group_projects["Game Projects"]
  node_project_api["Project management<br/>[game-projects.ts]"]
  node_templates["Playable templates"]
  node_editor["Editing and preview"]
  node_file_manager["Project files<br/>[useFileManager.ts]"]
  node_preview_reload["Preview reload"]
end

subgraph group_services["Studio Services"]
  node_gateway["Gateway services<br/>[service.ts]"]
  node_accounts["Accounts and agents<br/>[account.ts]"]
  node_agent_bridge["Agent bridge"]
  node_capabilities["Capability center"]
  node_media["Media and assets<br/>[asset-library.ts]"]
  node_catalog["Template catalog<br/>[catalog-service.ts]"]
end

subgraph group_delivery["Verify and Ship"]
  node_verification["Game verification<br/>[game-tuning.ts]"]
  node_publish["Game publishing"]
  node_web_publish["Web publishing<br/>[web-publish.ts]"]
  node_mini_games["Mini-game export<br/>[wechat-minigame.ts]"]
end

node_agent(("Local coding agent"))
node_platforms(("Publishing platforms"))

node_agent -->|"invokes tools"| node_mcp
node_mcp -.->|"routes requests"| node_server
node_agent -->|"opens studio"| node_studio
node_studio -->|"uses client"| node_agent_client
node_server -->|"imports"| node_project_api
node_studio -->|"edits files"| node_file_manager
node_file_manager -->|"sends API requests"| node_server
node_studio -->|"edits projects"| node_editor
node_studio -->|"refreshes preview"| node_preview_reload
node_project_api -->|"remixes templates"| node_templates
node_server -->|"imports services"| node_gateway
node_gateway -.->|"provides account services"| node_accounts
node_gateway -.->|"provides agent access"| node_agent_bridge
node_gateway -.->|"exposes capabilities"| node_capabilities
node_gateway -.->|"supports asset workflows"| node_media
node_studio -->|"browses templates"| node_catalog
node_project_api -.->|"supports verification"| node_verification
node_project_api -->|"supports publishing"| node_publish
node_publish -->|"publishes games"| node_platforms
node_project_api -.->|"supports web publishing"| node_web_publish
node_project_api -->|"exports mini-games"| node_mini_games
node_mini_games -->|"targets platforms"| node_platforms

click node_server "https://github.com/nexu-io/opengame/blob/main/server.ts"
click node_studio "https://github.com/nexu-io/opengame/tree/main/studio/src"
click node_mcp "https://github.com/nexu-io/opengame/blob/main/mcp-tools.ts"
click node_agent_client "https://github.com/nexu-io/opengame/blob/main/studio/src/super-agent/superAgentClient.ts"
click node_project_api "https://github.com/nexu-io/opengame/blob/main/game-projects.ts"
click node_templates "https://github.com/nexu-io/opengame/tree/main/templates/games"
click node_editor "https://github.com/nexu-io/opengame/blob/main/studio/src/components/editor/useColorGradingController.ts"
click node_file_manager "https://github.com/nexu-io/opengame/blob/main/studio/src/hooks/useFileManager.ts"
click node_preview_reload "https://github.com/nexu-io/opengame/blob/main/studio/src/player/hooks/useShadowPreviewReload.ts"
click node_gateway "https://github.com/nexu-io/opengame/blob/main/gateway/service.ts"
click node_accounts "https://github.com/nexu-io/opengame/blob/main/gateway/account.ts"
click node_agent_bridge "https://github.com/nexu-io/opengame/blob/main/gateway/agent-bridge-script.ts"
click node_capabilities "https://github.com/nexu-io/opengame/blob/main/gateway/capability-center.ts"
click node_media "https://github.com/nexu-io/opengame/blob/main/gateway/asset-library.ts"
click node_catalog "https://github.com/nexu-io/opengame/blob/main/catalog-service.ts"
click node_verification "https://github.com/nexu-io/opengame/blob/main/gateway/game-tuning.ts"
click node_publish "https://github.com/nexu-io/opengame/blob/main/gateway/game-publish-bundler.ts"
click node_web_publish "https://github.com/nexu-io/opengame/blob/main/gateway/web-publish.ts"
click node_mini_games "https://github.com/nexu-io/opengame/blob/main/gateway/wechat-minigame.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_server,node_studio,node_mcp,node_agent_client toneBlue
class node_project_api,node_templates,node_editor,node_file_manager,node_preview_reload toneAmber
class node_gateway,node_accounts,node_agent_bridge,node_capabilities,node_media,node_catalog toneMint
class node_verification,node_publish,node_web_publish,node_mini_games toneRose
class node_agent,node_platforms toneIndigo
```

## Components

### Agent and Studio

- [Local server](https://github.com/nexu-io/opengame/blob/main/server.ts): `server.ts`
- [Game Studio](https://github.com/nexu-io/opengame/tree/main/studio/src): `studio/src`
- [MCP tools](https://github.com/nexu-io/opengame/blob/main/mcp-tools.ts): `mcp-tools.ts`
- [Agent client](https://github.com/nexu-io/opengame/blob/main/studio/src/super-agent/superAgentClient.ts): `studio/src/super-agent/superAgentClient.ts`

### Game Projects

- [Project management](https://github.com/nexu-io/opengame/blob/main/game-projects.ts): `game-projects.ts`
- [Playable templates](https://github.com/nexu-io/opengame/tree/main/templates/games): `templates/games`
- [Editing and preview](https://github.com/nexu-io/opengame/blob/main/studio/src/components/editor/useColorGradingController.ts): `studio/src/components/editor/useColorGradingController.ts`
- [Project files](https://github.com/nexu-io/opengame/blob/main/studio/src/hooks/useFileManager.ts): `studio/src/hooks/useFileManager.ts`
- [Preview reload](https://github.com/nexu-io/opengame/blob/main/studio/src/player/hooks/useShadowPreviewReload.ts): `studio/src/player/hooks/useShadowPreviewReload.ts`

### Studio Services

- [Gateway services](https://github.com/nexu-io/opengame/blob/main/gateway/service.ts): `gateway/service.ts`
- [Accounts and agents](https://github.com/nexu-io/opengame/blob/main/gateway/account.ts): `gateway/account.ts`
- [Agent bridge](https://github.com/nexu-io/opengame/blob/main/gateway/agent-bridge-script.ts): `gateway/agent-bridge-script.ts`
- [Capability center](https://github.com/nexu-io/opengame/blob/main/gateway/capability-center.ts): `gateway/capability-center.ts`
- [Media and assets](https://github.com/nexu-io/opengame/blob/main/gateway/asset-library.ts): `gateway/asset-library.ts`
- [Template catalog](https://github.com/nexu-io/opengame/blob/main/catalog-service.ts): `catalog-service.ts`

### Verify and Ship

- [Game verification](https://github.com/nexu-io/opengame/blob/main/gateway/game-tuning.ts): `gateway/game-tuning.ts`
- [Game publishing](https://github.com/nexu-io/opengame/blob/main/gateway/game-publish-bundler.ts): `gateway/game-publish-bundler.ts`
- [Web publishing](https://github.com/nexu-io/opengame/blob/main/gateway/web-publish.ts): `gateway/web-publish.ts`
- [Mini-game export](https://github.com/nexu-io/opengame/blob/main/gateway/wechat-minigame.ts): `gateway/wechat-minigame.ts`

### Other components

- **Local coding agent**
- **Publishing platforms**

## Connections

- Local coding agent → MCP tools: invokes tools (evidence: `README.md`)
- MCP tools → Local server: routes requests
- Local coding agent → Game Studio: opens studio (evidence: `README.md`)
- Game Studio → Agent client: uses client (evidence: `studio/src/super-agent/superAgentClient.ts`)
- Local server → Project management: imports (evidence: `server.ts`)
- Game Studio → Project files: edits files (evidence: `studio/src/hooks/useFileManager.ts`)
- Project files → Local server: sends API requests (evidence: `studio/src/hooks/useFileManager.ts`)
- Game Studio → Editing and preview: edits projects (evidence: `README.md`)
- Game Studio → Preview reload: refreshes preview (evidence: `studio/src/player/hooks/useShadowPreviewReload.ts`)
- Project management → Playable templates: remixes templates (evidence: `README.md`)
- Local server → Gateway services: imports services (evidence: `server.ts`)
- Gateway services → Accounts and agents: provides account services (evidence: `gateway/service.ts`)
- Gateway services → Agent bridge: provides agent access
- Gateway services → Capability center: exposes capabilities
- Gateway services → Media and assets: supports asset workflows (evidence: `gateway/service.ts`)
- Game Studio → Template catalog: browses templates (evidence: `README.md`)
- Project management → Game verification: supports verification
- Project management → Game publishing: supports publishing (evidence: `README.md`)
- Game publishing → Publishing platforms: publishes games (evidence: `README.md`)
- Project management → Web publishing: supports web publishing
- Project management → Mini-game export: exports mini-games (evidence: `README.md`)
- Mini-game export → Publishing platforms: targets platforms (evidence: `README.md`)
