# lenluarun/lenlu-dlp architecture

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

- Interactive diagram: https://gitdiagram.com/lenluarun/lenlu-dlp
- Repository: https://github.com/lenluarun/lenlu-dlp

## Overview

LENLU DLP is a local-first media downloader with a browser UI, FastAPI backend, and optional pywebview desktop shell. The main workflow is to submit a media URL, inspect metadata and formats, download selected media, then track progress and use the local library/player. The README also documents batch downloads, settings, folder selection, and update checks. A parallel Node server is present in the tree; sampled excerpts show its HTTP API and download handling. UI source was not sampled, so UI-to-endpoint details are not asserted.

Main entry points: [`server.mjs`](https://github.com/lenluarun/lenlu-dlp/blob/main/server.mjs) (Node HTTP service), [`app/backend/run_gui.py`](https://github.com/lenluarun/lenlu-dlp/blob/main/app/backend/run_gui.py) (FastAPI service), [`app/backend/main_app.py`](https://github.com/lenluarun/lenlu-dlp/blob/main/app/backend/main_app.py) (Desktop shell), [`app/gui/index.html`](https://github.com/lenluarun/lenlu-dlp/blob/main/app/gui/index.html) (Browser interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop launch"]
  node_desktop_shell["Desktop shell<br/>[main_app.py]"]
end

subgraph group_python["Python downloader"]
  node_fastapi["FastAPI service<br/>[run_gui.py]"]
  node_metadata["Metadata and formats<br/>[run_gui.py]"]
  node_download["Download jobs<br/>[run_gui.py]"]
  node_progress["Progress stream<br/>[run_gui.py]"]
  node_settings[("Settings<br/>[run_gui.py]")]
  node_library["Media library<br/>[run_gui.py]"]
end

subgraph group_node["Node server"]
  node_node_server["Node HTTP service<br/>[server.mjs]"]
  node_node_metadata["Node metadata<br/>[server.mjs]"]
  node_node_download["Node downloads<br/>[server.mjs]"]
  node_node_settings[("Node settings<br/>[server.mjs]")]
  node_node_library["Node library<br/>[server.mjs]"]
end

subgraph group_media["Media experience"]
  node_frontend["Browser interface<br/>[index.html]"]
  node_local_frontend["Local-host interface<br/>[local_host.html]"]
end

node_user(("User"))
node_media_sites{{"Media sites"}}
node_github{{"GitHub Releases"}}
node_download_folder[("Download folder")]

node_user -->|"launches"| node_desktop_shell
node_desktop_shell -->|"starts"| node_fastapi
node_desktop_shell -->|"opens"| node_frontend
node_user -->|"uses"| node_frontend
node_user -.->|"uses"| node_local_frontend
node_frontend -.->|"requests"| node_fastapi
node_fastapi -->|"routes"| node_metadata
node_metadata -->|"extracts metadata"| node_media_sites
node_user -->|"requests download"| node_download
node_fastapi -->|"routes"| node_download
node_download -->|"downloads streams"| node_media_sites
node_download -->|"publishes progress"| node_progress
node_fastapi -->|"reads settings"| node_settings
node_download -->|"uses preferences"| node_settings
node_fastapi -->|"serves library"| node_library
node_library -->|"reads files"| node_download_folder
node_user -.->|"requests service"| node_node_server
node_node_server -->|"routes info"| node_node_metadata
node_node_metadata -->|"fetches metadata"| node_media_sites
node_node_server -->|"starts job"| node_node_download
node_node_download -->|"broadcasts progress"| node_progress
node_node_server -->|"loads settings"| node_node_settings
node_node_server -->|"routes library"| node_node_library
node_node_library -->|"serves files"| node_download_folder
node_node_server -->|"checks releases"| node_github

click node_desktop_shell "https://github.com/lenluarun/lenlu-dlp/blob/main/app/backend/main_app.py"
click node_fastapi "https://github.com/lenluarun/lenlu-dlp/blob/main/app/backend/run_gui.py"
click node_metadata "https://github.com/lenluarun/lenlu-dlp/blob/main/app/backend/run_gui.py"
click node_download "https://github.com/lenluarun/lenlu-dlp/blob/main/app/backend/run_gui.py"
click node_progress "https://github.com/lenluarun/lenlu-dlp/blob/main/app/backend/run_gui.py"
click node_settings "https://github.com/lenluarun/lenlu-dlp/blob/main/app/backend/run_gui.py"
click node_library "https://github.com/lenluarun/lenlu-dlp/blob/main/app/backend/run_gui.py"
click node_frontend "https://github.com/lenluarun/lenlu-dlp/blob/main/app/gui/index.html"
click node_local_frontend "https://github.com/lenluarun/lenlu-dlp/blob/main/app/gui/local_host.html"
click node_node_server "https://github.com/lenluarun/lenlu-dlp/blob/main/server.mjs"
click node_node_metadata "https://github.com/lenluarun/lenlu-dlp/blob/main/server.mjs"
click node_node_download "https://github.com/lenluarun/lenlu-dlp/blob/main/server.mjs"
click node_node_settings "https://github.com/lenluarun/lenlu-dlp/blob/main/server.mjs"
click node_node_library "https://github.com/lenluarun/lenlu-dlp/blob/main/server.mjs"

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_desktop_shell,node_user toneBlue
class node_fastapi,node_metadata,node_download,node_progress,node_settings,node_library,node_download_folder toneAmber
class node_node_server,node_node_metadata,node_node_download,node_node_settings,node_node_library toneMint
class node_frontend,node_local_frontend toneRose
class node_media_sites,node_github toneIndigo
```

## Components

### Desktop launch

- [Desktop shell](https://github.com/lenluarun/lenlu-dlp/blob/main/app/backend/main_app.py): `app/backend/main_app.py`

### Python downloader

- [FastAPI service](https://github.com/lenluarun/lenlu-dlp/blob/main/app/backend/run_gui.py): `app/backend/run_gui.py`
- [Metadata and formats](https://github.com/lenluarun/lenlu-dlp/blob/main/app/backend/run_gui.py): `app/backend/run_gui.py`
- [Download jobs](https://github.com/lenluarun/lenlu-dlp/blob/main/app/backend/run_gui.py): `app/backend/run_gui.py`
- [Progress stream](https://github.com/lenluarun/lenlu-dlp/blob/main/app/backend/run_gui.py): `app/backend/run_gui.py`
- [Settings](https://github.com/lenluarun/lenlu-dlp/blob/main/app/backend/run_gui.py): `app/backend/run_gui.py`
- [Media library](https://github.com/lenluarun/lenlu-dlp/blob/main/app/backend/run_gui.py): `app/backend/run_gui.py`

### Node server

- [Node HTTP service](https://github.com/lenluarun/lenlu-dlp/blob/main/server.mjs): `server.mjs`
- [Node metadata](https://github.com/lenluarun/lenlu-dlp/blob/main/server.mjs): `server.mjs`
- [Node downloads](https://github.com/lenluarun/lenlu-dlp/blob/main/server.mjs): `server.mjs`
- [Node settings](https://github.com/lenluarun/lenlu-dlp/blob/main/server.mjs): `server.mjs`
- [Node library](https://github.com/lenluarun/lenlu-dlp/blob/main/server.mjs): `server.mjs`

### Media experience

- [Browser interface](https://github.com/lenluarun/lenlu-dlp/blob/main/app/gui/index.html): `app/gui/index.html`
- [Local-host interface](https://github.com/lenluarun/lenlu-dlp/blob/main/app/gui/local_host.html): `app/gui/local_host.html`

### Other components

- **User**
- **Media sites**
- **GitHub Releases**
- **Download folder**

## Connections

- User → Desktop shell: launches (evidence: `app/backend/main_app.py`)
- Desktop shell → FastAPI service: starts (evidence: `app/backend/main_app.py`)
- Desktop shell → Browser interface: opens (evidence: `app/backend/main_app.py`)
- User → Browser interface: uses (evidence: `README.md`)
- User → Local-host interface: uses
- Browser interface → FastAPI service: requests
- FastAPI service → Metadata and formats: routes (evidence: `app/backend/run_gui.py`)
- Metadata and formats → Media sites: extracts metadata (evidence: `README.md`)
- User → Download jobs: requests download (evidence: `README.md`)
- FastAPI service → Download jobs: routes (evidence: `app/backend/run_gui.py`)
- Download jobs → Media sites: downloads streams (evidence: `README.md`)
- Download jobs → Progress stream: publishes progress (evidence: `app/backend/run_gui.py`)
- FastAPI service → Settings: reads settings (evidence: `app/backend/run_gui.py`)
- Download jobs → Settings: uses preferences (evidence: `app/backend/run_gui.py`)
- FastAPI service → Media library: serves library (evidence: `app/backend/run_gui.py`)
- Media library → Download folder: reads files (evidence: `app/backend/run_gui.py`)
- User → Node HTTP service: requests service
- Node HTTP service → Node metadata: routes info (evidence: `server.mjs`)
- Node metadata → Media sites: fetches metadata (evidence: `server.mjs`)
- Node HTTP service → Node downloads: starts job (evidence: `server.mjs`)
- Node downloads → Progress stream: broadcasts progress (evidence: `server.mjs`)
- Node HTTP service → Node settings: loads settings (evidence: `server.mjs`)
- Node HTTP service → Node library: routes library (evidence: `server.mjs`)
- Node library → Download folder: serves files (evidence: `server.mjs`)
- Node HTTP service → GitHub Releases: checks releases (evidence: `README.md`)
