# liuzhao1225/youdub-desktop architecture

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

- Interactive diagram: https://gitdiagram.com/liuzhao1225/youdub-desktop
- Repository: https://github.com/liuzhao1225/youdub-desktop

## Overview

YouDub Desktop is a local video-localization workbench. The main workflow imports a video, transcribes and segments speech, translates it, optionally separates audio and clones speech, then mixes and exports subtitles and/or dubbed video; users monitor and manage tasks in the web workbench. The README documents the three-tier Electron, React SPA, and FastAPI design. The graph preserves documented workflow-editing, setup, resource-management, and task-library branches; several backend links use README evidence because their implementation files were not sampled.

Main entry points: [`backend/app/server/stage_worker.py`](https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/stage_worker.py) (Stage Worker), [`apps/web/src/App.tsx`](https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/web/src/App.tsx) (Workbench Shell), [`backend/app/server/dag.py`](https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/dag.py) (DAG Scheduler), [`apps/web/src/lib/api.ts`](https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/web/src/lib/api.ts) (Web API Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Workbench UI"]
  node_workbench["Workbench Shell<br/>[App.tsx]"]
  node_workflow_ui["Workflow Editor"]
  node_task_ui["Task Management<br/>[workflow-task.tsx]"]
  node_library_ui["Task Library<br/>[library.tsx]"]
  node_settings_ui["Settings<br/>[SettingsModal.tsx]"]
  node_setup_ui["Setup Checks<br/>[setup-page.tsx]"]
  node_web_api["Web API Client<br/>[api.ts]"]
end

subgraph group_control["Backend Control Plane"]
  node_api["HTTP API<br/>[api.py]"]
  node_scheduler["DAG Scheduler<br/>[dag.py]"]
  node_task_store[("Task Persistence<br/>[db.py]")]
  node_event_hub["Progress Events<br/>[events.py]"]
  node_llm["Translation Providers<br/>[llm.py]"]
  node_resources["Resource Manager<br/>[resources.py]"]
  node_worker["Stage Worker<br/>[stage_worker.py]"]
end

subgraph group_media["Localization Engine"]
  node_video_input["Video Download<br/>[video_download.py]"]
  node_asr["Speech Recognition<br/>[asr.py]"]
  node_resegment["Sentence Segmentation"]
  node_split["Sentence Boundaries<br/>[sentence_split.py]"]
  node_separate["Audio Separation<br/>[separate.py]"]
  node_tts["Speech Cloning<br/>[tts.py]"]
  node_mix["Audio Mixing<br/>[mix.py]"]
  node_export["Media Export<br/>[export.py]"]
end

subgraph group_desktop["Desktop Shell"]
  node_desktop["Electron Shell<br/>[main.ts]"]
  node_update["Desktop Updates<br/>[update-manager.ts]"]
end

node_user(("User"))

node_user -->|"uses"| node_workbench
node_workbench -->|"opens"| node_workflow_ui
node_workbench -->|"opens"| node_library_ui
node_workbench -->|"opens"| node_settings_ui
node_workbench -->|"checks setup"| node_setup_ui
node_workbench -.->|"requests data"| node_web_api
node_task_ui -.->|"manages tasks"| node_web_api
node_settings_ui -.->|"configures providers"| node_web_api
node_web_api -->|"HTTP requests"| node_api
node_api -.->|"schedules DAG"| node_scheduler
node_scheduler -.->|"persists tasks"| node_task_store
node_scheduler -.->|"publishes progress"| node_event_hub
node_scheduler -->|"runs stages"| node_worker
node_scheduler -.->|"translates text"| node_llm
node_api -.->|"manages resources"| node_resources
node_worker -->|"dispatches download"| node_video_input
node_worker -->|"dispatches recognition"| node_asr
node_worker -->|"resegments transcript"| node_resegment
node_worker -->|"dispatches segmentation"| node_split
node_worker -->|"dispatches separation"| node_separate
node_worker -->|"dispatches synthesis"| node_tts
node_worker -->|"dispatches mixing"| node_mix
node_worker -->|"dispatches export"| node_export
node_web_api -->|"receives SSE"| node_event_hub
node_desktop -->|"HTTP and SSE"| node_api
node_desktop -.->|"manages updates"| node_update

click node_workbench "https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/web/src/App.tsx"
click node_workflow_ui "https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/web/src/plugin/builtin/workflow-canvas.tsx"
click node_task_ui "https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/web/src/plugin/builtin/workflow-task.tsx"
click node_library_ui "https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/web/src/plugin/builtin/library.tsx"
click node_settings_ui "https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/web/src/components/settings/SettingsModal.tsx"
click node_setup_ui "https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/web/src/components/setup-page.tsx"
click node_web_api "https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/web/src/lib/api.ts"
click node_api "https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/api.py"
click node_scheduler "https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/dag.py"
click node_task_store "https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/db.py"
click node_event_hub "https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/events.py"
click node_llm "https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/llm.py"
click node_resources "https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/resources.py"
click node_worker "https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/stage_worker.py"
click node_video_input "https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/video_download.py"
click node_asr "https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/v1/asr.py"
click node_resegment "https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/whisper_resegment.py"
click node_split "https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/v1/sentence_split.py"
click node_separate "https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/v1/separate.py"
click node_tts "https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/v1/tts.py"
click node_mix "https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/v1/mix.py"
click node_export "https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/v1/export.py"
click node_desktop "https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/desktop/src/main.ts"
click node_update "https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/desktop/src/update-manager.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_workbench,node_workflow_ui,node_task_ui,node_library_ui,node_settings_ui,node_setup_ui,node_web_api,node_user toneBlue
class node_api,node_scheduler,node_task_store,node_event_hub,node_llm,node_resources,node_worker toneAmber
class node_video_input,node_asr,node_resegment,node_split,node_separate,node_tts,node_mix,node_export toneMint
class node_desktop,node_update toneRose
```

## Components

### Workbench UI

- [Workbench Shell](https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [Workflow Editor](https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/web/src/plugin/builtin/workflow-canvas.tsx): `apps/web/src/plugin/builtin/workflow-canvas.tsx`
- [Task Management](https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/web/src/plugin/builtin/workflow-task.tsx): `apps/web/src/plugin/builtin/workflow-task.tsx`
- [Task Library](https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/web/src/plugin/builtin/library.tsx): `apps/web/src/plugin/builtin/library.tsx`
- [Settings](https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/web/src/components/settings/SettingsModal.tsx): `apps/web/src/components/settings/SettingsModal.tsx`
- [Setup Checks](https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/web/src/components/setup-page.tsx): `apps/web/src/components/setup-page.tsx`
- [Web API Client](https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/web/src/lib/api.ts): `apps/web/src/lib/api.ts`

### Backend Control Plane

- [HTTP API](https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/api.py): `backend/app/server/api.py`
- [DAG Scheduler](https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/dag.py): `backend/app/server/dag.py`
- [Task Persistence](https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/db.py): `backend/app/server/db.py`
- [Progress Events](https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/events.py): `backend/app/server/events.py`
- [Translation Providers](https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/llm.py): `backend/app/server/llm.py`
- [Resource Manager](https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/resources.py): `backend/app/server/resources.py`
- [Stage Worker](https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/stage_worker.py): `backend/app/server/stage_worker.py`

### Localization Engine

- [Video Download](https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/video_download.py): `backend/app/server/video_download.py`
- [Speech Recognition](https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/v1/asr.py): `backend/app/v1/asr.py`
- [Sentence Segmentation](https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/server/whisper_resegment.py): `backend/app/server/whisper_resegment.py`
- [Sentence Boundaries](https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/v1/sentence_split.py): `backend/app/v1/sentence_split.py`
- [Audio Separation](https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/v1/separate.py): `backend/app/v1/separate.py`
- [Speech Cloning](https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/v1/tts.py): `backend/app/v1/tts.py`
- [Audio Mixing](https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/v1/mix.py): `backend/app/v1/mix.py`
- [Media Export](https://github.com/liuzhao1225/youdub-desktop/blob/main/backend/app/v1/export.py): `backend/app/v1/export.py`

### Desktop Shell

- [Electron Shell](https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/desktop/src/main.ts): `apps/desktop/src/main.ts`
- [Desktop Updates](https://github.com/liuzhao1225/youdub-desktop/blob/main/apps/desktop/src/update-manager.ts): `apps/desktop/src/update-manager.ts`

### Other components

- **User**

## Connections

- User → Workbench Shell: uses (evidence: `README.md`)
- Workbench Shell → Workflow Editor: opens (evidence: `README.md`)
- Workbench Shell → Task Library: opens (evidence: `README.md`)
- Workbench Shell → Settings: opens (evidence: `README.md`)
- Workbench Shell → Setup Checks: checks setup (evidence: `README.md`)
- Workbench Shell → Web API Client: requests data
- Task Management → Web API Client: manages tasks
- Settings → Web API Client: configures providers
- Web API Client → HTTP API: HTTP requests (evidence: `README.md`)
- HTTP API → DAG Scheduler: schedules DAG
- DAG Scheduler → Task Persistence: persists tasks
- DAG Scheduler → Progress Events: publishes progress
- DAG Scheduler → Stage Worker: runs stages (evidence: `README.md`)
- DAG Scheduler → Translation Providers: translates text
- HTTP API → Resource Manager: manages resources
- Stage Worker → Video Download: dispatches download (evidence: `backend/app/server/stage_worker.py`)
- Stage Worker → Speech Recognition: dispatches recognition (evidence: `backend/app/server/stage_worker.py`)
- Stage Worker → Sentence Segmentation: resegments transcript (evidence: `backend/app/server/stage_worker.py`)
- Stage Worker → Sentence Boundaries: dispatches segmentation (evidence: `backend/app/server/stage_worker.py`)
- Stage Worker → Audio Separation: dispatches separation (evidence: `backend/app/server/stage_worker.py`)
- Stage Worker → Speech Cloning: dispatches synthesis (evidence: `backend/app/server/stage_worker.py`)
- Stage Worker → Audio Mixing: dispatches mixing (evidence: `backend/app/server/stage_worker.py`)
- Stage Worker → Media Export: dispatches export (evidence: `backend/app/server/stage_worker.py`)
- Web API Client → Progress Events: receives SSE (evidence: `README.md`)
- Electron Shell → HTTP API: HTTP and SSE (evidence: `README.md`)
- Electron Shell → Desktop Updates: manages updates (evidence: `apps/desktop/src/main.ts`)
