# doziben/showrunner architecture

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

## Overview

Showrunner is a local-first AI UGC production app. A creator configures provider keys, creates a project from a script, receives a director-style avatar/b-roll storyboard, then generates voiceover, consistent avatar imagery, and lipsynced clips per scene; failed scenes can be retried and completed assets exported for an editor. Project, avatar, configuration, and usage data are documented as browser-local. The README documents the broad workflow and capabilities; some UI, export, server-provider, and persistence connections are represented at subsystem level because their implementations were not sampled.

Main entry points: [`src/lib/pipeline/orchestrator.ts`](https://github.com/doziben/showrunner/blob/main/src/lib/pipeline/orchestrator.ts) (Scene orchestrator), [`src/routes/projects/[id]/storyboard/+page.svelte`](https://github.com/doziben/showrunner/blob/main/src/routes/projects/%5Bid%5D/storyboard/%2Bpage.svelte) (Storyboard editor), [`src/lib/server/storyboard.ts`](https://github.com/doziben/showrunner/blob/main/src/lib/server/storyboard.ts) (Storyboard agent), [`src/lib/pipeline/avatar-image.ts`](https://github.com/doziben/showrunner/blob/main/src/lib/pipeline/avatar-image.ts) (Avatar imagery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Creator experience"]
  node_onboarding["Provider setup<br/>[+page.svelte]"]
  node_project_ui["Project workflow<br/>[+page.svelte]"]
  node_storyboard_ui["Storyboard editor<br/>[+page.svelte]"]
  node_scene_card["Scene retry<br/>[SceneCard.svelte]"]
  node_usage_ui["Usage dashboard<br/>[+page.svelte]"]
end

subgraph group_pipeline["Production pipeline"]
  node_storyboard["Storyboard agent<br/>[storyboard.ts]"]
  node_orchestrator["Scene orchestrator<br/>[orchestrator.ts]"]
  node_prompts["Director prompts<br/>[prompts.ts]"]
  node_voiceover["Voiceover generation<br/>[voiceover.ts]"]
  node_avatar_image["Avatar imagery<br/>[avatar-image.ts]"]
  node_lipsync["Lipsync dispatcher<br/>[lipsync.ts]"]
  node_model_catalog["Lipsync catalog<br/>[lipsync-models.ts]"]
  node_export["Bundle export<br/>[export.ts]"]
end

subgraph group_integrations["Provider integrations"]
  node_storyboard_api["Storyboard endpoint<br/>[+server.ts]"]
  node_avatar_api["Avatar endpoints<br/>[+server.ts]"]
  node_voice_api["Voice endpoint<br/>[+server.ts]"]
  node_lipsync_api["Lipsync endpoint<br/>[+server.ts]"]
end

subgraph group_state["Local state and usage"]
  node_db[("IndexedDB<br/>[index.ts]")]
  node_project_store["Project state<br/>[projects.ts]"]
  node_transaction_store["Spend records<br/>[transactions.ts]"]
  node_cost["Cost estimates<br/>[cost.ts]"]
  node_transactions["Spend analytics<br/>[transactions.ts]"]
end

node_creator(("Creator"))
node_claude{{"Claude / AI Gateway"}}
node_replicate{{"Replicate"}}
node_elevenlabs{{"ElevenLabs"}}
node_fal{{"fal.ai"}}

node_creator -->|"configures keys"| node_onboarding
node_creator -->|"submits script"| node_project_ui
node_project_ui -.->|"requests storyboard"| node_storyboard
node_storyboard -.->|"uses prompts"| node_prompts
node_storyboard -.->|"routes request"| node_storyboard_api
node_storyboard_api -.->|"generates shots"| node_claude
node_storyboard -.->|"returns scenes"| node_storyboard_ui
node_storyboard_ui -.->|"estimates spend"| node_cost
node_storyboard_ui -.->|"starts generation"| node_orchestrator
node_scene_card -->|"retries scene"| node_orchestrator
node_orchestrator -->|"generates speech"| node_voiceover
node_orchestrator -->|"generates shot"| node_avatar_image
node_orchestrator -->|"creates clip"| node_lipsync
node_orchestrator -->|"patches progress"| node_project_store
node_orchestrator -->|"reads project"| node_db
node_orchestrator -->|"records costs"| node_transaction_store
node_avatar_image -->|"builds image prompt"| node_prompts
node_avatar_image -->|"posts scene shot"| node_avatar_api
node_avatar_api -.->|"generates images"| node_replicate
node_voiceover -.->|"requests speech"| node_voice_api
node_voice_api -.->|"synthesizes audio"| node_elevenlabs
node_lipsync -.->|"selects model"| node_model_catalog
node_lipsync -.->|"requests lipsync"| node_lipsync_api
node_lipsync_api -.->|"runs P-Video"| node_replicate
node_lipsync_api -.->|"runs hosted models"| node_fal
node_project_store -.->|"persists projects"| node_db
node_transaction_store -.->|"persists spend"| node_db
node_transaction_store -.->|"supplies records"| node_transactions
node_transactions -->|"uses pricing"| node_cost
node_usage_ui -.->|"summarizes spend"| node_transactions
node_storyboard_ui -.->|"exports bundle"| node_export
node_export -.->|"delivers editor assets"| node_creator

click node_onboarding "https://github.com/doziben/showrunner/blob/main/src/routes/onboarding/%2Bpage.svelte"
click node_project_ui "https://github.com/doziben/showrunner/blob/main/src/routes/projects/new/%2Bpage.svelte"
click node_storyboard_ui "https://github.com/doziben/showrunner/blob/main/src/routes/projects/%5Bid%5D/storyboard/%2Bpage.svelte"
click node_scene_card "https://github.com/doziben/showrunner/blob/main/src/lib/components/SceneCard.svelte"
click node_usage_ui "https://github.com/doziben/showrunner/blob/main/src/routes/usage/%2Bpage.svelte"
click node_storyboard "https://github.com/doziben/showrunner/blob/main/src/lib/server/storyboard.ts"
click node_orchestrator "https://github.com/doziben/showrunner/blob/main/src/lib/pipeline/orchestrator.ts"
click node_prompts "https://github.com/doziben/showrunner/blob/main/src/lib/pipeline/prompts.ts"
click node_voiceover "https://github.com/doziben/showrunner/blob/main/src/lib/pipeline/voiceover.ts"
click node_avatar_image "https://github.com/doziben/showrunner/blob/main/src/lib/pipeline/avatar-image.ts"
click node_lipsync "https://github.com/doziben/showrunner/blob/main/src/lib/pipeline/lipsync.ts"
click node_model_catalog "https://github.com/doziben/showrunner/blob/main/src/lib/pipeline/lipsync-models.ts"
click node_export "https://github.com/doziben/showrunner/blob/main/src/lib/pipeline/export.ts"
click node_storyboard_api "https://github.com/doziben/showrunner/blob/main/src/routes/api/storyboard/%2Bserver.ts"
click node_avatar_api "https://github.com/doziben/showrunner/blob/main/src/routes/api/avatars/scene-shot/%2Bserver.ts"
click node_voice_api "https://github.com/doziben/showrunner/blob/main/src/routes/api/voiceover/%2Bserver.ts"
click node_lipsync_api "https://github.com/doziben/showrunner/blob/main/src/routes/api/lipsync/%2Bserver.ts"
click node_db "https://github.com/doziben/showrunner/blob/main/src/lib/db/index.ts"
click node_project_store "https://github.com/doziben/showrunner/blob/main/src/lib/stores/projects.ts"
click node_transaction_store "https://github.com/doziben/showrunner/blob/main/src/lib/stores/transactions.ts"
click node_cost "https://github.com/doziben/showrunner/blob/main/src/lib/helpers/cost.ts"
click node_transactions "https://github.com/doziben/showrunner/blob/main/src/lib/helpers/transactions.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_onboarding,node_project_ui,node_storyboard_ui,node_scene_card,node_usage_ui toneBlue
class node_storyboard,node_orchestrator,node_prompts,node_voiceover,node_avatar_image,node_lipsync,node_model_catalog,node_export toneAmber
class node_storyboard_api,node_avatar_api,node_voice_api,node_lipsync_api toneMint
class node_db,node_project_store,node_transaction_store,node_cost,node_transactions toneRose
class node_creator,node_claude,node_replicate,node_elevenlabs,node_fal toneIndigo
```

## Components

### Creator experience

- [Provider setup](https://github.com/doziben/showrunner/blob/main/src/routes/onboarding/%2Bpage.svelte): `src/routes/onboarding/+page.svelte`
- [Project workflow](https://github.com/doziben/showrunner/blob/main/src/routes/projects/new/%2Bpage.svelte): `src/routes/projects/new/+page.svelte`
- [Storyboard editor](https://github.com/doziben/showrunner/blob/main/src/routes/projects/%5Bid%5D/storyboard/%2Bpage.svelte): `src/routes/projects/[id]/storyboard/+page.svelte`
- [Scene retry](https://github.com/doziben/showrunner/blob/main/src/lib/components/SceneCard.svelte): `src/lib/components/SceneCard.svelte`
- [Usage dashboard](https://github.com/doziben/showrunner/blob/main/src/routes/usage/%2Bpage.svelte): `src/routes/usage/+page.svelte`

### Production pipeline

- [Storyboard agent](https://github.com/doziben/showrunner/blob/main/src/lib/server/storyboard.ts): `src/lib/server/storyboard.ts`
- [Scene orchestrator](https://github.com/doziben/showrunner/blob/main/src/lib/pipeline/orchestrator.ts): `src/lib/pipeline/orchestrator.ts`
- [Director prompts](https://github.com/doziben/showrunner/blob/main/src/lib/pipeline/prompts.ts): `src/lib/pipeline/prompts.ts`
- [Voiceover generation](https://github.com/doziben/showrunner/blob/main/src/lib/pipeline/voiceover.ts): `src/lib/pipeline/voiceover.ts`
- [Avatar imagery](https://github.com/doziben/showrunner/blob/main/src/lib/pipeline/avatar-image.ts): `src/lib/pipeline/avatar-image.ts`
- [Lipsync dispatcher](https://github.com/doziben/showrunner/blob/main/src/lib/pipeline/lipsync.ts): `src/lib/pipeline/lipsync.ts`
- [Lipsync catalog](https://github.com/doziben/showrunner/blob/main/src/lib/pipeline/lipsync-models.ts): `src/lib/pipeline/lipsync-models.ts`
- [Bundle export](https://github.com/doziben/showrunner/blob/main/src/lib/pipeline/export.ts): `src/lib/pipeline/export.ts`

### Provider integrations

- [Storyboard endpoint](https://github.com/doziben/showrunner/blob/main/src/routes/api/storyboard/%2Bserver.ts): `src/routes/api/storyboard/+server.ts`
- [Avatar endpoints](https://github.com/doziben/showrunner/blob/main/src/routes/api/avatars/scene-shot/%2Bserver.ts): `src/routes/api/avatars/scene-shot/+server.ts`
- [Voice endpoint](https://github.com/doziben/showrunner/blob/main/src/routes/api/voiceover/%2Bserver.ts): `src/routes/api/voiceover/+server.ts`
- [Lipsync endpoint](https://github.com/doziben/showrunner/blob/main/src/routes/api/lipsync/%2Bserver.ts): `src/routes/api/lipsync/+server.ts`

### Local state and usage

- [IndexedDB](https://github.com/doziben/showrunner/blob/main/src/lib/db/index.ts): `src/lib/db/index.ts`
- [Project state](https://github.com/doziben/showrunner/blob/main/src/lib/stores/projects.ts): `src/lib/stores/projects.ts`
- [Spend records](https://github.com/doziben/showrunner/blob/main/src/lib/stores/transactions.ts): `src/lib/stores/transactions.ts`
- [Cost estimates](https://github.com/doziben/showrunner/blob/main/src/lib/helpers/cost.ts): `src/lib/helpers/cost.ts`
- [Spend analytics](https://github.com/doziben/showrunner/blob/main/src/lib/helpers/transactions.ts): `src/lib/helpers/transactions.ts`

### Other components

- **Creator**
- **Claude / AI Gateway**
- **Replicate**
- **ElevenLabs**
- **fal.ai**

## Connections

- Creator → Provider setup: configures keys
- Creator → Project workflow: submits script (evidence: `README.md`)
- Project workflow → Storyboard agent: requests storyboard
- Storyboard agent → Director prompts: uses prompts
- Storyboard agent → Storyboard endpoint: routes request
- Storyboard endpoint → Claude / AI Gateway: generates shots
- Storyboard agent → Storyboard editor: returns scenes
- Storyboard editor → Cost estimates: estimates spend
- Storyboard editor → Scene orchestrator: starts generation
- Scene retry → Scene orchestrator: retries scene (evidence: `src/lib/pipeline/orchestrator.ts`)
- Scene orchestrator → Voiceover generation: generates speech (evidence: `src/lib/pipeline/orchestrator.ts`)
- Scene orchestrator → Avatar imagery: generates shot (evidence: `src/lib/pipeline/orchestrator.ts`)
- Scene orchestrator → Lipsync dispatcher: creates clip (evidence: `src/lib/pipeline/orchestrator.ts`)
- Scene orchestrator → Project state: patches progress (evidence: `src/lib/pipeline/orchestrator.ts`)
- Scene orchestrator → IndexedDB: reads project (evidence: `src/lib/pipeline/orchestrator.ts`)
- Scene orchestrator → Spend records: records costs (evidence: `src/lib/pipeline/orchestrator.ts`)
- Avatar imagery → Director prompts: builds image prompt (evidence: `src/lib/pipeline/avatar-image.ts`)
- Avatar imagery → Avatar endpoints: posts scene shot (evidence: `src/lib/pipeline/avatar-image.ts`)
- Avatar endpoints → Replicate: generates images
- Voiceover generation → Voice endpoint: requests speech
- Voice endpoint → ElevenLabs: synthesizes audio
- Lipsync dispatcher → Lipsync catalog: selects model
- Lipsync dispatcher → Lipsync endpoint: requests lipsync
- Lipsync endpoint → Replicate: runs P-Video
- Lipsync endpoint → fal.ai: runs hosted models
- Project state → IndexedDB: persists projects
- Spend records → IndexedDB: persists spend
- Spend records → Spend analytics: supplies records
- Spend analytics → Cost estimates: uses pricing (evidence: `src/lib/helpers/transactions.ts`)
- Usage dashboard → Spend analytics: summarizes spend
- Storyboard editor → Bundle export: exports bundle
- Bundle export → Creator: delivers editor assets
