# tharshananth/ai_video_editor architecture

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

- Interactive diagram: https://gitdiagram.com/tharshananth/ai_video_editor
- Repository: https://github.com/tharshananth/ai_video_editor

## Overview

Framewise turns an uploaded screen recording into an edited product demo. The main path is upload and project creation, graph-driven frame/vision/audio analysis, timeline and narration planning, theme/voice selection and music generation, then dual-engine rendering with captions and downloadable output. Project files, SQLite metadata and WebSocket progress support that flow. Edges reflect the README and the sampled-source index; unsampled frontend and route internals limit detail on their interactions.

Main entry points: [`orchestration/graph_builder.py`](https://github.com/tharshananth/ai_video_editor/blob/main/orchestration/graph_builder.py) (Pipeline graph), [`rendering/render_orchestrator.py`](https://github.com/tharshananth/ai_video_editor/blob/main/rendering/render_orchestrator.py) (Render orchestration), [`api/main.py`](https://github.com/tharshananth/ai_video_editor/blob/main/api/main.py) (FastAPI endpoints), [`api/services/processing_service.py`](https://github.com/tharshananth/ai_video_editor/blob/main/api/services/processing_service.py) (Processing service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client and API"]
  node_frontend["Web interface<br/>[App.tsx]"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_upload["Upload and project routes<br/>[upload.py]"]
end

subgraph group_project["Project services"]
  node_project_service["Project service<br/>[project_service.py]"]
  node_processing["Processing service"]
  node_ws["Progress updates"]
end

subgraph group_pipeline["Analysis and planning"]
  node_graph["Pipeline graph<br/>[graph_builder.py]"]
  node_state_schema["Pipeline state<br/>[state_schema.py]"]
  node_frames["Frame extraction"]
  node_cursor["Cursor detection"]
  node_vision["Vision analysis"]
  node_audio["Audio analysis"]
  node_analysis["Edit analysis"]
  node_script["Script and edit plan"]
  node_music["Music generation"]
  node_theme["Theme and voice"]
end

subgraph group_render["Rendering"]
  node_render_orch["Render orchestration"]
  node_ffmpeg["FFmpeg processing"]
  node_moviepy["MoviePy fallback"]
end

subgraph group_state["Persistence and files"]
  node_project_manager["Project lifecycle<br/>[project_manager.py]"]
  node_files["Project files<br/>[file_manager.py]"]
  node_database[("SQLite metadata<br/>[database.py]")]
end

node_creator(("Video creator"))
node_ai_services{{"AI and voice providers"}}
node_final_video["Rendered video"]

node_creator -->|"uploads recording"| node_frontend
node_frontend -.->|"submits project"| node_api
node_api -->|"creates project"| node_project_service
node_api -->|"starts processing"| node_processing
node_api -->|"opens progress channel"| node_ws
node_project_service -->|"manages lifecycle"| node_project_manager
node_processing -->|"executes pipeline"| node_graph
node_processing -->|"sends updates"| node_ws
node_graph -->|"uses state"| node_state_schema
node_graph -->|"dispatches stage"| node_frames
node_graph -->|"dispatches stage"| node_cursor
node_graph -->|"dispatches stage"| node_vision
node_graph -->|"dispatches stage"| node_audio
node_graph -->|"dispatches stage"| node_analysis
node_graph -->|"dispatches stage"| node_script
node_graph -.->|"dispatches stage"| node_music
node_graph -->|"dispatches stage"| node_theme
node_frames -->|"samples frames"| node_ai_services
node_vision -->|"analyzes recording"| node_ai_services
node_audio -->|"transcribes audio"| node_ai_services
node_analysis -->|"analyzes timeline"| node_ai_services
node_script -->|"writes narration"| node_ai_services
node_music -->|"generates music"| node_ai_services
node_theme -->|"casts voice"| node_ai_services
node_graph -->|"invokes renderer"| node_render_orch
node_render_orch -->|"applies edits"| node_ffmpeg
node_render_orch -->|"uses fallback"| node_moviepy
node_render_orch -->|"requests music"| node_music
node_render_orch -->|"writes output"| node_final_video
node_project_manager -->|"creates project files"| node_files
node_project_manager -->|"stores metadata"| node_database
node_frames -->|"stores intermediates"| node_files
node_render_orch -->|"reads and writes assets"| node_files
node_api -.->|"serves download"| node_final_video

click node_frontend "https://github.com/tharshananth/ai_video_editor/blob/main/frontend/src/App.tsx"
click node_api "https://github.com/tharshananth/ai_video_editor/blob/main/api/main.py"
click node_upload "https://github.com/tharshananth/ai_video_editor/blob/main/api/routes/upload.py"
click node_project_service "https://github.com/tharshananth/ai_video_editor/blob/main/api/services/project_service.py"
click node_processing "https://github.com/tharshananth/ai_video_editor/blob/main/api/services/processing_service.py"
click node_ws "https://github.com/tharshananth/ai_video_editor/blob/main/api/services/websocket_manager.py"
click node_graph "https://github.com/tharshananth/ai_video_editor/blob/main/orchestration/graph_builder.py"
click node_state_schema "https://github.com/tharshananth/ai_video_editor/blob/main/orchestration/state_schema.py"
click node_frames "https://github.com/tharshananth/ai_video_editor/blob/main/agents/agent_1_frame_extractor.py"
click node_cursor "https://github.com/tharshananth/ai_video_editor/blob/main/agents/agent_2_cursor_detector.py"
click node_vision "https://github.com/tharshananth/ai_video_editor/blob/main/agents/agent_3_vision_description.py"
click node_audio "https://github.com/tharshananth/ai_video_editor/blob/main/agents/agent_4_audio_agent.py"
click node_analysis "https://github.com/tharshananth/ai_video_editor/blob/main/agents/agent_5_analysis_agent.py"
click node_script "https://github.com/tharshananth/ai_video_editor/blob/main/agents/agent_6_script_planner.py"
click node_music "https://github.com/tharshananth/ai_video_editor/blob/main/agents/agent_7_music_agent.py"
click node_theme "https://github.com/tharshananth/ai_video_editor/blob/main/agents/agent_8_theme_agent.py"
click node_render_orch "https://github.com/tharshananth/ai_video_editor/blob/main/rendering/render_orchestrator.py"
click node_ffmpeg "https://github.com/tharshananth/ai_video_editor/blob/main/rendering/ffmpeg_processor.py"
click node_moviepy "https://github.com/tharshananth/ai_video_editor/blob/main/rendering/moviepy_processor.py"
click node_project_manager "https://github.com/tharshananth/ai_video_editor/blob/main/utils/project_manager.py"
click node_files "https://github.com/tharshananth/ai_video_editor/blob/main/utils/file_manager.py"
click node_database "https://github.com/tharshananth/ai_video_editor/blob/main/utils/database.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_frontend,node_api,node_upload toneBlue
class node_project_service,node_processing,node_ws toneAmber
class node_graph,node_state_schema,node_frames,node_cursor,node_vision,node_audio,node_analysis,node_script,node_music,node_theme toneMint
class node_render_orch,node_ffmpeg,node_moviepy toneRose
class node_project_manager,node_files,node_database,node_creator,node_ai_services,node_final_video toneIndigo
```

## Components

### Client and API

- [Web interface](https://github.com/tharshananth/ai_video_editor/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [FastAPI endpoints](https://github.com/tharshananth/ai_video_editor/blob/main/api/main.py): `api/main.py`
- [Upload and project routes](https://github.com/tharshananth/ai_video_editor/blob/main/api/routes/upload.py): `api/routes/upload.py`

### Project services

- [Project service](https://github.com/tharshananth/ai_video_editor/blob/main/api/services/project_service.py): `api/services/project_service.py`
- [Processing service](https://github.com/tharshananth/ai_video_editor/blob/main/api/services/processing_service.py): `api/services/processing_service.py`
- [Progress updates](https://github.com/tharshananth/ai_video_editor/blob/main/api/services/websocket_manager.py): `api/services/websocket_manager.py`

### Analysis and planning

- [Pipeline graph](https://github.com/tharshananth/ai_video_editor/blob/main/orchestration/graph_builder.py): `orchestration/graph_builder.py`
- [Pipeline state](https://github.com/tharshananth/ai_video_editor/blob/main/orchestration/state_schema.py): `orchestration/state_schema.py`
- [Frame extraction](https://github.com/tharshananth/ai_video_editor/blob/main/agents/agent_1_frame_extractor.py): `agents/agent_1_frame_extractor.py`
- [Cursor detection](https://github.com/tharshananth/ai_video_editor/blob/main/agents/agent_2_cursor_detector.py): `agents/agent_2_cursor_detector.py`
- [Vision analysis](https://github.com/tharshananth/ai_video_editor/blob/main/agents/agent_3_vision_description.py): `agents/agent_3_vision_description.py`
- [Audio analysis](https://github.com/tharshananth/ai_video_editor/blob/main/agents/agent_4_audio_agent.py): `agents/agent_4_audio_agent.py`
- [Edit analysis](https://github.com/tharshananth/ai_video_editor/blob/main/agents/agent_5_analysis_agent.py): `agents/agent_5_analysis_agent.py`
- [Script and edit plan](https://github.com/tharshananth/ai_video_editor/blob/main/agents/agent_6_script_planner.py): `agents/agent_6_script_planner.py`
- [Music generation](https://github.com/tharshananth/ai_video_editor/blob/main/agents/agent_7_music_agent.py): `agents/agent_7_music_agent.py`
- [Theme and voice](https://github.com/tharshananth/ai_video_editor/blob/main/agents/agent_8_theme_agent.py): `agents/agent_8_theme_agent.py`

### Rendering

- [Render orchestration](https://github.com/tharshananth/ai_video_editor/blob/main/rendering/render_orchestrator.py): `rendering/render_orchestrator.py`
- [FFmpeg processing](https://github.com/tharshananth/ai_video_editor/blob/main/rendering/ffmpeg_processor.py): `rendering/ffmpeg_processor.py`
- [MoviePy fallback](https://github.com/tharshananth/ai_video_editor/blob/main/rendering/moviepy_processor.py): `rendering/moviepy_processor.py`

### Persistence and files

- [Project lifecycle](https://github.com/tharshananth/ai_video_editor/blob/main/utils/project_manager.py): `utils/project_manager.py`
- [Project files](https://github.com/tharshananth/ai_video_editor/blob/main/utils/file_manager.py): `utils/file_manager.py`
- [SQLite metadata](https://github.com/tharshananth/ai_video_editor/blob/main/utils/database.py): `utils/database.py`

### Other components

- **Video creator**
- **AI and voice providers**
- **Rendered video**

## Connections

- Video creator → Web interface: uploads recording (evidence: `README.md`)
- Web interface → FastAPI endpoints: submits project
- FastAPI endpoints → Project service: creates project (evidence: `api/main.py`)
- FastAPI endpoints → Processing service: starts processing (evidence: `api/main.py`)
- FastAPI endpoints → Progress updates: opens progress channel (evidence: `api/main.py`)
- Project service → Project lifecycle: manages lifecycle (evidence: `api/services/project_service.py`)
- Processing service → Pipeline graph: executes pipeline (evidence: `api/services/processing_service.py`)
- Processing service → Progress updates: sends updates (evidence: `api/services/processing_service.py`)
- Pipeline graph → Pipeline state: uses state (evidence: `orchestration/graph_builder.py`)
- Pipeline graph → Frame extraction: dispatches stage
- Pipeline graph → Cursor detection: dispatches stage
- Pipeline graph → Vision analysis: dispatches stage
- Pipeline graph → Audio analysis: dispatches stage
- Pipeline graph → Edit analysis: dispatches stage
- Pipeline graph → Script and edit plan: dispatches stage
- Pipeline graph → Music generation: dispatches stage
- Pipeline graph → Theme and voice: dispatches stage
- Frame extraction → AI and voice providers: samples frames (evidence: `README.md`)
- Vision analysis → AI and voice providers: analyzes recording (evidence: `README.md`)
- Audio analysis → AI and voice providers: transcribes audio (evidence: `README.md`)
- Edit analysis → AI and voice providers: analyzes timeline (evidence: `README.md`)
- Script and edit plan → AI and voice providers: writes narration (evidence: `README.md`)
- Music generation → AI and voice providers: generates music (evidence: `README.md`)
- Theme and voice → AI and voice providers: casts voice (evidence: `README.md`)
- Pipeline graph → Render orchestration: invokes renderer
- Render orchestration → FFmpeg processing: applies edits (evidence: `rendering/render_orchestrator.py`)
- Render orchestration → MoviePy fallback: uses fallback (evidence: `rendering/render_orchestrator.py`)
- Render orchestration → Music generation: requests music (evidence: `rendering/render_orchestrator.py`)
- Render orchestration → Rendered video: writes output (evidence: `README.md`)
- Project lifecycle → Project files: creates project files (evidence: `utils/project_manager.py`)
- Project lifecycle → SQLite metadata: stores metadata (evidence: `utils/project_manager.py`)
- Frame extraction → Project files: stores intermediates (evidence: `agents/agent_1_frame_extractor.py`)
- Render orchestration → Project files: reads and writes assets (evidence: `rendering/render_orchestrator.py`)
- FastAPI endpoints → Rendered video: serves download
