# huang-jianhua/videogenius architecture

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

- Interactive diagram: https://gitdiagram.com/huang-jianhua/videogenius
- Repository: https://github.com/huang-jianhua/videogenius

## Overview

VideoGenius is an AI-assisted short-video creation platform, exposed through a Streamlit creator interface and a FastAPI service. The main workflow accepts a topic and production settings, generates a script and matching materials, creates narration and subtitles, then composes an effected video while tracking task state. The graph also preserves documented model routing, configuration, and enterprise-facing capabilities. Source-index references and excerpts support the principal code connections; README-only capabilities are identified as documented, not verified against unsampled implementations.

Main entry points: [`webui/Main.py`](https://github.com/huang-jianhua/videogenius/blob/main/webui/Main.py) (Creator workspace), [`app/services/task.py`](https://github.com/huang-jianhua/videogenius/blob/main/app/services/task.py) (Video task orchestration), [`app/services/llm.py`](https://github.com/huang-jianhua/videogenius/blob/main/app/services/llm.py) (Script and term generation), [`app/router.py`](https://github.com/huang-jianhua/videogenius/blob/main/app/router.py) (API routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_creator["Creator experience"]
  node_streamlit["Creator workspace<br/>[Main.py]"]
  node_creative["Creative assistant"]
  node_material_page["Material generator UI"]
  node_model_ui["Model management UI"]
  node_subtitle_ui["Subtitle system UI"]
  node_voice_ui["Voice system UI"]
  node_template["Template library"]
  node_batch["Batch processing<br/>[batch_processor.py]"]
  node_export["Export optimizer"]
  node_vision["Vision analysis"]
end

subgraph group_workflow["Video production"]
  node_task["Video task orchestration<br/>[task.py]"]
  node_narration["Voice and narration<br/>[voice.py]"]
  node_subtitles["Subtitle generation<br/>[subtitle.py]"]
  node_video["Video composition<br/>[video.py]"]
  node_effects["Video effects<br/>[video_effects.py]"]
end

subgraph group_ai["AI services"]
  node_script["Script and term generation<br/>[llm.py]"]
  node_materials["AI material generation"]
  node_model_routing["Model routing and balancing<br/>[model_router.py]"]
  node_load_balancer["Load balancing<br/>[load_balancer.py]"]
  node_failover["Provider failover"]
  node_model_registry["Model registry and health<br/>[model_manager.py]"]
  node_llm_interface["LLM provider interface<br/>[llm_interface.py]"]
end

subgraph group_runtime["API and tasks"]
  node_state[("Task state<br/>[state.py]")]
  node_api["FastAPI application<br/>[asgi.py]"]
  node_router["API routes<br/>[router.py]"]
  node_video_api["Video task endpoint<br/>[video.py]"]
  node_script_api["Script endpoint<br/>[llm.py]"]
end

subgraph group_management["Configuration and enterprise"]
  node_config[("Application configuration<br/>[config.py]")]
  node_config_ui["Configuration manager<br/>[config_manager.py]"]
  node_enterprise["Enterprise management"]
  node_security["Enterprise security"]
end

node_creator(("Creator"))
node_external_models{{"AI model providers"}}

node_creator -->|"uses"| node_streamlit
node_streamlit -->|"starts tasks"| node_task
node_streamlit -->|"reads settings"| node_config
node_streamlit -->|"offers"| node_model_ui
node_streamlit -.->|"offers"| node_creative
node_streamlit -->|"offers"| node_subtitle_ui
node_streamlit -->|"offers"| node_voice_ui
node_material_page -->|"calls"| node_materials
node_task -->|"generates script"| node_script
node_task -->|"generates materials"| node_materials
node_task -->|"creates audio"| node_narration
node_task -->|"creates subtitles"| node_subtitles
node_task -->|"composes video"| node_video
node_task -->|"updates state"| node_state
node_video -.->|"applies effects"| node_effects
node_model_routing -->|"routes models"| node_script
node_load_balancer -->|"selects models"| node_model_routing
node_failover -->|"uses balancing"| node_load_balancer
node_failover -->|"checks providers"| node_model_registry
node_model_registry -->|"registers providers"| node_llm_interface
node_script -.->|"calls providers"| node_external_models
node_api -->|"mounts routes"| node_router
node_router -->|"registers"| node_video_api
node_router -->|"registers"| node_script_api
node_video_api -->|"starts task"| node_task
node_script_api -->|"generates script"| node_script
node_config_ui -->|"updates settings"| node_config
node_model_ui -.->|"manages models"| node_model_registry
node_enterprise -.->|"supports controls"| node_security
node_streamlit -->|"offers"| node_template
node_streamlit -->|"offers"| node_batch
node_streamlit -->|"offers"| node_export
node_streamlit -->|"offers"| node_vision

click node_streamlit "https://github.com/huang-jianhua/videogenius/blob/main/webui/Main.py"
click node_creative "https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/ai_creative_assistant.py"
click node_material_page "https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/ai_material_generator.py"
click node_model_ui "https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/model_management.py"
click node_subtitle_ui "https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/smart_subtitle_system.py"
click node_voice_ui "https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/smart_voice_system.py"
click node_task "https://github.com/huang-jianhua/videogenius/blob/main/app/services/task.py"
click node_script "https://github.com/huang-jianhua/videogenius/blob/main/app/services/llm.py"
click node_materials "https://github.com/huang-jianhua/videogenius/blob/main/app/services/ai_material_generator.py"
click node_model_routing "https://github.com/huang-jianhua/videogenius/blob/main/app/services/model_router.py"
click node_load_balancer "https://github.com/huang-jianhua/videogenius/blob/main/app/services/load_balancer.py"
click node_failover "https://github.com/huang-jianhua/videogenius/blob/main/app/services/failover_manager.py"
click node_model_registry "https://github.com/huang-jianhua/videogenius/blob/main/app/services/model_manager.py"
click node_llm_interface "https://github.com/huang-jianhua/videogenius/blob/main/app/services/llm_interface.py"
click node_narration "https://github.com/huang-jianhua/videogenius/blob/main/app/services/voice.py"
click node_subtitles "https://github.com/huang-jianhua/videogenius/blob/main/app/services/subtitle.py"
click node_video "https://github.com/huang-jianhua/videogenius/blob/main/app/services/video.py"
click node_effects "https://github.com/huang-jianhua/videogenius/blob/main/app/services/utils/video_effects.py"
click node_state "https://github.com/huang-jianhua/videogenius/blob/main/app/services/state.py"
click node_api "https://github.com/huang-jianhua/videogenius/blob/main/app/asgi.py"
click node_router "https://github.com/huang-jianhua/videogenius/blob/main/app/router.py"
click node_video_api "https://github.com/huang-jianhua/videogenius/blob/main/app/controllers/v1/video.py"
click node_script_api "https://github.com/huang-jianhua/videogenius/blob/main/app/controllers/v1/llm.py"
click node_config "https://github.com/huang-jianhua/videogenius/blob/main/app/config/config.py"
click node_config_ui "https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/config_manager.py"
click node_enterprise "https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/enterprise_management.py"
click node_security "https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/enterprise_security.py"
click node_template "https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/template_library.py"
click node_batch "https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/batch_processor.py"
click node_export "https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/export_optimizer.py"
click node_vision "https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/ai_vision_analysis.py"

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_streamlit,node_creative,node_material_page,node_model_ui,node_subtitle_ui,node_voice_ui,node_template,node_batch,node_export,node_vision toneBlue
class node_task,node_narration,node_subtitles,node_video,node_effects toneAmber
class node_script,node_materials,node_model_routing,node_load_balancer,node_failover,node_model_registry,node_llm_interface toneMint
class node_state,node_api,node_router,node_video_api,node_script_api toneRose
class node_config,node_config_ui,node_enterprise,node_security,node_creator,node_external_models toneIndigo
```

## Components

### Creator experience

- [Creator workspace](https://github.com/huang-jianhua/videogenius/blob/main/webui/Main.py): `webui/Main.py`
- [Creative assistant](https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/ai_creative_assistant.py): `webui/pages/ai_creative_assistant.py`
- [Material generator UI](https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/ai_material_generator.py): `webui/pages/ai_material_generator.py`
- [Model management UI](https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/model_management.py): `webui/pages/model_management.py`
- [Subtitle system UI](https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/smart_subtitle_system.py): `webui/pages/smart_subtitle_system.py`
- [Voice system UI](https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/smart_voice_system.py): `webui/pages/smart_voice_system.py`
- [Template library](https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/template_library.py): `webui/pages/template_library.py`
- [Batch processing](https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/batch_processor.py): `webui/pages/batch_processor.py`
- [Export optimizer](https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/export_optimizer.py): `webui/pages/export_optimizer.py`
- [Vision analysis](https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/ai_vision_analysis.py): `webui/pages/ai_vision_analysis.py`

### Video production

- [Video task orchestration](https://github.com/huang-jianhua/videogenius/blob/main/app/services/task.py): `app/services/task.py`
- [Voice and narration](https://github.com/huang-jianhua/videogenius/blob/main/app/services/voice.py): `app/services/voice.py`
- [Subtitle generation](https://github.com/huang-jianhua/videogenius/blob/main/app/services/subtitle.py): `app/services/subtitle.py`
- [Video composition](https://github.com/huang-jianhua/videogenius/blob/main/app/services/video.py): `app/services/video.py`
- [Video effects](https://github.com/huang-jianhua/videogenius/blob/main/app/services/utils/video_effects.py): `app/services/utils/video_effects.py`

### AI services

- [Script and term generation](https://github.com/huang-jianhua/videogenius/blob/main/app/services/llm.py): `app/services/llm.py`
- [AI material generation](https://github.com/huang-jianhua/videogenius/blob/main/app/services/ai_material_generator.py): `app/services/ai_material_generator.py`
- [Model routing and balancing](https://github.com/huang-jianhua/videogenius/blob/main/app/services/model_router.py): `app/services/model_router.py`
- [Load balancing](https://github.com/huang-jianhua/videogenius/blob/main/app/services/load_balancer.py): `app/services/load_balancer.py`
- [Provider failover](https://github.com/huang-jianhua/videogenius/blob/main/app/services/failover_manager.py): `app/services/failover_manager.py`
- [Model registry and health](https://github.com/huang-jianhua/videogenius/blob/main/app/services/model_manager.py): `app/services/model_manager.py`
- [LLM provider interface](https://github.com/huang-jianhua/videogenius/blob/main/app/services/llm_interface.py): `app/services/llm_interface.py`

### API and tasks

- [Task state](https://github.com/huang-jianhua/videogenius/blob/main/app/services/state.py): `app/services/state.py`
- [FastAPI application](https://github.com/huang-jianhua/videogenius/blob/main/app/asgi.py): `app/asgi.py`
- [API routes](https://github.com/huang-jianhua/videogenius/blob/main/app/router.py): `app/router.py`
- [Video task endpoint](https://github.com/huang-jianhua/videogenius/blob/main/app/controllers/v1/video.py): `app/controllers/v1/video.py`
- [Script endpoint](https://github.com/huang-jianhua/videogenius/blob/main/app/controllers/v1/llm.py): `app/controllers/v1/llm.py`

### Configuration and enterprise

- [Application configuration](https://github.com/huang-jianhua/videogenius/blob/main/app/config/config.py): `app/config/config.py`
- [Configuration manager](https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/config_manager.py): `webui/pages/config_manager.py`
- [Enterprise management](https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/enterprise_management.py): `webui/pages/enterprise_management.py`
- [Enterprise security](https://github.com/huang-jianhua/videogenius/blob/main/webui/pages/enterprise_security.py): `webui/pages/enterprise_security.py`

### Other components

- **Creator**
- **AI model providers**

## Connections

- Creator → Creator workspace: uses
- Creator workspace → Video task orchestration: starts tasks (evidence: `webui/Main.py`)
- Creator workspace → Application configuration: reads settings (evidence: `webui/Main.py`)
- Creator workspace → Model management UI: offers (evidence: `webui/Main.py`)
- Creator workspace → Creative assistant: offers (evidence: `webui/Main.py`)
- Creator workspace → Subtitle system UI: offers (evidence: `webui/Main.py`)
- Creator workspace → Voice system UI: offers (evidence: `webui/Main.py`)
- Material generator UI → AI material generation: calls (evidence: `webui/pages/ai_material_generator.py`)
- Video task orchestration → Script and term generation: generates script (evidence: `app/services/task.py`)
- Video task orchestration → AI material generation: generates materials (evidence: `app/services/task.py`)
- Video task orchestration → Voice and narration: creates audio (evidence: `app/services/task.py`)
- Video task orchestration → Subtitle generation: creates subtitles (evidence: `app/services/task.py`)
- Video task orchestration → Video composition: composes video (evidence: `app/services/task.py`)
- Video task orchestration → Task state: updates state (evidence: `app/services/task.py`)
- Video composition → Video effects: applies effects
- Model routing and balancing → Script and term generation: routes models (evidence: `app/services/model_router.py`)
- Load balancing → Model routing and balancing: selects models (evidence: `app/services/load_balancer.py`)
- Provider failover → Load balancing: uses balancing (evidence: `app/services/failover_manager.py`)
- Provider failover → Model registry and health: checks providers (evidence: `app/services/failover_manager.py`)
- Model registry and health → LLM provider interface: registers providers (evidence: `app/services/model_manager.py`)
- Script and term generation → AI model providers: calls providers
- FastAPI application → API routes: mounts routes (evidence: `app/asgi.py`)
- API routes → Video task endpoint: registers (evidence: `app/router.py`)
- API routes → Script endpoint: registers (evidence: `app/router.py`)
- Video task endpoint → Video task orchestration: starts task (evidence: `app/controllers/v1/video.py`)
- Script endpoint → Script and term generation: generates script (evidence: `app/controllers/v1/llm.py`)
- Configuration manager → Application configuration: updates settings (evidence: `webui/pages/config_manager.py`)
- Model management UI → Model registry and health: manages models
- Enterprise management → Enterprise security: supports controls
- Creator workspace → Template library: offers (evidence: `webui/Main.py`)
- Creator workspace → Batch processing: offers (evidence: `webui/Main.py`)
- Creator workspace → Export optimizer: offers (evidence: `webui/Main.py`)
- Creator workspace → Vision analysis: offers (evidence: `webui/Main.py`)
