# clawnify/openstudio architecture

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

- Interactive diagram: https://gitdiagram.com/clawnify/openstudio
- Repository: https://github.com/clawnify/openstudio

## Overview

OpenStudio is a visual AI image-generation studio. Users can generate images directly with Quick Generate or compose a reusable node workflow: configure prompts and image inputs, apply styles or subjects, execute generation and image-processing stages, then review, compare, restore, and download results. Workflow state and run history are persisted through the Hono API, with OpenRouter-backed model generation and object storage for uploads. The graph follows documented capabilities and shown imports/API usage; unsampled server routing and node execution details are not expanded beyond the README evidence.

Main entry points: [`src/client/components/workflow-canvas.tsx`](https://github.com/clawnify/openstudio/blob/main/src/client/components/workflow-canvas.tsx) (Workflow canvas), [`src/client/app.tsx`](https://github.com/clawnify/openstudio/blob/main/src/client/app.tsx) (App routes), [`src/client/api.ts`](https://github.com/clawnify/openstudio/blob/main/src/client/api.ts) (API client), [`src/client/components/workflow-outputs.tsx`](https://github.com/clawnify/openstudio/blob/main/src/client/components/workflow-outputs.tsx) (Workflow outputs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Studio entry"]
  node_app["App routes<br/>[app.tsx]"]
  node_quick["Quick Generate<br/>[quick-generate.tsx]"]
  node_workflow_list["Workflow list<br/>[workflows-list.tsx]"]
end

subgraph group_workflow["Workflow authoring"]
  node_editor["Workflow editor"]
  node_canvas["Workflow canvas"]
  node_state["Workflow execution state<br/>[use-workflow.ts]"]
  node_context["Shared workflow context<br/>[context.tsx]"]
  node_prompt["Prompt nodes<br/>[prompt-node.tsx]"]
  node_image_input["Image input node"]
  node_style_subject["Style and subject nodes<br/>[style-node.tsx]"]
end

subgraph group_generation["Generation and processing"]
  node_generate["Generate node<br/>[generate-node.tsx]"]
  node_analyze["Analyze node<br/>[analyze-node.tsx]"]
  node_refine["Refine node<br/>[refine-node.tsx]"]
  node_upscale["Upscale node<br/>[upscale-node.tsx]"]
  node_output["Output node<br/>[output-node.tsx]"]
end

subgraph group_results["Results and presets"]
  node_outputs["Workflow outputs"]
  node_presets["Style preset manager"]
  node_compare["Image comparison<br/>[compare-view.tsx]"]
  node_lightbox["Image lightbox<br/>[image-lightbox.tsx]"]
  node_history["Node history"]
end

subgraph group_backend["API and persistence"]
  node_api_client["API client<br/>[api.ts]"]
  node_server["Hono API<br/>[index.ts]"]
  node_db[("SQLite adapter<br/>[db.ts]")]
  node_uploads[("Upload storage<br/>[uploads.ts]")]
end

node_user(("Studio user"))
node_openrouter{{"OpenRouter"}}

node_user -->|"opens studio"| node_app
node_app -->|"routes to"| node_quick
node_app -->|"routes to"| node_workflow_list
node_app -->|"routes to"| node_editor
node_app -->|"initializes"| node_state
node_app -->|"provides"| node_context
node_editor -->|"renders"| node_canvas
node_editor -->|"renders"| node_outputs
node_canvas -->|"renders"| node_prompt
node_canvas -->|"renders"| node_image_input
node_canvas -->|"renders"| node_style_subject
node_canvas -->|"renders"| node_generate
node_canvas -->|"renders"| node_analyze
node_canvas -->|"renders"| node_refine
node_canvas -->|"renders"| node_upscale
node_canvas -->|"renders"| node_output
node_state -->|"requests data"| node_api_client
node_api_client -.->|"calls API"| node_server
node_server -->|"uses database"| node_db
node_server -->|"uses storage"| node_uploads
node_quick -->|"requests generation"| node_api_client
node_prompt -->|"suggests title"| node_api_client
node_presets -.->|"uploads images"| node_api_client
node_presets -->|"saves presets"| node_context
node_style_subject -->|"selects presets"| node_presets
node_outputs -->|"opens comparison"| node_compare
node_outputs -->|"opens image"| node_lightbox
node_outputs -->|"opens history"| node_history
node_state -.->|"generates images"| node_openrouter
node_server -.->|"routes generation"| node_openrouter

click node_app "https://github.com/clawnify/openstudio/blob/main/src/client/app.tsx"
click node_quick "https://github.com/clawnify/openstudio/blob/main/src/client/components/quick-generate.tsx"
click node_workflow_list "https://github.com/clawnify/openstudio/blob/main/src/client/components/workflows-list.tsx"
click node_editor "https://github.com/clawnify/openstudio/blob/main/src/client/components/workflow-editor.tsx"
click node_canvas "https://github.com/clawnify/openstudio/blob/main/src/client/components/workflow-canvas.tsx"
click node_state "https://github.com/clawnify/openstudio/blob/main/src/client/hooks/use-workflow.ts"
click node_context "https://github.com/clawnify/openstudio/blob/main/src/client/context.tsx"
click node_prompt "https://github.com/clawnify/openstudio/blob/main/src/client/components/nodes/prompt-node.tsx"
click node_image_input "https://github.com/clawnify/openstudio/blob/main/src/client/components/nodes/image-input-node.tsx"
click node_style_subject "https://github.com/clawnify/openstudio/blob/main/src/client/components/nodes/style-node.tsx"
click node_generate "https://github.com/clawnify/openstudio/blob/main/src/client/components/nodes/generate-node.tsx"
click node_analyze "https://github.com/clawnify/openstudio/blob/main/src/client/components/nodes/analyze-node.tsx"
click node_refine "https://github.com/clawnify/openstudio/blob/main/src/client/components/nodes/refine-node.tsx"
click node_upscale "https://github.com/clawnify/openstudio/blob/main/src/client/components/nodes/upscale-node.tsx"
click node_output "https://github.com/clawnify/openstudio/blob/main/src/client/components/nodes/output-node.tsx"
click node_outputs "https://github.com/clawnify/openstudio/blob/main/src/client/components/workflow-outputs.tsx"
click node_presets "https://github.com/clawnify/openstudio/blob/main/src/client/components/style-presets-dialog.tsx"
click node_compare "https://github.com/clawnify/openstudio/blob/main/src/client/components/compare-view.tsx"
click node_lightbox "https://github.com/clawnify/openstudio/blob/main/src/client/components/image-lightbox.tsx"
click node_history "https://github.com/clawnify/openstudio/blob/main/src/client/components/node-history-dialog.tsx"
click node_api_client "https://github.com/clawnify/openstudio/blob/main/src/client/api.ts"
click node_server "https://github.com/clawnify/openstudio/blob/main/src/server/index.ts"
click node_db "https://github.com/clawnify/openstudio/blob/main/src/server/db.ts"
click node_uploads "https://github.com/clawnify/openstudio/blob/main/src/server/uploads.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_quick,node_workflow_list,node_user toneBlue
class node_editor,node_canvas,node_state,node_context,node_prompt,node_image_input,node_style_subject toneAmber
class node_generate,node_analyze,node_refine,node_upscale,node_output,node_openrouter toneMint
class node_outputs,node_presets,node_compare,node_lightbox,node_history toneRose
class node_api_client,node_server,node_db,node_uploads toneIndigo
```

## Components

### Studio entry

- [App routes](https://github.com/clawnify/openstudio/blob/main/src/client/app.tsx): `src/client/app.tsx`
- [Quick Generate](https://github.com/clawnify/openstudio/blob/main/src/client/components/quick-generate.tsx): `src/client/components/quick-generate.tsx`
- [Workflow list](https://github.com/clawnify/openstudio/blob/main/src/client/components/workflows-list.tsx): `src/client/components/workflows-list.tsx`

### Workflow authoring

- [Workflow editor](https://github.com/clawnify/openstudio/blob/main/src/client/components/workflow-editor.tsx): `src/client/components/workflow-editor.tsx`
- [Workflow canvas](https://github.com/clawnify/openstudio/blob/main/src/client/components/workflow-canvas.tsx): `src/client/components/workflow-canvas.tsx`
- [Workflow execution state](https://github.com/clawnify/openstudio/blob/main/src/client/hooks/use-workflow.ts): `src/client/hooks/use-workflow.ts`
- [Shared workflow context](https://github.com/clawnify/openstudio/blob/main/src/client/context.tsx): `src/client/context.tsx`
- [Prompt nodes](https://github.com/clawnify/openstudio/blob/main/src/client/components/nodes/prompt-node.tsx): `src/client/components/nodes/prompt-node.tsx`
- [Image input node](https://github.com/clawnify/openstudio/blob/main/src/client/components/nodes/image-input-node.tsx): `src/client/components/nodes/image-input-node.tsx`
- [Style and subject nodes](https://github.com/clawnify/openstudio/blob/main/src/client/components/nodes/style-node.tsx): `src/client/components/nodes/style-node.tsx`

### Generation and processing

- [Generate node](https://github.com/clawnify/openstudio/blob/main/src/client/components/nodes/generate-node.tsx): `src/client/components/nodes/generate-node.tsx`
- [Analyze node](https://github.com/clawnify/openstudio/blob/main/src/client/components/nodes/analyze-node.tsx): `src/client/components/nodes/analyze-node.tsx`
- [Refine node](https://github.com/clawnify/openstudio/blob/main/src/client/components/nodes/refine-node.tsx): `src/client/components/nodes/refine-node.tsx`
- [Upscale node](https://github.com/clawnify/openstudio/blob/main/src/client/components/nodes/upscale-node.tsx): `src/client/components/nodes/upscale-node.tsx`
- [Output node](https://github.com/clawnify/openstudio/blob/main/src/client/components/nodes/output-node.tsx): `src/client/components/nodes/output-node.tsx`

### Results and presets

- [Workflow outputs](https://github.com/clawnify/openstudio/blob/main/src/client/components/workflow-outputs.tsx): `src/client/components/workflow-outputs.tsx`
- [Style preset manager](https://github.com/clawnify/openstudio/blob/main/src/client/components/style-presets-dialog.tsx): `src/client/components/style-presets-dialog.tsx`
- [Image comparison](https://github.com/clawnify/openstudio/blob/main/src/client/components/compare-view.tsx): `src/client/components/compare-view.tsx`
- [Image lightbox](https://github.com/clawnify/openstudio/blob/main/src/client/components/image-lightbox.tsx): `src/client/components/image-lightbox.tsx`
- [Node history](https://github.com/clawnify/openstudio/blob/main/src/client/components/node-history-dialog.tsx): `src/client/components/node-history-dialog.tsx`

### API and persistence

- [API client](https://github.com/clawnify/openstudio/blob/main/src/client/api.ts): `src/client/api.ts`
- [Hono API](https://github.com/clawnify/openstudio/blob/main/src/server/index.ts): `src/server/index.ts`
- [SQLite adapter](https://github.com/clawnify/openstudio/blob/main/src/server/db.ts): `src/server/db.ts`
- [Upload storage](https://github.com/clawnify/openstudio/blob/main/src/server/uploads.ts): `src/server/uploads.ts`

### Other components

- **Studio user**
- **OpenRouter**

## Connections

- Studio user → App routes: opens studio (evidence: `src/client/app.tsx`)
- App routes → Quick Generate: routes to (evidence: `src/client/app.tsx`)
- App routes → Workflow list: routes to (evidence: `src/client/app.tsx`)
- App routes → Workflow editor: routes to (evidence: `src/client/app.tsx`)
- App routes → Workflow execution state: initializes (evidence: `src/client/app.tsx`)
- App routes → Shared workflow context: provides (evidence: `src/client/app.tsx`)
- Workflow editor → Workflow canvas: renders (evidence: `src/client/components/workflow-editor.tsx`)
- Workflow editor → Workflow outputs: renders (evidence: `src/client/components/workflow-editor.tsx`)
- Workflow canvas → Prompt nodes: renders (evidence: `src/client/components/workflow-canvas.tsx`)
- Workflow canvas → Image input node: renders (evidence: `src/client/components/workflow-canvas.tsx`)
- Workflow canvas → Style and subject nodes: renders (evidence: `src/client/components/workflow-canvas.tsx`)
- Workflow canvas → Generate node: renders (evidence: `src/client/components/workflow-canvas.tsx`)
- Workflow canvas → Analyze node: renders (evidence: `src/client/components/workflow-canvas.tsx`)
- Workflow canvas → Refine node: renders (evidence: `src/client/components/workflow-canvas.tsx`)
- Workflow canvas → Upscale node: renders (evidence: `src/client/components/workflow-canvas.tsx`)
- Workflow canvas → Output node: renders (evidence: `src/client/components/workflow-canvas.tsx`)
- Workflow execution state → API client: requests data (evidence: `src/client/hooks/use-workflow.ts`)
- API client → Hono API: calls API
- Hono API → SQLite adapter: uses database (evidence: `src/server/index.ts`)
- Hono API → Upload storage: uses storage (evidence: `src/server/index.ts`)
- Quick Generate → API client: requests generation (evidence: `src/client/components/quick-generate.tsx`)
- Prompt nodes → API client: suggests title (evidence: `src/client/components/nodes/prompt-node.tsx`)
- Style preset manager → API client: uploads images
- Style preset manager → Shared workflow context: saves presets (evidence: `src/client/components/style-presets-dialog.tsx`)
- Style and subject nodes → Style preset manager: selects presets (evidence: `src/client/components/nodes/style-node.tsx`)
- Workflow outputs → Image comparison: opens comparison (evidence: `src/client/components/workflow-outputs.tsx`)
- Workflow outputs → Image lightbox: opens image (evidence: `src/client/components/workflow-outputs.tsx`)
- Workflow outputs → Node history: opens history (evidence: `src/client/components/workflow-outputs.tsx`)
- Workflow execution state → OpenRouter: generates images
- Hono API → OpenRouter: routes generation
