# aandrew-me/ytdownloader architecture

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

- Interactive diagram: https://gitdiagram.com/aandrew-me/ytdownloader
- Repository: https://github.com/aandrew-me/ytdownloader

## Overview

ytDownloader is an Electron desktop app for downloading video and audio from many sites. Users choose a single-item or playlist workflow, configure format and advanced options, and manage download progress; the app also provides compression, preferences, and download history. The excerpts show renderer-side download execution, playlist formatting, compression via ffmpeg tools, and history persistence. Some UI-to-main-process wiring and unsampled feature internals are not visible, so those relationships are omitted or marked unverified.

Main entry points: [`src/utils.js`](https://github.com/aandrew-me/ytdownloader/blob/main/src/utils.js) (Renderer utilities), [`main.js`](https://github.com/aandrew-me/ytdownloader/blob/main/main.js) (Electron shell), [`src/renderer.js`](https://github.com/aandrew-me/ytdownloader/blob/main/src/renderer.js) (Single downloads), [`src/playlist.js`](https://github.com/aandrew-me/ytdownloader/blob/main/src/playlist.js) (Playlist downloads)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop shell"]
  node_electron["Electron shell<br/>[main.js]"]
  node_bridge["Renderer bridge<br/>[preload.js]"]
end

subgraph group_downloads["Download workflows"]
  node_home["Single downloads<br/>[renderer.js]"]
  node_playlist["Playlist downloads<br/>[playlist.js]"]
  node_yt_dlp["yt-dlp engine"]
end

subgraph group_media["Media tools"]
  node_compressor["Video compressor<br/>[compressor.js]"]
end

subgraph group_library["History and preferences"]
  node_preferences["Download preferences<br/>[preferences.js]"]
  node_history_ui["History interface<br/>[history_ui.js]"]
  node_history_store[("History manager<br/>[history.js]")]
end

subgraph group_shared["Shared renderer"]
  node_navigation["View navigation<br/>[common.js]"]
  node_format_mode["Video and audio mode<br/>[index.js]"]
  node_renderer_utils["Renderer utilities<br/>[utils.js]"]
end

node_user(("Desktop user"))
node_ffmpeg["FFmpeg tools"]

node_user -->|"uses"| node_electron
node_home -->|"runs downloads"| node_yt_dlp
node_playlist -.->|"runs batches"| node_yt_dlp
node_compressor -->|"compresses with"| node_ffmpeg
node_electron -->|"imports"| node_history_store
node_history_ui -.->|"requests history"| node_history_store
node_electron -.->|"configures"| node_bridge
node_home -->|"imports helpers"| node_renderer_utils
node_playlist -->|"imports helpers"| node_renderer_utils
node_compressor -->|"imports helpers"| node_renderer_utils
node_preferences -->|"imports helpers"| node_renderer_utils
node_history_ui -->|"imports helpers"| node_renderer_utils
node_navigation -->|"imports helpers"| node_renderer_utils
node_format_mode -->|"imports helpers"| node_renderer_utils

click node_electron "https://github.com/aandrew-me/ytdownloader/blob/main/main.js"
click node_bridge "https://github.com/aandrew-me/ytdownloader/blob/main/preload.js"
click node_home "https://github.com/aandrew-me/ytdownloader/blob/main/src/renderer.js"
click node_playlist "https://github.com/aandrew-me/ytdownloader/blob/main/src/playlist.js"
click node_compressor "https://github.com/aandrew-me/ytdownloader/blob/main/src/compressor.js"
click node_preferences "https://github.com/aandrew-me/ytdownloader/blob/main/src/preferences.js"
click node_history_ui "https://github.com/aandrew-me/ytdownloader/blob/main/src/history_ui.js"
click node_history_store "https://github.com/aandrew-me/ytdownloader/blob/main/src/history.js"
click node_navigation "https://github.com/aandrew-me/ytdownloader/blob/main/src/common.js"
click node_format_mode "https://github.com/aandrew-me/ytdownloader/blob/main/src/index.js"
click node_renderer_utils "https://github.com/aandrew-me/ytdownloader/blob/main/src/utils.js"

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_electron,node_bridge,node_user toneBlue
class node_home,node_playlist,node_yt_dlp toneAmber
class node_compressor toneMint
class node_preferences,node_history_ui,node_history_store toneRose
class node_navigation,node_format_mode,node_renderer_utils,node_ffmpeg toneIndigo
```

## Components

### Desktop shell

- [Electron shell](https://github.com/aandrew-me/ytdownloader/blob/main/main.js): `main.js`
- [Renderer bridge](https://github.com/aandrew-me/ytdownloader/blob/main/preload.js): `preload.js`

### Download workflows

- [Single downloads](https://github.com/aandrew-me/ytdownloader/blob/main/src/renderer.js): `src/renderer.js`
- [Playlist downloads](https://github.com/aandrew-me/ytdownloader/blob/main/src/playlist.js): `src/playlist.js`
- **yt-dlp engine**

### Media tools

- [Video compressor](https://github.com/aandrew-me/ytdownloader/blob/main/src/compressor.js): `src/compressor.js`

### History and preferences

- [Download preferences](https://github.com/aandrew-me/ytdownloader/blob/main/src/preferences.js): `src/preferences.js`
- [History interface](https://github.com/aandrew-me/ytdownloader/blob/main/src/history_ui.js): `src/history_ui.js`
- [History manager](https://github.com/aandrew-me/ytdownloader/blob/main/src/history.js): `src/history.js`

### Shared renderer

- [View navigation](https://github.com/aandrew-me/ytdownloader/blob/main/src/common.js): `src/common.js`
- [Video and audio mode](https://github.com/aandrew-me/ytdownloader/blob/main/src/index.js): `src/index.js`
- [Renderer utilities](https://github.com/aandrew-me/ytdownloader/blob/main/src/utils.js): `src/utils.js`

### Other components

- **Desktop user**
- **FFmpeg tools**

## Connections

- Desktop user → Electron shell: uses (evidence: `README.md`)
- Single downloads → yt-dlp engine: runs downloads (evidence: `README.md`)
- Playlist downloads → yt-dlp engine: runs batches
- Video compressor → FFmpeg tools: compresses with (evidence: `README.md`)
- Electron shell → History manager: imports (evidence: `main.js`)
- History interface → History manager: requests history
- Electron shell → Renderer bridge: configures
- Single downloads → Renderer utilities: imports helpers (evidence: `src/renderer.js`)
- Playlist downloads → Renderer utilities: imports helpers (evidence: `src/playlist.js`)
- Video compressor → Renderer utilities: imports helpers (evidence: `src/compressor.js`)
- Download preferences → Renderer utilities: imports helpers (evidence: `src/preferences.js`)
- History interface → Renderer utilities: imports helpers (evidence: `src/history_ui.js`)
- View navigation → Renderer utilities: imports helpers (evidence: `src/common.js`)
- Video and audio mode → Renderer utilities: imports helpers (evidence: `src/index.js`)
