# xixihhhh/clipforge architecture

> Architecture diagram of the GitHub repository xixihhhh/clipforge, 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/xixihhhh/clipforge
- Repository: https://github.com/xixihhhh/clipforge

## Overview

ClipForge is an AI-assisted short-form commerce video studio, with a secondary topic-to-video workflow. The main path runs from product or media input through script and storyboard creation, footage or AI generation, then local composition and export. Its broader capabilities include batch production, transcript-based editing, quality review and repair, compliance, and agent interfaces. The graph combines sampled route and runtime relationships with capabilities and links explicitly described in the README; unsampled internals are not inferred beyond that evidence.

Main entry points: [`src/app/project/[id]/script/page.tsx`](https://github.com/xixihhhh/clipforge/blob/main/src/app/project/%5Bid%5D/script/page.tsx) (Project workbench), [`src/lib/pipeline-runner.ts`](https://github.com/xixihhhh/clipforge/blob/main/src/lib/pipeline-runner.ts) (Resumable production), [`src/app/api/project/[id]/storyboard-film/route.ts`](https://github.com/xixihhhh/clipforge/blob/main/src/app/api/project/%5Bid%5D/storyboard-film/route.ts) (Storyboard film route), [`src/app/api/project/[id]/stock-fill/route.ts`](https://github.com/xixihhhh/clipforge/blob/main/src/app/api/project/%5Bid%5D/stock-fill/route.ts) (Storyboard stock fill)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Creator experience"]
  node_studio["Studio workspace<br/>[page.tsx]"]
  node_project_ui["Project workbench<br/>[page.tsx]"]
  node_batch_ui["Batch workspace<br/>[page.tsx]"]
end

subgraph group_planning["Creative planning"]
  node_product_intake["Product intake<br/>[product-ingest.ts]"]
  node_script_engine["Script generation<br/>[generator.ts]"]
  node_script_review["Script judges<br/>[script-judge.ts]"]
  node_storyboards["Storyboard planning<br/>[storyboard-film.ts]"]
end

subgraph group_creation["Media creation"]
  node_ai_video_route["AI video submission<br/>[route.ts]"]
  node_film_route["Storyboard film route<br/>[route.ts]"]
  node_providers["AI providers<br/>[base.ts]"]
  node_stock_search["Stock search<br/>[route.ts]"]
  node_stock_fill_route["Storyboard stock fill<br/>[route.ts]"]
  node_stock_matching["Stock matching<br/>[stock-matcher.ts]"]
  node_pipeline["Resumable production<br/>[pipeline-runner.ts]"]
end

subgraph group_finishing["Editing and delivery"]
  node_composition["Video composition<br/>[composer.ts]"]
  node_compose_route["Composition route<br/>[route.ts]"]
  node_transcript_edit["Transcript editing"]
  node_quality_repair["Quality and repair"]
  node_export["Platform export<br/>[platform-export.ts]"]
end

subgraph group_platform["Runtime and integrations"]
  node_database[("Project database<br/>[index.ts]")]
  node_task_center["Task status<br/>[route.ts]"]
  node_agent_clients["CLI and MCP<br/>[clipforge.mjs]"]
end

node_creator(("Creator"))
node_external_models{{"Model services"}}
node_stock_sources{{"Stock media sources"}}

node_creator -->|"starts work"| node_studio
node_studio -->|"imports product"| node_product_intake
node_studio -->|"opens project"| node_project_ui
node_project_ui -->|"generates script"| node_script_engine
node_project_ui -->|"plans shots"| node_storyboards
node_script_engine -->|"reviews script"| node_script_review
node_project_ui -->|"requests film"| node_film_route
node_film_route -->|"builds prompt"| node_storyboards
node_film_route -->|"submits video task"| node_providers
node_film_route -->|"requests generation"| node_external_models
node_ai_video_route -->|"selects provider"| node_providers
node_project_ui -->|"searches footage"| node_stock_search
node_stock_search -->|"searches sources"| node_stock_sources
node_project_ui -->|"fills shot media"| node_stock_fill_route
node_stock_fill_route -->|"matches candidates"| node_stock_matching
node_stock_fill_route -->|"downloads media"| node_stock_sources
node_batch_ui -->|"runs production"| node_pipeline
node_pipeline -->|"judges script"| node_script_review
node_pipeline -->|"stores run state"| node_database
node_pipeline -.->|"runs stock fill"| node_stock_fill_route
node_pipeline -.->|"runs composition"| node_compose_route
node_project_ui -->|"requests composition"| node_compose_route
node_compose_route -->|"renders video"| node_composition
node_compose_route -.->|"requests speech"| node_external_models
node_composition -->|"provides master"| node_export
node_project_ui -->|"edits transcript"| node_transcript_edit
node_project_ui -->|"reviews and repairs"| node_quality_repair
node_project_ui -->|"persists project"| node_database
node_task_center -->|"reads task state"| node_database
node_agent_clients -.->|"starts production"| node_pipeline
node_agent_clients -.->|"uses local editing"| node_composition

click node_studio "https://github.com/xixihhhh/clipforge/blob/main/src/app/page.tsx"
click node_project_ui "https://github.com/xixihhhh/clipforge/blob/main/src/app/project/%5Bid%5D/script/page.tsx"
click node_batch_ui "https://github.com/xixihhhh/clipforge/blob/main/src/app/batch/page.tsx"
click node_product_intake "https://github.com/xixihhhh/clipforge/blob/main/src/lib/product-ingest.ts"
click node_script_engine "https://github.com/xixihhhh/clipforge/blob/main/src/lib/script-engine/generator.ts"
click node_script_review "https://github.com/xixihhhh/clipforge/blob/main/src/lib/script-judge.ts"
click node_storyboards "https://github.com/xixihhhh/clipforge/blob/main/src/lib/storyboard-film.ts"
click node_ai_video_route "https://github.com/xixihhhh/clipforge/blob/main/src/app/api/ai/video/route.ts"
click node_film_route "https://github.com/xixihhhh/clipforge/blob/main/src/app/api/project/%5Bid%5D/storyboard-film/route.ts"
click node_providers "https://github.com/xixihhhh/clipforge/blob/main/src/lib/providers/base.ts"
click node_stock_search "https://github.com/xixihhhh/clipforge/blob/main/src/app/api/stock/search/route.ts"
click node_stock_fill_route "https://github.com/xixihhhh/clipforge/blob/main/src/app/api/project/%5Bid%5D/stock-fill/route.ts"
click node_stock_matching "https://github.com/xixihhhh/clipforge/blob/main/src/lib/stock-matcher.ts"
click node_pipeline "https://github.com/xixihhhh/clipforge/blob/main/src/lib/pipeline-runner.ts"
click node_composition "https://github.com/xixihhhh/clipforge/blob/main/src/lib/video-composer/composer.ts"
click node_compose_route "https://github.com/xixihhhh/clipforge/blob/main/src/app/api/project/%5Bid%5D/compose/route.ts"
click node_transcript_edit "https://github.com/xixihhhh/clipforge/blob/main/src/lib/transcript-editor.ts"
click node_quality_repair "https://github.com/xixihhhh/clipforge/blob/main/src/lib/video-repair-plan.ts"
click node_export "https://github.com/xixihhhh/clipforge/blob/main/src/lib/platform-export.ts"
click node_database "https://github.com/xixihhhh/clipforge/blob/main/src/lib/db/index.ts"
click node_task_center "https://github.com/xixihhhh/clipforge/blob/main/src/app/api/tasks/route.ts"
click node_agent_clients "https://github.com/xixihhhh/clipforge/blob/main/bin/clipforge.mjs"

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_studio,node_project_ui,node_batch_ui toneBlue
class node_product_intake,node_script_engine,node_script_review,node_storyboards toneAmber
class node_ai_video_route,node_film_route,node_providers,node_stock_search,node_stock_fill_route,node_stock_matching,node_pipeline toneMint
class node_composition,node_compose_route,node_transcript_edit,node_quality_repair,node_export toneRose
class node_database,node_task_center,node_agent_clients,node_creator,node_external_models,node_stock_sources toneIndigo
```

## Components

### Creator experience

- [Studio workspace](https://github.com/xixihhhh/clipforge/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Project workbench](https://github.com/xixihhhh/clipforge/blob/main/src/app/project/%5Bid%5D/script/page.tsx): `src/app/project/[id]/script/page.tsx`
- [Batch workspace](https://github.com/xixihhhh/clipforge/blob/main/src/app/batch/page.tsx): `src/app/batch/page.tsx`

### Creative planning

- [Product intake](https://github.com/xixihhhh/clipforge/blob/main/src/lib/product-ingest.ts): `src/lib/product-ingest.ts`
- [Script generation](https://github.com/xixihhhh/clipforge/blob/main/src/lib/script-engine/generator.ts): `src/lib/script-engine/generator.ts`
- [Script judges](https://github.com/xixihhhh/clipforge/blob/main/src/lib/script-judge.ts): `src/lib/script-judge.ts`
- [Storyboard planning](https://github.com/xixihhhh/clipforge/blob/main/src/lib/storyboard-film.ts): `src/lib/storyboard-film.ts`

### Media creation

- [AI video submission](https://github.com/xixihhhh/clipforge/blob/main/src/app/api/ai/video/route.ts): `src/app/api/ai/video/route.ts`
- [Storyboard film route](https://github.com/xixihhhh/clipforge/blob/main/src/app/api/project/%5Bid%5D/storyboard-film/route.ts): `src/app/api/project/[id]/storyboard-film/route.ts`
- [AI providers](https://github.com/xixihhhh/clipforge/blob/main/src/lib/providers/base.ts): `src/lib/providers/base.ts`
- [Stock search](https://github.com/xixihhhh/clipforge/blob/main/src/app/api/stock/search/route.ts): `src/app/api/stock/search/route.ts`
- [Storyboard stock fill](https://github.com/xixihhhh/clipforge/blob/main/src/app/api/project/%5Bid%5D/stock-fill/route.ts): `src/app/api/project/[id]/stock-fill/route.ts`
- [Stock matching](https://github.com/xixihhhh/clipforge/blob/main/src/lib/stock-matcher.ts): `src/lib/stock-matcher.ts`
- [Resumable production](https://github.com/xixihhhh/clipforge/blob/main/src/lib/pipeline-runner.ts): `src/lib/pipeline-runner.ts`

### Editing and delivery

- [Video composition](https://github.com/xixihhhh/clipforge/blob/main/src/lib/video-composer/composer.ts): `src/lib/video-composer/composer.ts`
- [Composition route](https://github.com/xixihhhh/clipforge/blob/main/src/app/api/project/%5Bid%5D/compose/route.ts): `src/app/api/project/[id]/compose/route.ts`
- [Transcript editing](https://github.com/xixihhhh/clipforge/blob/main/src/lib/transcript-editor.ts): `src/lib/transcript-editor.ts`
- [Quality and repair](https://github.com/xixihhhh/clipforge/blob/main/src/lib/video-repair-plan.ts): `src/lib/video-repair-plan.ts`
- [Platform export](https://github.com/xixihhhh/clipforge/blob/main/src/lib/platform-export.ts): `src/lib/platform-export.ts`

### Runtime and integrations

- [Project database](https://github.com/xixihhhh/clipforge/blob/main/src/lib/db/index.ts): `src/lib/db/index.ts`
- [Task status](https://github.com/xixihhhh/clipforge/blob/main/src/app/api/tasks/route.ts): `src/app/api/tasks/route.ts`
- [CLI and MCP](https://github.com/xixihhhh/clipforge/blob/main/bin/clipforge.mjs): `bin/clipforge.mjs`

### Other components

- **Creator**
- **Model services**
- **Stock media sources**

## Connections

- Creator → Studio workspace: starts work (evidence: `README.md`)
- Studio workspace → Product intake: imports product (evidence: `README.md`)
- Studio workspace → Project workbench: opens project (evidence: `README.md`)
- Project workbench → Script generation: generates script (evidence: `README.md`)
- Project workbench → Storyboard planning: plans shots (evidence: `README.md`)
- Script generation → Script judges: reviews script (evidence: `README.md`)
- Project workbench → Storyboard film route: requests film (evidence: `README.md`)
- Storyboard film route → Storyboard planning: builds prompt (evidence: `src/app/api/project/[id]/storyboard-film/route.ts`)
- Storyboard film route → AI providers: submits video task (evidence: `src/app/api/project/[id]/storyboard-film/route.ts`)
- Storyboard film route → Model services: requests generation (evidence: `src/app/api/project/[id]/storyboard-film/route.ts`)
- AI video submission → AI providers: selects provider (evidence: `src/app/api/ai/video/route.ts`)
- Project workbench → Stock search: searches footage (evidence: `README.md`)
- Stock search → Stock media sources: searches sources (evidence: `src/app/api/stock/search/route.ts`)
- Project workbench → Storyboard stock fill: fills shot media (evidence: `README.md`)
- Storyboard stock fill → Stock matching: matches candidates (evidence: `src/app/api/project/[id]/stock-fill/route.ts`)
- Storyboard stock fill → Stock media sources: downloads media (evidence: `src/app/api/project/[id]/stock-fill/route.ts`)
- Batch workspace → Resumable production: runs production (evidence: `README.md`)
- Resumable production → Script judges: judges script (evidence: `src/lib/pipeline-runner.ts`)
- Resumable production → Project database: stores run state (evidence: `src/lib/pipeline-runner.ts`)
- Resumable production → Storyboard stock fill: runs stock fill
- Resumable production → Composition route: runs composition
- Project workbench → Composition route: requests composition (evidence: `README.md`)
- Composition route → Video composition: renders video (evidence: `src/app/api/project/[id]/compose/route.ts`)
- Composition route → Model services: requests speech
- Video composition → Platform export: provides master (evidence: `README.md`)
- Project workbench → Transcript editing: edits transcript (evidence: `README.md`)
- Project workbench → Quality and repair: reviews and repairs (evidence: `README.md`)
- Project workbench → Project database: persists project (evidence: `README.md`)
- Task status → Project database: reads task state (evidence: `src/app/api/tasks/route.ts`)
- CLI and MCP → Resumable production: starts production
- CLI and MCP → Video composition: uses local editing (evidence: `README.md`)
