# raushan728/downloader architecture

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

- Interactive diagram: https://gitdiagram.com/raushan728/downloader
- Repository: https://github.com/raushan728/downloader

## Overview

DWDR is a Rust media downloader with a CLI-led workflow: users provide a URL, the application validates it, prepares its local yt-dlp dependency, fetches media formats, selects a quality, and downloads to the configured directory. Configuration can be loaded, displayed, edited interactively or by command, reset, and saved. The CLI exposes browser/web mode selection, but the sampled entry point only prints a startup message; no web server implementation is evidenced. The queue module is currently a stub. Arrows reflect calls and integrations visible in the excerpts; no README content was provided.

Main entry points: [`src/main.rs`](https://github.com/raushan728/downloader/blob/master/src/main.rs) (Application Flow), [`src/config/manager.rs`](https://github.com/raushan728/downloader/blob/master/src/config/manager.rs) (Config Manager), [`src/engine/downloader.rs`](https://github.com/raushan728/downloader/blob/master/src/engine/downloader.rs) (Media Download), [`src/engine/updater.rs`](https://github.com/raushan728/downloader/blob/master/src/engine/updater.rs) (Dependency Setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application Entry"]
  node_main["Application Flow<br/>[main.rs]"]
  node_cli["CLI Router<br/>[router.rs]"]
  node_webmode["Web Mode Selection<br/>[main.rs]"]
end

subgraph group_config["Configuration"]
  node_configmgr["Config Manager<br/>[manager.rs]"]
  node_configstore[("Config File")]
  node_configprompt["Config Prompts<br/>[prompts.rs]"]
  node_queue["Download Activity Check<br/>[queue.rs]"]
end

subgraph group_media["Media Download"]
  node_mediafetch["Media Metadata Fetch<br/>[downloader.rs]"]
  node_quality["Quality Matching<br/>[downloader.rs]"]
  node_formatprompt["Format Selection<br/>[prompts.rs]"]
  node_download["Media Download<br/>[downloader.rs]"]
end

subgraph group_support["Runtime Support"]
  node_validator["URL Validator<br/>[validator.rs]"]
  node_paths["Dependency Paths<br/>[paths.rs]"]
  node_updater["Dependency Setup<br/>[updater.rs]"]
end

node_user(("User"))
node_release["yt-dlp Release"]
node_mediasource["Media Source"]
node_ytdlp["Local yt-dlp"]
node_ffmpeg["Local ffmpeg"]
node_downloadfolder[("Download Directory")]

node_user -->|"provides input"| node_main
node_main -->|"parses arguments"| node_cli
node_main -->|"loads configuration"| node_configmgr
node_configmgr -->|"reads or writes"| node_configstore
node_main -->|"validates URL"| node_validator
node_main -->|"resolves paths"| node_paths
node_main -->|"ensures dependency"| node_updater
node_updater -->|"gets yt-dlp path"| node_paths
node_updater -->|"downloads binary"| node_release
node_main -->|"fetches metadata"| node_mediafetch
node_mediafetch -->|"runs metadata query"| node_ytdlp
node_ytdlp -.->|"queries source"| node_mediasource
node_main -->|"matches quality"| node_quality
node_main -->|"requests selection"| node_formatprompt
node_formatprompt -->|"presents formats"| node_user
node_main -->|"starts download"| node_download
node_download -->|"runs download"| node_ytdlp
node_download -->|"uses if present"| node_ffmpeg
node_download -->|"writes media"| node_downloadfolder
node_main -->|"handles config command"| node_configmgr
node_configmgr -->|"opens interactive editor"| node_configprompt
node_configmgr -->|"checks active downloads"| node_queue
node_configprompt -->|"saves settings"| node_configmgr
node_main -->|"selects UI mode"| node_webmode
node_webmode -->|"prints startup status"| node_user

click node_main "https://github.com/raushan728/downloader/blob/master/src/main.rs"
click node_cli "https://github.com/raushan728/downloader/blob/master/src/cli/router.rs"
click node_webmode "https://github.com/raushan728/downloader/blob/master/src/main.rs"
click node_configmgr "https://github.com/raushan728/downloader/blob/master/src/config/manager.rs"
click node_configprompt "https://github.com/raushan728/downloader/blob/master/src/cli/prompts.rs"
click node_queue "https://github.com/raushan728/downloader/blob/master/src/engine/queue.rs"
click node_validator "https://github.com/raushan728/downloader/blob/master/src/utils/validator.rs"
click node_paths "https://github.com/raushan728/downloader/blob/master/src/engine/paths.rs"
click node_updater "https://github.com/raushan728/downloader/blob/master/src/engine/updater.rs"
click node_mediafetch "https://github.com/raushan728/downloader/blob/master/src/engine/downloader.rs"
click node_quality "https://github.com/raushan728/downloader/blob/master/src/engine/downloader.rs"
click node_formatprompt "https://github.com/raushan728/downloader/blob/master/src/cli/prompts.rs"
click node_download "https://github.com/raushan728/downloader/blob/master/src/engine/downloader.rs"

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_main,node_cli,node_webmode,node_user toneBlue
class node_configmgr,node_configstore,node_configprompt,node_queue,node_downloadfolder toneAmber
class node_mediafetch,node_quality,node_formatprompt,node_download toneMint
class node_validator,node_paths,node_updater toneRose
class node_release,node_mediasource,node_ytdlp,node_ffmpeg toneIndigo
```

## Components

### Application Entry

- [Application Flow](https://github.com/raushan728/downloader/blob/master/src/main.rs): `src/main.rs`
- [CLI Router](https://github.com/raushan728/downloader/blob/master/src/cli/router.rs): `src/cli/router.rs`
- [Web Mode Selection](https://github.com/raushan728/downloader/blob/master/src/main.rs): `src/main.rs`

### Configuration

- [Config Manager](https://github.com/raushan728/downloader/blob/master/src/config/manager.rs): `src/config/manager.rs`
- **Config File**
- [Config Prompts](https://github.com/raushan728/downloader/blob/master/src/cli/prompts.rs): `src/cli/prompts.rs`
- [Download Activity Check](https://github.com/raushan728/downloader/blob/master/src/engine/queue.rs): `src/engine/queue.rs`

### Media Download

- [Media Metadata Fetch](https://github.com/raushan728/downloader/blob/master/src/engine/downloader.rs): `src/engine/downloader.rs`
- [Quality Matching](https://github.com/raushan728/downloader/blob/master/src/engine/downloader.rs): `src/engine/downloader.rs`
- [Format Selection](https://github.com/raushan728/downloader/blob/master/src/cli/prompts.rs): `src/cli/prompts.rs`
- [Media Download](https://github.com/raushan728/downloader/blob/master/src/engine/downloader.rs): `src/engine/downloader.rs`

### Runtime Support

- [URL Validator](https://github.com/raushan728/downloader/blob/master/src/utils/validator.rs): `src/utils/validator.rs`
- [Dependency Paths](https://github.com/raushan728/downloader/blob/master/src/engine/paths.rs): `src/engine/paths.rs`
- [Dependency Setup](https://github.com/raushan728/downloader/blob/master/src/engine/updater.rs): `src/engine/updater.rs`

### Other components

- **User**
- **yt-dlp Release**
- **Media Source**
- **Local yt-dlp**
- **Local ffmpeg**
- **Download Directory**

## Connections

- User → Application Flow: provides input (evidence: `src/main.rs`)
- Application Flow → CLI Router: parses arguments (evidence: `src/main.rs`)
- Application Flow → Config Manager: loads configuration (evidence: `src/main.rs`)
- Config Manager → Config File: reads or writes (evidence: `src/config/manager.rs`)
- Application Flow → URL Validator: validates URL (evidence: `src/main.rs`)
- Application Flow → Dependency Paths: resolves paths (evidence: `src/main.rs`)
- Application Flow → Dependency Setup: ensures dependency (evidence: `src/main.rs`)
- Dependency Setup → Dependency Paths: gets yt-dlp path (evidence: `src/engine/updater.rs`)
- Dependency Setup → yt-dlp Release: downloads binary (evidence: `src/engine/updater.rs`)
- Application Flow → Media Metadata Fetch: fetches metadata (evidence: `src/main.rs`)
- Media Metadata Fetch → Local yt-dlp: runs metadata query (evidence: `src/engine/downloader.rs`)
- Local yt-dlp → Media Source: queries source
- Application Flow → Quality Matching: matches quality (evidence: `src/main.rs`)
- Application Flow → Format Selection: requests selection (evidence: `src/main.rs`)
- Format Selection → User: presents formats (evidence: `src/cli/prompts.rs`)
- Application Flow → Media Download: starts download (evidence: `src/main.rs`)
- Media Download → Local yt-dlp: runs download (evidence: `src/engine/downloader.rs`)
- Media Download → Local ffmpeg: uses if present (evidence: `src/engine/downloader.rs`)
- Media Download → Download Directory: writes media (evidence: `src/engine/downloader.rs`)
- Application Flow → Config Manager: handles config command (evidence: `src/main.rs`)
- Config Manager → Config Prompts: opens interactive editor (evidence: `src/config/manager.rs`)
- Config Manager → Download Activity Check: checks active downloads (evidence: `src/config/manager.rs`)
- Config Prompts → Config Manager: saves settings (evidence: `src/cli/prompts.rs`)
- Application Flow → Web Mode Selection: selects UI mode (evidence: `src/main.rs`)
- Web Mode Selection → User: prints startup status (evidence: `src/main.rs`)
