# zerx-lab/fluxdown architecture

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

- Interactive diagram: https://gitdiagram.com/zerx-lab/fluxdown
- Repository: https://github.com/zerx-lab/fluxdown

## Overview

FluxDown is a cross-platform, multi-protocol download manager. Its principal workflow is that a user submits a link or browser-captured resource through a client; the shared Rust engine manages transfers, queues and persistence, and clients present task state and results. The README documents desktop, mobile, web, CLI, browser, server/API, RSS, plugins, automation and optional cloud/device capabilities. Some runtime modules were not sampled, so edges for those documented integrations cite the README; implementation detail is limited to the available source excerpts and index.

Main entry points: [`native/engine`](https://github.com/zerx-lab/fluxdown/tree/main/native/engine) (Transfer engine), [`native/agent/src/state.rs`](https://github.com/zerx-lab/fluxdown/blob/main/native/agent/src/state.rs) (Agent host), [`crates/app/src/app.rs`](https://github.com/zerx-lab/fluxdown/blob/main/crates/app/src/app.rs) (Desktop app), [`fluxDown/background`](https://github.com/zerx-lab/fluxdown/tree/main/fluxDown/background) (Browser extension)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User clients"]
  node_desktop["Desktop app<br/>[app.rs]"]
  node_mobile["Mobile apps"]
  node_web["Web UI"]
  node_cli["CLI<br/>[main.rs]"]
  node_downloads["Desktop downloads UI<br/>[controller.rs]"]
end

subgraph group_capture["Browser integration"]
  node_browser["Browser extension"]
  node_rules["Capture rules<br/>[engine.ts]"]
end

subgraph group_runtime["Download runtime"]
  node_agent["Agent host<br/>[state.rs]"]
  node_engine["Transfer engine"]
  node_database[("Task persistence<br/>[db.rs]")]
end

subgraph group_services["Server and automation"]
  node_server["Headless server<br/>[main.rs]"]
  node_api["HTTP and RPC API<br/>[routes.rs]"]
  node_websocket["Live server updates<br/>[ws_hub.rs]"]
  node_plugins["Plugin runtime<br/>[quickjs.rs]"]
  node_rss["RSS automation<br/>[controller.rs]"]
  node_automation["Queues and webhooks"]
end

subgraph group_optional["Optional collaboration"]
  node_cloud["FluxCloud"]
  node_device["Paired devices<br/>[manager.rs]"]
end

node_user(("User"))

node_user -->|"submits downloads"| node_desktop
node_user -->|"submits downloads"| node_mobile
node_user -->|"manages tasks"| node_web
node_user -->|"runs commands"| node_cli
node_user -->|"browses resources"| node_browser
node_browser -->|"evaluates captures"| node_rules
node_browser -->|"sends downloads"| node_agent
node_desktop -->|"connects to agent"| node_agent
node_mobile -->|"runs transfers"| node_engine
node_web -->|"calls service"| node_api
node_cli -->|"runs transfers"| node_engine
node_agent -->|"hosts engine"| node_engine
node_server -->|"hosts engine"| node_engine
node_engine -->|"persists task state"| node_database
node_agent -->|"feeds task events"| node_downloads
node_desktop -->|"presents downloads"| node_downloads
node_api -->|"routes requests"| node_server
node_server -->|"publishes updates"| node_websocket
node_engine -->|"loads plugins"| node_plugins
node_engine -->|"supports subscriptions"| node_rss
node_engine -->|"supports automation"| node_automation
node_agent -.->|"syncs optionally"| node_cloud
node_agent -.->|"pairs optionally"| node_device

click node_desktop "https://github.com/zerx-lab/fluxdown/blob/main/crates/app/src/app.rs"
click node_mobile "https://github.com/zerx-lab/fluxdown/tree/main/mobile/Android/app/src/main/java/com/fluxdown/app"
click node_web "https://github.com/zerx-lab/fluxdown/tree/main/web/src"
click node_cli "https://github.com/zerx-lab/fluxdown/blob/main/native/cli/src/main.rs"
click node_browser "https://github.com/zerx-lab/fluxdown/tree/main/fluxDown/background"
click node_rules "https://github.com/zerx-lab/fluxdown/blob/main/fluxDown/rules/engine.ts"
click node_agent "https://github.com/zerx-lab/fluxdown/blob/main/native/agent/src/state.rs"
click node_engine "https://github.com/zerx-lab/fluxdown/tree/main/native/engine"
click node_database "https://github.com/zerx-lab/fluxdown/blob/main/native/engine/src/db.rs"
click node_downloads "https://github.com/zerx-lab/fluxdown/blob/main/crates/downloads/src/controller.rs"
click node_server "https://github.com/zerx-lab/fluxdown/blob/main/native/server/src/main.rs"
click node_api "https://github.com/zerx-lab/fluxdown/blob/main/native/api/src/routes.rs"
click node_websocket "https://github.com/zerx-lab/fluxdown/blob/main/native/server/src/ws_hub.rs"
click node_plugins "https://github.com/zerx-lab/fluxdown/blob/main/native/engine/src/plugin/quickjs.rs"
click node_rss "https://github.com/zerx-lab/fluxdown/blob/main/crates/rss/src/controller.rs"
click node_automation "https://github.com/zerx-lab/fluxdown/tree/main/native/engine/src"
click node_cloud "https://github.com/zerx-lab/fluxdown/tree/main/native/agent/src/cloud"
click node_device "https://github.com/zerx-lab/fluxdown/blob/main/native/link/src/manager.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_desktop,node_mobile,node_web,node_cli,node_downloads,node_user toneBlue
class node_browser,node_rules toneAmber
class node_agent,node_engine,node_database toneMint
class node_server,node_api,node_websocket,node_plugins,node_rss,node_automation toneRose
class node_cloud,node_device toneIndigo
```

## Components

### User clients

- [Desktop app](https://github.com/zerx-lab/fluxdown/blob/main/crates/app/src/app.rs): `crates/app/src/app.rs`
- [Mobile apps](https://github.com/zerx-lab/fluxdown/tree/main/mobile/Android/app/src/main/java/com/fluxdown/app): `mobile/Android/app/src/main/java/com/fluxdown/app`
- [Web UI](https://github.com/zerx-lab/fluxdown/tree/main/web/src): `web/src`
- [CLI](https://github.com/zerx-lab/fluxdown/blob/main/native/cli/src/main.rs): `native/cli/src/main.rs`
- [Desktop downloads UI](https://github.com/zerx-lab/fluxdown/blob/main/crates/downloads/src/controller.rs): `crates/downloads/src/controller.rs`

### Browser integration

- [Browser extension](https://github.com/zerx-lab/fluxdown/tree/main/fluxDown/background): `fluxDown/background`
- [Capture rules](https://github.com/zerx-lab/fluxdown/blob/main/fluxDown/rules/engine.ts): `fluxDown/rules/engine.ts`

### Download runtime

- [Agent host](https://github.com/zerx-lab/fluxdown/blob/main/native/agent/src/state.rs): `native/agent/src/state.rs`
- [Transfer engine](https://github.com/zerx-lab/fluxdown/tree/main/native/engine): `native/engine`
- [Task persistence](https://github.com/zerx-lab/fluxdown/blob/main/native/engine/src/db.rs): `native/engine/src/db.rs`

### Server and automation

- [Headless server](https://github.com/zerx-lab/fluxdown/blob/main/native/server/src/main.rs): `native/server/src/main.rs`
- [HTTP and RPC API](https://github.com/zerx-lab/fluxdown/blob/main/native/api/src/routes.rs): `native/api/src/routes.rs`
- [Live server updates](https://github.com/zerx-lab/fluxdown/blob/main/native/server/src/ws_hub.rs): `native/server/src/ws_hub.rs`
- [Plugin runtime](https://github.com/zerx-lab/fluxdown/blob/main/native/engine/src/plugin/quickjs.rs): `native/engine/src/plugin/quickjs.rs`
- [RSS automation](https://github.com/zerx-lab/fluxdown/blob/main/crates/rss/src/controller.rs): `crates/rss/src/controller.rs`
- [Queues and webhooks](https://github.com/zerx-lab/fluxdown/tree/main/native/engine/src): `native/engine/src`

### Optional collaboration

- [FluxCloud](https://github.com/zerx-lab/fluxdown/tree/main/native/agent/src/cloud): `native/agent/src/cloud`
- [Paired devices](https://github.com/zerx-lab/fluxdown/blob/main/native/link/src/manager.rs): `native/link/src/manager.rs`

### Other components

- **User**

## Connections

- User → Desktop app: submits downloads
- User → Mobile apps: submits downloads
- User → Web UI: manages tasks
- User → CLI: runs commands
- User → Browser extension: browses resources
- Browser extension → Capture rules: evaluates captures (evidence: `fluxDown/rules/engine.ts`)
- Browser extension → Agent host: sends downloads
- Desktop app → Agent host: connects to agent
- Mobile apps → Transfer engine: runs transfers
- Web UI → HTTP and RPC API: calls service
- CLI → Transfer engine: runs transfers
- Agent host → Transfer engine: hosts engine
- Headless server → Transfer engine: hosts engine
- Transfer engine → Task persistence: persists task state (evidence: `native/engine/src/plugin/manager.rs`)
- Agent host → Desktop downloads UI: feeds task events
- Desktop app → Desktop downloads UI: presents downloads (evidence: `crates/app/src/app.rs`)
- HTTP and RPC API → Headless server: routes requests
- Headless server → Live server updates: publishes updates
- Transfer engine → Plugin runtime: loads plugins (evidence: `native/engine/src/plugin/manager.rs`)
- Transfer engine → RSS automation: supports subscriptions
- Transfer engine → Queues and webhooks: supports automation (evidence: `native/engine/src/plugin/manager.rs`)
- Agent host → FluxCloud: syncs optionally (evidence: `native/agent/src/cloud_notify/pipeline.rs`)
- Agent host → Paired devices: pairs optionally
