# tzahi12345/youtubedl-material architecture

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

- Interactive diagram: https://gitdiagram.com/tzahi12345/youtubedl-material
- Repository: https://github.com/tzahi12345/youtubedl-material

## Overview

YoutubeDL-Material is a browser-based YouTube/video downloader and media manager: users submit a URL, the server runs a download, and users manage or retrieve the resulting files. The Angular frontend also exposes subscriptions, scheduled tasks, archives, playlists, Twitch chat, authentication, settings, and notifications. The backend is organized around an Express API, feature services, and a database abstraction. Edges reflect the shown excerpts, SOURCE INDEX references, or README; links whose runtime wiring is not shown are omitted or marked unverified.

Main entry points: [`backend/app.js`](https://github.com/tzahi12345/youtubedl-material/blob/master/backend/app.js) (Express API), [`backend/db.js`](https://github.com/tzahi12345/youtubedl-material/blob/master/backend/db.js) (Database), [`backend/tasks.js`](https://github.com/tzahi12345/youtubedl-material/blob/master/backend/tasks.js) (Scheduled tasks), [`backend/subscriptions.js`](https://github.com/tzahi12345/youtubedl-material/blob/master/backend/subscriptions.js) (Subscriptions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web frontend"]
  node_main["Download screen<br/>[main.component.ts]"]
  node_downloads["Download manager"]
  node_player["Media player"]
  node_frontend_features["Media management UI"]
  node_posts["API client<br/>[posts.services.ts]"]
  node_api_types["API types"]
end

subgraph group_server["API and downloads"]
  node_api["Express API<br/>[app.js]"]
  node_downloader["Download execution<br/>[downloader.js]"]
  node_ytdl["youtube-dl integration<br/>[youtube-dl.js]"]
end

subgraph group_features["Media features"]
  node_files["File management<br/>[files.js]"]
  node_subscriptions["Subscriptions<br/>[subscriptions.js]"]
  node_tasks["Scheduled tasks<br/>[tasks.js]"]
  node_archive["Archives<br/>[archive.js]"]
  node_categories["Categories<br/>[categories.js]"]
  node_twitch["Twitch support<br/>[twitch.js]"]
  node_notifications["Notifications<br/>[notifications.js]"]
end

subgraph group_internal["Backend foundations"]
  node_auth["Authentication<br/>[auth.js]"]
  node_db[("Database<br/>[db.js]")]
  node_config["Configuration<br/>[config.js]"]
  node_logger["Logging<br/>[logger.js]"]
end

node_user(("User"))

node_user -->|"submits URL"| node_main
node_main -->|"requests downloads"| node_posts
node_main -->|"loads config"| node_posts
node_main -.->|"manages downloads"| node_downloads
node_main -.->|"opens media"| node_player
node_posts -->|"uses types"| node_api_types
node_posts -.->|"sends HTTP requests"| node_api
node_api -.->|"dispatches downloads"| node_downloader
node_api -->|"uses authentication"| node_auth
node_api -->|"reads records"| node_db
node_api -->|"delegates file actions"| node_files
node_api -->|"delegates subscription actions"| node_subscriptions
node_api -->|"uses task services"| node_tasks
node_api -->|"uses category services"| node_categories
node_api -->|"uses Twitch services"| node_twitch
node_api -->|"uses download integration"| node_ytdl
node_api -->|"uses archive services"| node_archive
node_api -->|"uses notifications"| node_notifications
node_downloader -->|"uses integration"| node_ytdl
node_files -->|"reads and writes"| node_db
node_files -->|"uses archive services"| node_archive
node_subscriptions -->|"uses download service"| node_downloader
node_subscriptions -->|"uses integration"| node_ytdl
node_subscriptions -->|"uses archive services"| node_archive
node_subscriptions -->|"reads and writes"| node_db
node_tasks -->|"runs subscription tasks"| node_subscriptions
node_tasks -->|"checks file records"| node_files
node_tasks -->|"uses archive services"| node_archive
node_tasks -->|"uses notifications"| node_notifications
node_tasks -->|"reads and updates tasks"| node_db
node_notifications -->|"uses records"| node_db
node_auth -->|"reads and updates users"| node_db
node_config -->|"logs errors"| node_logger
node_db -->|"uses configuration"| node_config
node_db -->|"logs operations"| node_logger

click node_main "https://github.com/tzahi12345/youtubedl-material/blob/master/src/app/main/main.component.ts"
click node_downloads "https://github.com/tzahi12345/youtubedl-material/blob/master/src/app/components/downloads/downloads.component.ts"
click node_player "https://github.com/tzahi12345/youtubedl-material/blob/master/src/app/player/player.component.ts"
click node_frontend_features "https://github.com/tzahi12345/youtubedl-material/tree/master/src/app"
click node_posts "https://github.com/tzahi12345/youtubedl-material/blob/master/src/app/posts.services.ts"
click node_api_types "https://github.com/tzahi12345/youtubedl-material/tree/master/src/api-types"
click node_api "https://github.com/tzahi12345/youtubedl-material/blob/master/backend/app.js"
click node_downloader "https://github.com/tzahi12345/youtubedl-material/blob/master/backend/downloader.js"
click node_ytdl "https://github.com/tzahi12345/youtubedl-material/blob/master/backend/youtube-dl.js"
click node_files "https://github.com/tzahi12345/youtubedl-material/blob/master/backend/files.js"
click node_subscriptions "https://github.com/tzahi12345/youtubedl-material/blob/master/backend/subscriptions.js"
click node_tasks "https://github.com/tzahi12345/youtubedl-material/blob/master/backend/tasks.js"
click node_archive "https://github.com/tzahi12345/youtubedl-material/blob/master/backend/archive.js"
click node_categories "https://github.com/tzahi12345/youtubedl-material/blob/master/backend/categories.js"
click node_twitch "https://github.com/tzahi12345/youtubedl-material/blob/master/backend/twitch.js"
click node_notifications "https://github.com/tzahi12345/youtubedl-material/blob/master/backend/notifications.js"
click node_auth "https://github.com/tzahi12345/youtubedl-material/blob/master/backend/authentication/auth.js"
click node_db "https://github.com/tzahi12345/youtubedl-material/blob/master/backend/db.js"
click node_config "https://github.com/tzahi12345/youtubedl-material/blob/master/backend/config.js"
click node_logger "https://github.com/tzahi12345/youtubedl-material/blob/master/backend/logger.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_main,node_downloads,node_player,node_frontend_features,node_posts,node_api_types,node_user toneBlue
class node_api,node_downloader,node_ytdl toneAmber
class node_files,node_subscriptions,node_tasks,node_archive,node_categories,node_twitch,node_notifications toneMint
class node_auth,node_db,node_config,node_logger toneRose
```

## Components

### Web frontend

- [Download screen](https://github.com/tzahi12345/youtubedl-material/blob/master/src/app/main/main.component.ts): `src/app/main/main.component.ts`
- [Download manager](https://github.com/tzahi12345/youtubedl-material/blob/master/src/app/components/downloads/downloads.component.ts): `src/app/components/downloads/downloads.component.ts`
- [Media player](https://github.com/tzahi12345/youtubedl-material/blob/master/src/app/player/player.component.ts): `src/app/player/player.component.ts`
- [Media management UI](https://github.com/tzahi12345/youtubedl-material/tree/master/src/app): `src/app`
- [API client](https://github.com/tzahi12345/youtubedl-material/blob/master/src/app/posts.services.ts): `src/app/posts.services.ts`
- [API types](https://github.com/tzahi12345/youtubedl-material/tree/master/src/api-types): `src/api-types`

### API and downloads

- [Express API](https://github.com/tzahi12345/youtubedl-material/blob/master/backend/app.js): `backend/app.js`
- [Download execution](https://github.com/tzahi12345/youtubedl-material/blob/master/backend/downloader.js): `backend/downloader.js`
- [youtube-dl integration](https://github.com/tzahi12345/youtubedl-material/blob/master/backend/youtube-dl.js): `backend/youtube-dl.js`

### Media features

- [File management](https://github.com/tzahi12345/youtubedl-material/blob/master/backend/files.js): `backend/files.js`
- [Subscriptions](https://github.com/tzahi12345/youtubedl-material/blob/master/backend/subscriptions.js): `backend/subscriptions.js`
- [Scheduled tasks](https://github.com/tzahi12345/youtubedl-material/blob/master/backend/tasks.js): `backend/tasks.js`
- [Archives](https://github.com/tzahi12345/youtubedl-material/blob/master/backend/archive.js): `backend/archive.js`
- [Categories](https://github.com/tzahi12345/youtubedl-material/blob/master/backend/categories.js): `backend/categories.js`
- [Twitch support](https://github.com/tzahi12345/youtubedl-material/blob/master/backend/twitch.js): `backend/twitch.js`
- [Notifications](https://github.com/tzahi12345/youtubedl-material/blob/master/backend/notifications.js): `backend/notifications.js`

### Backend foundations

- [Authentication](https://github.com/tzahi12345/youtubedl-material/blob/master/backend/authentication/auth.js): `backend/authentication/auth.js`
- [Database](https://github.com/tzahi12345/youtubedl-material/blob/master/backend/db.js): `backend/db.js`
- [Configuration](https://github.com/tzahi12345/youtubedl-material/blob/master/backend/config.js): `backend/config.js`
- [Logging](https://github.com/tzahi12345/youtubedl-material/blob/master/backend/logger.js): `backend/logger.js`

### Other components

- **User**

## Connections

- User → Download screen: submits URL
- Download screen → API client: requests downloads (evidence: `src/app/main/main.component.ts`)
- Download screen → API client: loads config (evidence: `src/app/main/main.component.ts`)
- Download screen → Download manager: manages downloads
- Download screen → Media player: opens media
- API client → API types: uses types (evidence: `src/app/posts.services.ts`)
- API client → Express API: sends HTTP requests
- Express API → Download execution: dispatches downloads (evidence: `backend/app.js`)
- Express API → Authentication: uses authentication (evidence: `backend/app.js`)
- Express API → Database: reads records (evidence: `backend/app.js`)
- Express API → File management: delegates file actions (evidence: `backend/app.js`)
- Express API → Subscriptions: delegates subscription actions (evidence: `backend/app.js`)
- Express API → Scheduled tasks: uses task services (evidence: `backend/app.js`)
- Express API → Categories: uses category services (evidence: `backend/app.js`)
- Express API → Twitch support: uses Twitch services (evidence: `backend/app.js`)
- Express API → youtube-dl integration: uses download integration (evidence: `backend/app.js`)
- Express API → Archives: uses archive services (evidence: `backend/app.js`)
- Express API → Notifications: uses notifications (evidence: `backend/app.js`)
- Download execution → youtube-dl integration: uses integration
- File management → Database: reads and writes (evidence: `backend/files.js`)
- File management → Archives: uses archive services (evidence: `backend/files.js`)
- Subscriptions → Download execution: uses download service (evidence: `backend/subscriptions.js`)
- Subscriptions → youtube-dl integration: uses integration (evidence: `backend/subscriptions.js`)
- Subscriptions → Archives: uses archive services (evidence: `backend/subscriptions.js`)
- Subscriptions → Database: reads and writes (evidence: `backend/subscriptions.js`)
- Scheduled tasks → Subscriptions: runs subscription tasks (evidence: `backend/tasks.js`)
- Scheduled tasks → File management: checks file records (evidence: `backend/tasks.js`)
- Scheduled tasks → Archives: uses archive services (evidence: `backend/tasks.js`)
- Scheduled tasks → Notifications: uses notifications (evidence: `backend/tasks.js`)
- Scheduled tasks → Database: reads and updates tasks (evidence: `backend/tasks.js`)
- Notifications → Database: uses records (evidence: `backend/notifications.js`)
- Authentication → Database: reads and updates users (evidence: `backend/authentication/auth.js`)
- Configuration → Logging: logs errors (evidence: `backend/config.js`)
- Database → Configuration: uses configuration (evidence: `backend/db.js`)
- Database → Logging: logs operations (evidence: `backend/db.js`)
