# narendramp15/yt-video architecture

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

## Overview

This repository implements an automated, trend-driven YouTube video pipeline. The main workflow discovers and ranks topics, generates long- and short-form scripts and SEO metadata, creates voice and visual assets, aligns narration to scenes, renders videos, reviews them, and optionally uploads them. Checkpoints support resuming runs; TTS and YouTube Analytics memories feed lessons back into later runs. The README documents capabilities beyond the sampled excerpts; those links are cited to it, while unsampled implementation details are not assumed.

Main entry points: [`workflows/long_video.py`](https://github.com/narendramp15/yt-video/blob/master/workflows/long_video.py) (Pipeline workflow), [`services/yt_analytics_memory_service.py`](https://github.com/narendramp15/yt-video/blob/master/services/yt_analytics_memory_service.py) (Analytics memory), [`services/topic_service.py`](https://github.com/narendramp15/yt-video/blob/master/services/topic_service.py) (Trend discovery), [`main.py`](https://github.com/narendramp15/yt-video/blob/master/main.py) (CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Pipeline control"]
  node_cli["CLI<br/>[main.py]"]
  node_workflow["Pipeline workflow<br/>[long_video.py]"]
end

subgraph group_content["Topic and content"]
  node_topic["Trend discovery<br/>[topic_service.py]"]
  node_script["Script generation<br/>[script_service.py]"]
  node_packaging["Title and thumbnail packaging"]
  node_review["Script review<br/>[review_service.py]"]
  node_x_service["X trends integration<br/>[x_service.py]"]
end

subgraph group_media["Media production"]
  node_tts["Voice synthesis<br/>[tts_service.py]"]
  node_tts_memory[("TTS style memory")]
  node_images["Scene image generation<br/>[image_service.py]"]
  node_clip["Image relevance check<br/>[clip_service.py]"]
  node_sync["Transcript and scene sync<br/>[sync_service.py]"]
  node_video["Video rendering<br/>[video_service.py]"]
  node_chart["Chart generation<br/>[chart_service.py]"]
end

subgraph group_publish["Publishing and learning"]
  node_analytics_memory[("Analytics memory")]
  node_youtube["YouTube publishing<br/>[youtube_service.py]"]
  node_analytics_service["Analytics collection"]
end

subgraph group_support["Runtime support"]
  node_checkpoint[("Step checkpoints")]
  node_cost[("API cost tracking<br/>[cost_service.py]")]
  node_config["Configuration<br/>[config.py]"]
  node_logger["Logging<br/>[logger.py]"]
end

node_operator(("Channel operator"))
node_signals["Trend sources"]

node_operator -->|"runs commands"| node_cli
node_cli -->|"starts pipeline"| node_workflow
node_workflow -->|"resumes steps"| node_checkpoint
node_workflow -->|"fetches and ranks"| node_topic
node_topic -->|"collects signals"| node_signals
node_workflow -->|"uses learned signals"| node_analytics_memory
node_analytics_memory -->|"biases ranking"| node_topic
node_workflow -->|"generates scripts"| node_script
node_analytics_memory -->|"provides performance notes"| node_script
node_workflow -->|"selects package"| node_packaging
node_workflow -->|"reviews script"| node_review
node_workflow -->|"generates narration"| node_tts
node_tts_memory -->|"supplies corrections"| node_tts
node_workflow -->|"updates voice memory"| node_tts_memory
node_workflow -->|"generates scene images"| node_images
node_images -->|"checks relevance"| node_clip
node_workflow -->|"aligns narration"| node_sync
node_workflow -->|"renders video"| node_video
node_workflow -->|"uploads video"| node_youtube
node_workflow -->|"fetches analytics"| node_analytics_service
node_youtube -->|"records video metadata"| node_analytics_service
node_analytics_service -->|"stores performance"| node_analytics_memory
node_workflow -.->|"optionally fetches trends"| node_x_service
node_workflow -.->|"uses chart assets"| node_chart
node_workflow -->|"tracks run costs"| node_cost
node_workflow -->|"reads settings"| node_config
node_workflow -->|"logs progress"| node_logger

click node_cli "https://github.com/narendramp15/yt-video/blob/master/main.py"
click node_workflow "https://github.com/narendramp15/yt-video/blob/master/workflows/long_video.py"
click node_checkpoint "https://github.com/narendramp15/yt-video/blob/master/services/checkpoint_service.py"
click node_topic "https://github.com/narendramp15/yt-video/blob/master/services/topic_service.py"
click node_analytics_memory "https://github.com/narendramp15/yt-video/blob/master/services/yt_analytics_memory_service.py"
click node_script "https://github.com/narendramp15/yt-video/blob/master/services/script_service.py"
click node_packaging "https://github.com/narendramp15/yt-video/blob/master/services/packaging_service.py"
click node_review "https://github.com/narendramp15/yt-video/blob/master/services/review_service.py"
click node_tts "https://github.com/narendramp15/yt-video/blob/master/services/tts_service.py"
click node_tts_memory "https://github.com/narendramp15/yt-video/blob/master/services/tts_memory_service.py"
click node_images "https://github.com/narendramp15/yt-video/blob/master/services/image_service.py"
click node_clip "https://github.com/narendramp15/yt-video/blob/master/services/clip_service.py"
click node_sync "https://github.com/narendramp15/yt-video/blob/master/services/sync_service.py"
click node_video "https://github.com/narendramp15/yt-video/blob/master/services/video_service.py"
click node_youtube "https://github.com/narendramp15/yt-video/blob/master/services/youtube_service.py"
click node_analytics_service "https://github.com/narendramp15/yt-video/blob/master/services/yt_analytics_memory_service.py"
click node_chart "https://github.com/narendramp15/yt-video/blob/master/services/chart_service.py"
click node_x_service "https://github.com/narendramp15/yt-video/blob/master/services/x_service.py"
click node_cost "https://github.com/narendramp15/yt-video/blob/master/services/cost_service.py"
click node_config "https://github.com/narendramp15/yt-video/blob/master/config.py"
click node_logger "https://github.com/narendramp15/yt-video/blob/master/logger.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_cli,node_workflow toneBlue
class node_topic,node_script,node_packaging,node_review,node_x_service toneAmber
class node_tts,node_tts_memory,node_images,node_clip,node_sync,node_video,node_chart toneMint
class node_analytics_memory,node_youtube,node_analytics_service toneRose
class node_checkpoint,node_cost,node_config,node_logger,node_operator,node_signals toneIndigo
```

## Components

### Pipeline control

- [CLI](https://github.com/narendramp15/yt-video/blob/master/main.py): `main.py`
- [Pipeline workflow](https://github.com/narendramp15/yt-video/blob/master/workflows/long_video.py): `workflows/long_video.py`

### Topic and content

- [Trend discovery](https://github.com/narendramp15/yt-video/blob/master/services/topic_service.py): `services/topic_service.py`
- [Script generation](https://github.com/narendramp15/yt-video/blob/master/services/script_service.py): `services/script_service.py`
- [Title and thumbnail packaging](https://github.com/narendramp15/yt-video/blob/master/services/packaging_service.py): `services/packaging_service.py`
- [Script review](https://github.com/narendramp15/yt-video/blob/master/services/review_service.py): `services/review_service.py`
- [X trends integration](https://github.com/narendramp15/yt-video/blob/master/services/x_service.py): `services/x_service.py`

### Media production

- [Voice synthesis](https://github.com/narendramp15/yt-video/blob/master/services/tts_service.py): `services/tts_service.py`
- [TTS style memory](https://github.com/narendramp15/yt-video/blob/master/services/tts_memory_service.py): `services/tts_memory_service.py`
- [Scene image generation](https://github.com/narendramp15/yt-video/blob/master/services/image_service.py): `services/image_service.py`
- [Image relevance check](https://github.com/narendramp15/yt-video/blob/master/services/clip_service.py): `services/clip_service.py`
- [Transcript and scene sync](https://github.com/narendramp15/yt-video/blob/master/services/sync_service.py): `services/sync_service.py`
- [Video rendering](https://github.com/narendramp15/yt-video/blob/master/services/video_service.py): `services/video_service.py`
- [Chart generation](https://github.com/narendramp15/yt-video/blob/master/services/chart_service.py): `services/chart_service.py`

### Publishing and learning

- [Analytics memory](https://github.com/narendramp15/yt-video/blob/master/services/yt_analytics_memory_service.py): `services/yt_analytics_memory_service.py`
- [YouTube publishing](https://github.com/narendramp15/yt-video/blob/master/services/youtube_service.py): `services/youtube_service.py`
- [Analytics collection](https://github.com/narendramp15/yt-video/blob/master/services/yt_analytics_memory_service.py): `services/yt_analytics_memory_service.py`

### Runtime support

- [Step checkpoints](https://github.com/narendramp15/yt-video/blob/master/services/checkpoint_service.py): `services/checkpoint_service.py`
- [API cost tracking](https://github.com/narendramp15/yt-video/blob/master/services/cost_service.py): `services/cost_service.py`
- [Configuration](https://github.com/narendramp15/yt-video/blob/master/config.py): `config.py`
- [Logging](https://github.com/narendramp15/yt-video/blob/master/logger.py): `logger.py`

### Other components

- **Channel operator**
- **Trend sources**

## Connections

- Channel operator → CLI: runs commands (evidence: `README.md`)
- CLI → Pipeline workflow: starts pipeline (evidence: `main.py`)
- Pipeline workflow → Step checkpoints: resumes steps (evidence: `workflows/long_video.py`)
- Pipeline workflow → Trend discovery: fetches and ranks (evidence: `workflows/long_video.py`)
- Trend discovery → Trend sources: collects signals (evidence: `README.md`)
- Pipeline workflow → Analytics memory: uses learned signals (evidence: `workflows/long_video.py`)
- Analytics memory → Trend discovery: biases ranking (evidence: `README.md`)
- Pipeline workflow → Script generation: generates scripts (evidence: `workflows/long_video.py`)
- Analytics memory → Script generation: provides performance notes (evidence: `README.md`)
- Pipeline workflow → Title and thumbnail packaging: selects package (evidence: `workflows/long_video.py`)
- Pipeline workflow → Script review: reviews script (evidence: `workflows/long_video.py`)
- Pipeline workflow → Voice synthesis: generates narration (evidence: `workflows/long_video.py`)
- TTS style memory → Voice synthesis: supplies corrections (evidence: `services/tts_service.py`)
- Pipeline workflow → TTS style memory: updates voice memory (evidence: `README.md`)
- Pipeline workflow → Scene image generation: generates scene images (evidence: `workflows/long_video.py`)
- Scene image generation → Image relevance check: checks relevance (evidence: `services/image_service.py`)
- Pipeline workflow → Transcript and scene sync: aligns narration (evidence: `workflows/long_video.py`)
- Pipeline workflow → Video rendering: renders video (evidence: `workflows/long_video.py`)
- Pipeline workflow → YouTube publishing: uploads video (evidence: `workflows/long_video.py`)
- Pipeline workflow → Analytics collection: fetches analytics (evidence: `README.md`)
- YouTube publishing → Analytics collection: records video metadata (evidence: `README.md`)
- Analytics collection → Analytics memory: stores performance (evidence: `README.md`)
- Pipeline workflow → X trends integration: optionally fetches trends (evidence: `workflows/long_video.py`)
- Pipeline workflow → Chart generation: uses chart assets
- Pipeline workflow → API cost tracking: tracks run costs (evidence: `workflows/long_video.py`)
- Pipeline workflow → Configuration: reads settings (evidence: `config.py`)
- Pipeline workflow → Logging: logs progress (evidence: `logger.py`)
