# anidl/multi-downloader-nx architecture

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

- Interactive diagram: https://gitdiagram.com/anidl/multi-downloader-nx
- Repository: https://github.com/anidl/multi-downloader-nx

## Overview

Anime Downloader NX supports CLI and GUI workflows for Crunchyroll, HIDIVE and AnimationDigitalNetwork. The documented CLI path is service authentication, search, selection and episode download; service-specific modules implement provider behavior, while shared modules handle stream retrieval and media assembly. The GUI adds a React queue/search interface communicating with a server over WebSockets and dispatching requests to service handlers. Provider internals and several GUI paths are unsampled, so their detailed relationships are omitted; documented capabilities remain represented without implying unverified calls.

Main entry points: [`index.ts`](https://github.com/anidl/multi-downloader-nx/blob/master/index.ts) (CLI entry), [`hidive.ts`](https://github.com/anidl/multi-downloader-nx/blob/master/hidive.ts) (HIDIVE), [`adn.ts`](https://github.com/anidl/multi-downloader-nx/blob/master/adn.ts) (ADN), [`gui/server/serviceHandler.ts`](https://github.com/anidl/multi-downloader-nx/blob/master/gui/server/serviceHandler.ts) (Service dispatcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflow"]
  node_cli["CLI entry<br/>[index.ts]"]
  node_arguments["CLI options<br/>[module.app-args.ts]"]
end

subgraph group_providers["Anime providers"]
  node_crunchy["Crunchyroll<br/>[crunchy.ts]"]
  node_hidive["HIDIVE<br/>[hidive.ts]"]
  node_adn["ADN<br/>[adn.ts]"]
end

subgraph group_media["Media processing"]
  node_stream["HLS download<br/>[hls-download.ts]"]
  node_merge["Media merger<br/>[module.merger.ts]"]
  node_decrypt["DRM keys<br/>[cdm.ts]"]
end

subgraph group_gui["GUI application"]
  node_react["React interface"]
  node_message["Message channel<br/>[MessageChannel.tsx]"]
  node_websocket["WebSocket server<br/>[websocket.ts]"]
  node_handler["Service dispatcher<br/>[serviceHandler.ts]"]
  node_guiadn["GUI ADN handler<br/>[adn.ts]"]
  node_guihidive["GUI HIDIVE handler<br/>[hidive.ts]"]
  node_guicrunchy["GUI Crunchyroll handler<br/>[crunchyroll.ts]"]
end

subgraph group_runtime["Shared runtime"]
  node_config["Configuration"]
  node_fetch["HTTP fetch<br/>[module.fetch.ts]"]
  node_archive["Download archive"]
  node_languages["Language metadata"]
  node_logging["Logging<br/>[log.ts]"]
end

node_user(("User"))
node_guiuser(("GUI user"))

node_user -->|"runs commands"| node_cli
node_cli -->|"parses options"| node_arguments
node_cli -->|"dispatches service"| node_crunchy
node_cli -->|"dispatches service"| node_hidive
node_cli -->|"dispatches service"| node_adn
node_user -->|"authenticates, searches, downloads"| node_crunchy
node_user -->|"authenticates, searches, downloads"| node_hidive
node_user -->|"authenticates, searches, downloads"| node_adn
node_guiuser -->|"searches and queues"| node_react
node_react -->|"sends requests"| node_message
node_message -->|"exchanges messages"| node_websocket
node_websocket -->|"routes events"| node_handler
node_handler -->|"selects handler"| node_guiadn
node_handler -->|"selects handler"| node_guihidive
node_handler -->|"selects handler"| node_guicrunchy
node_guiadn -->|"delegates provider work"| node_adn
node_guihidive -->|"delegates provider work"| node_hidive
node_crunchy -.->|"downloads HLS"| node_stream
node_hidive -.->|"downloads HLS"| node_stream
node_adn -.->|"downloads HLS"| node_stream
node_crunchy -.->|"assembles media"| node_merge
node_hidive -.->|"assembles media"| node_merge
node_adn -.->|"assembles media"| node_merge

click node_cli "https://github.com/anidl/multi-downloader-nx/blob/master/index.ts"
click node_arguments "https://github.com/anidl/multi-downloader-nx/blob/master/modules/module.app-args.ts"
click node_crunchy "https://github.com/anidl/multi-downloader-nx/blob/master/crunchy.ts"
click node_hidive "https://github.com/anidl/multi-downloader-nx/blob/master/hidive.ts"
click node_adn "https://github.com/anidl/multi-downloader-nx/blob/master/adn.ts"
click node_stream "https://github.com/anidl/multi-downloader-nx/blob/master/modules/hls-download.ts"
click node_merge "https://github.com/anidl/multi-downloader-nx/blob/master/modules/module.merger.ts"
click node_decrypt "https://github.com/anidl/multi-downloader-nx/blob/master/modules/cdm.ts"
click node_config "https://github.com/anidl/multi-downloader-nx/blob/master/modules/module.cfg-loader.ts"
click node_fetch "https://github.com/anidl/multi-downloader-nx/blob/master/modules/module.fetch.ts"
click node_archive "https://github.com/anidl/multi-downloader-nx/blob/master/modules/module.downloadArchive.ts"
click node_languages "https://github.com/anidl/multi-downloader-nx/blob/master/modules/module.langsData.ts"
click node_logging "https://github.com/anidl/multi-downloader-nx/blob/master/modules/log.ts"
click node_react "https://github.com/anidl/multi-downloader-nx/blob/master/gui/react/src/components/AddToQueue/DownloadSelector/DownloadSelector.tsx"
click node_message "https://github.com/anidl/multi-downloader-nx/blob/master/gui/react/src/provider/MessageChannel.tsx"
click node_websocket "https://github.com/anidl/multi-downloader-nx/blob/master/gui/server/websocket.ts"
click node_handler "https://github.com/anidl/multi-downloader-nx/blob/master/gui/server/serviceHandler.ts"
click node_guiadn "https://github.com/anidl/multi-downloader-nx/blob/master/gui/server/services/adn.ts"
click node_guihidive "https://github.com/anidl/multi-downloader-nx/blob/master/gui/server/services/hidive.ts"
click node_guicrunchy "https://github.com/anidl/multi-downloader-nx/blob/master/gui/server/services/crunchyroll.ts"

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_arguments,node_user,node_guiuser toneBlue
class node_crunchy,node_hidive,node_adn toneAmber
class node_stream,node_merge,node_decrypt toneMint
class node_react,node_message,node_websocket,node_handler,node_guiadn,node_guihidive,node_guicrunchy toneRose
class node_config,node_fetch,node_archive,node_languages,node_logging toneIndigo
```

## Components

### CLI workflow

- [CLI entry](https://github.com/anidl/multi-downloader-nx/blob/master/index.ts): `index.ts`
- [CLI options](https://github.com/anidl/multi-downloader-nx/blob/master/modules/module.app-args.ts): `modules/module.app-args.ts`

### Anime providers

- [Crunchyroll](https://github.com/anidl/multi-downloader-nx/blob/master/crunchy.ts): `crunchy.ts`
- [HIDIVE](https://github.com/anidl/multi-downloader-nx/blob/master/hidive.ts): `hidive.ts`
- [ADN](https://github.com/anidl/multi-downloader-nx/blob/master/adn.ts): `adn.ts`

### Media processing

- [HLS download](https://github.com/anidl/multi-downloader-nx/blob/master/modules/hls-download.ts): `modules/hls-download.ts`
- [Media merger](https://github.com/anidl/multi-downloader-nx/blob/master/modules/module.merger.ts): `modules/module.merger.ts`
- [DRM keys](https://github.com/anidl/multi-downloader-nx/blob/master/modules/cdm.ts): `modules/cdm.ts`

### GUI application

- [React interface](https://github.com/anidl/multi-downloader-nx/blob/master/gui/react/src/components/AddToQueue/DownloadSelector/DownloadSelector.tsx): `gui/react/src/components/AddToQueue/DownloadSelector/DownloadSelector.tsx`
- [Message channel](https://github.com/anidl/multi-downloader-nx/blob/master/gui/react/src/provider/MessageChannel.tsx): `gui/react/src/provider/MessageChannel.tsx`
- [WebSocket server](https://github.com/anidl/multi-downloader-nx/blob/master/gui/server/websocket.ts): `gui/server/websocket.ts`
- [Service dispatcher](https://github.com/anidl/multi-downloader-nx/blob/master/gui/server/serviceHandler.ts): `gui/server/serviceHandler.ts`
- [GUI ADN handler](https://github.com/anidl/multi-downloader-nx/blob/master/gui/server/services/adn.ts): `gui/server/services/adn.ts`
- [GUI HIDIVE handler](https://github.com/anidl/multi-downloader-nx/blob/master/gui/server/services/hidive.ts): `gui/server/services/hidive.ts`
- [GUI Crunchyroll handler](https://github.com/anidl/multi-downloader-nx/blob/master/gui/server/services/crunchyroll.ts): `gui/server/services/crunchyroll.ts`

### Shared runtime

- [Configuration](https://github.com/anidl/multi-downloader-nx/blob/master/modules/module.cfg-loader.ts): `modules/module.cfg-loader.ts`
- [HTTP fetch](https://github.com/anidl/multi-downloader-nx/blob/master/modules/module.fetch.ts): `modules/module.fetch.ts`
- [Download archive](https://github.com/anidl/multi-downloader-nx/blob/master/modules/module.downloadArchive.ts): `modules/module.downloadArchive.ts`
- [Language metadata](https://github.com/anidl/multi-downloader-nx/blob/master/modules/module.langsData.ts): `modules/module.langsData.ts`
- [Logging](https://github.com/anidl/multi-downloader-nx/blob/master/modules/log.ts): `modules/log.ts`

### Other components

- **User**
- **GUI user**

## Connections

- User → CLI entry: runs commands
- CLI entry → CLI options: parses options (evidence: `index.ts`)
- CLI entry → Crunchyroll: dispatches service (evidence: `index.ts`)
- CLI entry → HIDIVE: dispatches service (evidence: `index.ts`)
- CLI entry → ADN: dispatches service (evidence: `index.ts`)
- User → Crunchyroll: authenticates, searches, downloads
- User → HIDIVE: authenticates, searches, downloads
- User → ADN: authenticates, searches, downloads
- GUI user → React interface: searches and queues
- React interface → Message channel: sends requests
- Message channel → WebSocket server: exchanges messages (evidence: `gui/react/src/provider/MessageChannel.tsx`)
- WebSocket server → Service dispatcher: routes events (evidence: `gui/server/index.ts`)
- Service dispatcher → GUI ADN handler: selects handler (evidence: `gui/server/serviceHandler.ts`)
- Service dispatcher → GUI HIDIVE handler: selects handler (evidence: `gui/server/serviceHandler.ts`)
- Service dispatcher → GUI Crunchyroll handler: selects handler (evidence: `gui/server/serviceHandler.ts`)
- GUI ADN handler → ADN: delegates provider work (evidence: `gui/server/services/adn.ts`)
- GUI HIDIVE handler → HIDIVE: delegates provider work (evidence: `gui/server/services/hidive.ts`)
- Crunchyroll → HLS download: downloads HLS (evidence: `crunchy.ts`)
- HIDIVE → HLS download: downloads HLS (evidence: `hidive.ts`)
- ADN → HLS download: downloads HLS (evidence: `adn.ts`)
- Crunchyroll → Media merger: assembles media (evidence: `crunchy.ts`)
- HIDIVE → Media merger: assembles media (evidence: `hidive.ts`)
- ADN → Media merger: assembles media (evidence: `adn.ts`)
