# xiaoyouchr/ghost-downloader-3 architecture

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

- Interactive diagram: https://gitdiagram.com/xiaoyouchr/ghost-downloader-3
- Repository: https://github.com/xiaoyouchr/ghost-downloader-3

## Overview

Ghost Downloader is a cross-platform download manager with a Python desktop engine, Android client, protocol/feature packs, and a browser extension. The main workflow is to submit a URL or captured browser resource, parse it through the feature-pack system, create and manage a task, then download and present progress. The graph also preserves documented protocol breadth, browser capture, settings, and aria2-compatible RPC. Some pack, Android, and extension wiring is documented but not shown in sampled implementation; those links cite the README, and unsampled internals are represented at supported paths.

Main entry points: [`app/services/task_service.py`](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/services/task_service.py) (Task service), [`app/engine.py`](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/engine.py) (Engine orchestrator), [`app/services/feature_service.py`](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/services/feature_service.py) (Feature service), [`browser_extension/app/src/background.ts`](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/browser_extension/app/src/background.ts) (Browser extension)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Intake and clients"]
  node_browser["Browser extension<br/>[background.ts]"]
  node_desktop["Desktop app<br/>[application.py]"]
  node_android["Android app<br/>[MainActivity.kt]"]
  node_rpc["aria2 RPC<br/>[aria2_rpc.py]"]
  node_browserbridge["Browser service<br/>[browser_service.py]"]
end

subgraph group_engine["Download engine"]
  node_engine["Engine orchestrator<br/>[engine.py]"]
  node_feature["Feature service<br/>[feature_service.py]"]
  node_tasks["Task service<br/>[task_service.py]"]
  node_taskmodel["Task model<br/>[task.py]"]
end

subgraph group_packs["Protocols and packs"]
  node_http["HTTP downloads<br/>[task.py]"]
  node_packregistry["Feature packs<br/>[pack.py]"]
  node_specialpacks["Media and protocol packs"]
end

subgraph group_experience["User experience"]
  node_ui["Task interface<br/>[task_page.py]"]
  node_androidui["Android interface<br/>[TasksPage.kt]"]
  node_extensionui["Extension popup<br/>[App.tsx]"]
  node_settings["Configuration<br/>[cfg.py]"]
end

subgraph group_platform["Platform services"]
  node_filesystem["File operations<br/>[filesystem.py]"]
  node_storage["App data paths<br/>[paths.py]"]
end

node_user(("Downloader user"))

node_user -->|"submits links"| node_desktop
node_user -->|"submits links"| node_android
node_user -->|"captures media"| node_browser
node_desktop -.->|"starts engine"| node_engine
node_android -.->|"uses download engine"| node_engine
node_browser -->|"sends resources"| node_browserbridge
node_browserbridge -->|"parses resources"| node_feature
node_rpc -->|"parses requests"| node_feature
node_engine -->|"activates"| node_feature
node_engine -->|"starts and stops"| node_tasks
node_feature -.->|"creates tasks"| node_tasks
node_tasks -->|"manages tasks"| node_taskmodel
node_tasks -->|"deletes files"| node_filesystem
node_http -->|"implements task steps"| node_taskmodel
node_packregistry -.->|"loads packs"| node_specialpacks
node_specialpacks -.->|"provides download tasks"| node_tasks
node_user -->|"manages downloads"| node_ui
node_user -->|"manages downloads"| node_androidui
node_browser -.->|"shows captured media"| node_extensionui
node_ui -.->|"controls tasks"| node_tasks
node_androidui -.->|"controls tasks"| node_tasks
node_settings -->|"configures services"| node_engine
node_tasks -.->|"persists task state"| node_storage
node_user -->|"submits RPC requests"| node_rpc

click node_browser "https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/browser_extension/app/src/background.ts"
click node_desktop "https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/platform/application.py"
click node_android "https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/android/app/src/main/java/com/xychr/ghostdownloader/MainActivity.kt"
click node_engine "https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/engine.py"
click node_feature "https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/services/feature_service.py"
click node_tasks "https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/services/task_service.py"
click node_taskmodel "https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/models/task.py"
click node_http "https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/features/http_pack/task.py"
click node_packregistry "https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/models/pack.py"
click node_specialpacks "https://github.com/xiaoyouchr/ghost-downloader-3/tree/main/features"
click node_ui "https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/view/pages/task_page.py"
click node_androidui "https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/android/app/src/main/java/com/xychr/ghostdownloader/ui/pages/TasksPage.kt"
click node_extensionui "https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/browser_extension/app/src/popup/App.tsx"
click node_settings "https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/config/cfg.py"
click node_rpc "https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/services/aria2_rpc.py"
click node_browserbridge "https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/services/browser_service.py"
click node_filesystem "https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/platform/filesystem.py"
click node_storage "https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/config/paths.py"

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_browser,node_desktop,node_android,node_rpc,node_browserbridge,node_user toneBlue
class node_engine,node_feature,node_tasks,node_taskmodel toneAmber
class node_http,node_packregistry,node_specialpacks toneMint
class node_ui,node_androidui,node_extensionui,node_settings toneRose
class node_filesystem,node_storage toneIndigo
```

## Components

### Intake and clients

- [Browser extension](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/browser_extension/app/src/background.ts): `browser_extension/app/src/background.ts`
- [Desktop app](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/platform/application.py): `app/platform/application.py`
- [Android app](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/android/app/src/main/java/com/xychr/ghostdownloader/MainActivity.kt): `android/app/src/main/java/com/xychr/ghostdownloader/MainActivity.kt`
- [aria2 RPC](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/services/aria2_rpc.py): `app/services/aria2_rpc.py`
- [Browser service](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/services/browser_service.py): `app/services/browser_service.py`

### Download engine

- [Engine orchestrator](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/engine.py): `app/engine.py`
- [Feature service](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/services/feature_service.py): `app/services/feature_service.py`
- [Task service](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/services/task_service.py): `app/services/task_service.py`
- [Task model](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/models/task.py): `app/models/task.py`

### Protocols and packs

- [HTTP downloads](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/features/http_pack/task.py): `features/http_pack/task.py`
- [Feature packs](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/models/pack.py): `app/models/pack.py`
- [Media and protocol packs](https://github.com/xiaoyouchr/ghost-downloader-3/tree/main/features): `features`

### User experience

- [Task interface](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/view/pages/task_page.py): `app/view/pages/task_page.py`
- [Android interface](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/android/app/src/main/java/com/xychr/ghostdownloader/ui/pages/TasksPage.kt): `android/app/src/main/java/com/xychr/ghostdownloader/ui/pages/TasksPage.kt`
- [Extension popup](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/browser_extension/app/src/popup/App.tsx): `browser_extension/app/src/popup/App.tsx`
- [Configuration](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/config/cfg.py): `app/config/cfg.py`

### Platform services

- [File operations](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/platform/filesystem.py): `app/platform/filesystem.py`
- [App data paths](https://github.com/xiaoyouchr/ghost-downloader-3/blob/main/app/config/paths.py): `app/config/paths.py`

### Other components

- **Downloader user**

## Connections

- Downloader user → Desktop app: submits links (evidence: `README.md`)
- Downloader user → Android app: submits links (evidence: `README.md`)
- Downloader user → Browser extension: captures media (evidence: `README.md`)
- Desktop app → Engine orchestrator: starts engine
- Android app → Engine orchestrator: uses download engine
- Browser extension → Browser service: sends resources (evidence: `README.md`)
- Browser service → Feature service: parses resources (evidence: `app/engine.py`)
- aria2 RPC → Feature service: parses requests (evidence: `app/engine.py`)
- Engine orchestrator → Feature service: activates (evidence: `app/engine.py`)
- Engine orchestrator → Task service: starts and stops (evidence: `app/engine.py`)
- Feature service → Task service: creates tasks
- Task service → Task model: manages tasks (evidence: `app/services/task_service.py`)
- Task service → File operations: deletes files (evidence: `app/services/task_service.py`)
- HTTP downloads → Task model: implements task steps (evidence: `features/http_pack/task.py`)
- Feature packs → Media and protocol packs: loads packs (evidence: `features/bittorrent_pack/config.py`)
- Media and protocol packs → Task service: provides download tasks
- Downloader user → Task interface: manages downloads (evidence: `README.md`)
- Downloader user → Android interface: manages downloads (evidence: `README.md`)
- Browser extension → Extension popup: shows captured media
- Task interface → Task service: controls tasks
- Android interface → Task service: controls tasks
- Configuration → Engine orchestrator: configures services (evidence: `app/engine.py`)
- Task service → App data paths: persists task state (evidence: `app/services/task_service.py`)
- Downloader user → aria2 RPC: submits RPC requests (evidence: `README.md`)
