# manish-sherawat/plexdl architecture

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

- Interactive diagram: https://gitdiagram.com/manish-sherawat/plexdl
- Repository: https://github.com/manish-sherawat/plexdl

## Overview

PlexDL is an Electron desktop download manager with a browser companion. The principal workflow begins with a user or browser-captured URL, passes through the desktop control layer into the transfer engine, and ends with a downloaded or assembled media file. Its documented capabilities also include browser-native messaging, YouTube/SABR extraction, HLS handling, and multi-interface transfers. Source excerpts support core dispatch and several engine relationships; broader capability links rely on README documentation, and unsampled internals are represented conservatively.

Main entry points: [`core/engine.mjs`](https://github.com/manish-sherawat/plexdl/blob/main/core/engine.mjs) (Download engine), [`desktop/main.cjs`](https://github.com/manish-sherawat/plexdl/blob/main/desktop/main.cjs) (Desktop controller), [`core/youtube.mjs`](https://github.com/manish-sherawat/plexdl/blob/main/core/youtube.mjs) (YouTube resolver), [`integration/native-host.cjs`](https://github.com/manish-sherawat/plexdl/blob/main/integration/native-host.cjs) (Native messaging host)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop app"]
  node_renderer["Download workspace<br/>[app.js]"]
  node_app["Desktop controller<br/>[main.cjs]"]
end

subgraph group_browser["Browser companion"]
  node_extension["Browser extension<br/>[background.js]"]
  node_page_capture["Page media capture<br/>[content.js]"]
end

subgraph group_transfer["Transfer engine"]
  node_engine["Download engine<br/>[engine.mjs]"]
  node_http["HTTP transport<br/>[http.mjs]"]
  node_torrent["Torrent downloads"]
end

subgraph group_media["Media extraction"]
  node_hls["HLS resolver<br/>[hls.mjs]"]
  node_youtube["YouTube resolver<br/>[youtube.mjs]"]
  node_sabr["SABR client<br/>[sabr.mjs]"]
  node_mux["Media muxer<br/>[mux.mjs]"]
  node_session["Session resolver"]
end

subgraph group_integrations["System integrations"]
  node_native_host["Native messaging host<br/>[native-host.cjs]"]
  node_bridge["YouTube bridge<br/>[bridge.mjs]"]
end

node_user(("User"))
node_browser_user(("Browser user"))
node_filesystem[("Local files")]
node_network{{"Network interfaces"}}

node_user -->|"uses"| node_renderer
node_renderer -->|"sends requests"| node_app
node_app -->|"dispatches downloads"| node_engine
node_app -->|"starts host"| node_native_host
node_browser_user -->|"browses pages"| node_page_capture
node_page_capture -->|"sends captures"| node_extension
node_extension -->|"messages"| node_native_host
node_native_host -->|"forwards requests"| node_app
node_engine -->|"probes files"| node_http
node_engine -->|"resolves playlists"| node_hls
node_hls -->|"fetches playlists"| node_http
node_engine -->|"detects URLs"| node_youtube
node_engine -->|"runs SABR"| node_sabr
node_engine -->|"assembles media"| node_mux
node_bridge -->|"resolves formats"| node_youtube
node_engine -->|"writes downloads"| node_filesystem
node_engine -->|"uses interfaces"| node_network
node_engine -.->|"supports magnets"| node_torrent
node_engine -.->|"resolves sessions"| node_session
node_youtube -.->|"enables track muxing"| node_mux

click node_renderer "https://github.com/manish-sherawat/plexdl/blob/main/renderer/app.js"
click node_app "https://github.com/manish-sherawat/plexdl/blob/main/desktop/main.cjs"
click node_engine "https://github.com/manish-sherawat/plexdl/blob/main/core/engine.mjs"
click node_http "https://github.com/manish-sherawat/plexdl/blob/main/core/http.mjs"
click node_hls "https://github.com/manish-sherawat/plexdl/blob/main/core/hls.mjs"
click node_youtube "https://github.com/manish-sherawat/plexdl/blob/main/core/youtube.mjs"
click node_sabr "https://github.com/manish-sherawat/plexdl/blob/main/core/sabr.mjs"
click node_mux "https://github.com/manish-sherawat/plexdl/blob/main/core/mux.mjs"
click node_extension "https://github.com/manish-sherawat/plexdl/blob/main/extension/background.js"
click node_page_capture "https://github.com/manish-sherawat/plexdl/blob/main/extension/content.js"
click node_native_host "https://github.com/manish-sherawat/plexdl/blob/main/integration/native-host.cjs"
click node_bridge "https://github.com/manish-sherawat/plexdl/blob/main/core/bridge.mjs"
click node_torrent "https://github.com/manish-sherawat/plexdl/tree/main/core"
click node_session "https://github.com/manish-sherawat/plexdl/tree/main/core"

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_renderer,node_app,node_user,node_browser_user toneBlue
class node_extension,node_page_capture,node_filesystem toneAmber
class node_engine,node_http,node_torrent toneMint
class node_hls,node_youtube,node_sabr,node_mux,node_session toneRose
class node_native_host,node_bridge,node_network toneIndigo
```

## Components

### Desktop app

- [Download workspace](https://github.com/manish-sherawat/plexdl/blob/main/renderer/app.js): `renderer/app.js`
- [Desktop controller](https://github.com/manish-sherawat/plexdl/blob/main/desktop/main.cjs): `desktop/main.cjs`

### Browser companion

- [Browser extension](https://github.com/manish-sherawat/plexdl/blob/main/extension/background.js): `extension/background.js`
- [Page media capture](https://github.com/manish-sherawat/plexdl/blob/main/extension/content.js): `extension/content.js`

### Transfer engine

- [Download engine](https://github.com/manish-sherawat/plexdl/blob/main/core/engine.mjs): `core/engine.mjs`
- [HTTP transport](https://github.com/manish-sherawat/plexdl/blob/main/core/http.mjs): `core/http.mjs`
- [Torrent downloads](https://github.com/manish-sherawat/plexdl/tree/main/core): `core`

### Media extraction

- [HLS resolver](https://github.com/manish-sherawat/plexdl/blob/main/core/hls.mjs): `core/hls.mjs`
- [YouTube resolver](https://github.com/manish-sherawat/plexdl/blob/main/core/youtube.mjs): `core/youtube.mjs`
- [SABR client](https://github.com/manish-sherawat/plexdl/blob/main/core/sabr.mjs): `core/sabr.mjs`
- [Media muxer](https://github.com/manish-sherawat/plexdl/blob/main/core/mux.mjs): `core/mux.mjs`
- [Session resolver](https://github.com/manish-sherawat/plexdl/tree/main/core): `core`

### System integrations

- [Native messaging host](https://github.com/manish-sherawat/plexdl/blob/main/integration/native-host.cjs): `integration/native-host.cjs`
- [YouTube bridge](https://github.com/manish-sherawat/plexdl/blob/main/core/bridge.mjs): `core/bridge.mjs`

### Other components

- **User**
- **Browser user**
- **Local files**
- **Network interfaces**

## Connections

- User → Download workspace: uses (evidence: `README.md`)
- Download workspace → Desktop controller: sends requests (evidence: `README.md`)
- Desktop controller → Download engine: dispatches downloads (evidence: `desktop/main.cjs`)
- Desktop controller → Native messaging host: starts host (evidence: `desktop/main.cjs`)
- Browser user → Page media capture: browses pages (evidence: `README.md`)
- Page media capture → Browser extension: sends captures (evidence: `README.md`)
- Browser extension → Native messaging host: messages (evidence: `README.md`)
- Native messaging host → Desktop controller: forwards requests (evidence: `README.md`)
- Download engine → HTTP transport: probes files (evidence: `core/engine.mjs`)
- Download engine → HLS resolver: resolves playlists (evidence: `core/engine.mjs`)
- HLS resolver → HTTP transport: fetches playlists (evidence: `core/hls.mjs`)
- Download engine → YouTube resolver: detects URLs (evidence: `core/engine.mjs`)
- Download engine → SABR client: runs SABR (evidence: `core/engine.mjs`)
- Download engine → Media muxer: assembles media (evidence: `core/engine.mjs`)
- YouTube bridge → YouTube resolver: resolves formats (evidence: `core/bridge.mjs`)
- Download engine → Local files: writes downloads (evidence: `README.md`)
- Download engine → Network interfaces: uses interfaces (evidence: `README.md`)
- Download engine → Torrent downloads: supports magnets (evidence: `README.md`)
- Download engine → Session resolver: resolves sessions (evidence: `README.md`)
- YouTube resolver → Media muxer: enables track muxing (evidence: `README.md`)
