Skip to main content
02/13 Case Study
New November 25, 2026 RustSystems ProgrammingDesktop App

Open Downloader — IDM-Style Download Engine in Rust

An open-source, IDM-class download manager written entirely in Rust — a segmented engine with work-stealing ranged chunks and crash-proof resume journals, a headless daemon exposing REST + SSE + MCP, a native GPUI desktop app, and a browser extension that hands captures to the app over token-gated localhost IPC. HLS and DASH built in, AES-128 included.

Year
2026
Focus
Rust
Reading
7 min· 8 sections
Published
Web
Original Resource
Open Downloader — IDM-Style Download Engine in Rust
Full Capture
Open Downloader — IDM-Style Download Engine in Rust — detailed view

"A download manager is a trust problem: the file has to survive Ctrl-C, a killed process, a dead battery — and come back byte-exact. Everything else — the GPUI app, the browser capture, the MCP surface — is a different frontend over the same guarantee."

Ikziriv Project Author & Maintainer

Project Overview

Open Downloader is an open-source download manager in the Internet Download Manager tradition, built as a Rust workspace of five crates on tokio + reqwest (rustls) + axum 0.8, Rust 2024 edition. The core library implements a two-phase Fetcher/Resource model — a resolve step that produces a fully-described resource before a single payload byte moves — feeding a ranged chunk-queue engine with work-stealing, retry/backoff, per-task rate limiting, and SHA-256 verification. Around the engine sit four frontends and one capture path: `od`, the headless CLI and `od serve` daemon; `od-api`, an Axum control plane exposing a REST v1 API, Server-Sent Events, a JSON-RPC 2.0 MCP endpoint, and an embedded web dashboard; `od-app`, a native GPUI desktop application with live progress; and `od-nmh`, a native-messaging host bridging the MV3 browser extension into the running app. Every interface — CLI flag, REST call, SSE frame, MCP tool, extension popup — drives the same TaskManager, so state stays consistent no matter where it is touched.

The Challenge

IDM-class reliability on modern infrastructure — where the enemies are partial state, protocol diversity, and dependency weight.

Browser Downloads Are a Black Box

Native browser downloaders are single-connection, offer no real pause/resume contract, and bury files in one folder. Rebuilding the IDM capture loop — intercepting browser downloads with cookies and referer intact, then handing them to a real engine — requires a native-messaging bridge plus a local API the browser can trust.

Resume Must Survive Anything

Pause buttons are easy; surviving SIGKILL, power loss and reboots is not. Every chunk completion, config change and task record needed atomic persistence — write-tmp-then-rename everywhere — and a journal format that can reconstruct exact byte coverage on restart, guarded by etag and size.

Streams Are Not Files

HLS and DASH are playlists, not payloads: master playlists with bandwidth variants, segment templates with timelines, and AES-128 encrypted segments with rotating keys. The engine had to treat ordered segment dirs, decryption, and concatenation as first-class download shapes — while refusing DRM-protected content cleanly rather than failing silently.

Native UI vs. Build Economics

GPUI delivers a genuinely native desktop app — but pulls ~400 dependency crates and a 10+ minute cold build. Shipping it in the default workspace would tax every contributor and CI run. The architecture needed the GUI isolated as an optional member without forking the codebase.

Solution Architecture

Five crates — one engine, one control plane, one CLI, one desktop app, one browser bridge.

01

01. od-core — The Download Engine

The library everything else drives. Two-phase Fetcher/Resource: resolve inspects the URL (redirects, Content-Length, Accept-Ranges, filename, mime) and returns a typed Resource before download planning. The TaskManager schedules tasks — two-at-a-time by default — over a ranged chunk queue with work-stealing. Completed chunks persist to a .odj journal (BTreeSet<u64> guarded by etag+size); Ctrl-C pauses, restart resumes. Streams land in .segments/ dirs; HLS picks the best-bandwidth variant and decrypts AES-128 EXT-X-KEY including key rotation; DASH handles SegmentList, SegmentTemplate+SegmentTimeline and BaseURL representations.

02

02. od-api — The Control Plane

Axum 0.8 on 127.0.0.1:19799. REST v1 covers resolve, task CRUD with pause/resume/delete, batch creation, config read/write, health and speedtest; SSE /api/v1/events streams TaskEvent frames with 15s keep-alive for live UIs; /mcp implements JSON-RPC 2.0 (protocol 2024-11-05) with 7 tools; GET / serves the embedded Web Control Center. Every endpoint except / and /health requires the shared 128-bit token as x-od-token or Bearer.

03

03. od-cli — The Headless Workhorse

The `od` binary: direct downloads with -o destinations, `resolve` for inspection, `serve` to run the daemon, plus `speedtest`, `batch`, `verify`, `config`, `doctor`, `status` and `autostart`. The same binary the extension falls back to when no app is running — `od-nmh` spawns `od.exe` from its own directory when /add is unreachable.

04

04. od-app — The GPUI Desktop

A native GPUI application (Obsidian Cobalt / Porcelain Slate themes) with live progress sparklines, Speed Test and Settings. Excluded from default workspace members — its ~400-crate dependency tree builds only on explicit -p od-app. Binding 127.0.0.1:19799 doubles as the single-instance lock; a second launch exits cleanly. "Paste URL & Download" reads the clipboard — the intended input path while raw GPUI ships no text input.

05

05. od-nmh + Extension — The IDM Capture Loop

The MV3 extension (Chrome/Edge, Firefox variant) intercepts browser downloads and forwards {url, filename, cookie, referer} to /add through the od-nmh stdio bridge — or falls back to browser-native suggest() with no host installed. The popup controls capture on/off, per-type and custom extension filters, minimum file size, and per-site exclusions. A media sniffer badges .mp4/.m3u8/.mpd/audio requests the tab has made, each with a one-click Get that sends referer + cookies along.

06

06. deploy/ + CI — Install and Ship

OS-native startup artifacts ship in deploy/: Windows Task Scheduler XML (HKCU Run fallback), macOS LaunchAgent plist, Linux systemd user unit (+ .desktop fallback) — all managed by od autostart. install.ps1 builds release binaries, registers the native-messaging host, adds a Start Menu shortcut and puts od on PATH. CI runs clippy -D warnings and the full suite on Linux/macOS/Windows; tagged releases emit stripped thin-LTO binaries + sha256 digests for four targets.

Workspace Topology

Five crates around one engine — every frontend drives the same TaskManager, every task lands in the same atomic persistence layer.

Segmented Download Pipeline

Resolve once, plan chunks, fetch ranges concurrently — the journal makes any interruption a pause, not a loss.

Technical Implementation

The engineering decisions that make IDM-class reliability work in Rust.

Two-Phase Fetcher/Resource

Every download starts as a resolution — following redirects, reading Content-Length and Accept-Ranges, sniffing filename and mime — producing a typed Resource the planner can reason about before committing I/O. The same resolve is exposed standalone (od resolve, POST /api/v1/resolve, MCP resolve_url) so callers can inspect a resource without downloading it.

Work-Stealing Chunks + Crash Journals

Open ranges split into a chunk queue workers steal from — fast connections absorb work from slow ones. Each completion appends to a .odj journal: a BTreeSet<u64> of finished chunk indexes guarded by the origin etag and size, so a changed resource can never resume into corruption. The .part file is preallocated sparse; on start, active tasks recover as Paused and finished chunks are skipped outright.

HLS + DASH + AES-128, In-Engine

M3U8 masters resolve to the best-bandwidth variant; segments download into ordered .segments/NNNNNN dirs for resumable stream pulls, then concatenate to .ts or .mp4 for fMP4. EXT-X-KEY AES-128 decrypts inline — including mid-playlist key rotation. DASH covers SegmentList, SegmentTemplate with SegmentTimeline, and BaseURL reps. DRM (SAMPLE-AES, Widevine, FairPlay), live streams and multi-track remux return explicit errors, never silent corruption.

Atomic Persistence Everywhere

config.json, tasks.json and journals all write tmp-then-rename — no partial state survives a kill. FileTaskStore reloads task history on startup; the 32-char hex auth.token generates once via getrandom and gates every non-trivial endpoint. Downloads organize into type folders (Video/Audio/Documents/Images/Compressed/Programs) from extension → stream kind → Content-Type — but an explicit -o path is never moved.

Loopback + Token Trust Model

The daemon binds 127.0.0.1:19799 only — the port doubles as od-app single-instance lock. The shared 128-bit token (x-od-token or Bearer) proves the caller is a process running as the same user, matching the native-messaging trust model: od-nmh is already local code, so the token is transport for intent, not a real secret boundary. Documented honestly rather than over-claimed.

One Engine, Five Surfaces — Including MCP

The MCP endpoint speaks JSON-RPC 2.0 (protocol 2024-11-05) with 7 tools — resolve_url, create_download, list_downloads, pause/resume/remove_download, run_speedtest — so AI agents drive the engine through the same TaskManager as the CLI. SSE TaskEvent frames (15s keep-alive) let every UI — web dashboard, GPUI sparkline, agent polling — watch identical live state instead of reimplementing progress.

5 Workspace Crates

Engine library, Axum control plane, CLI, GPUI desktop, and the native-messaging bridge.

7 MCP Tools

JSON-RPC 2.0 tool surface — resolve, create, list, pause, resume, remove, speedtest — for AI agents.

14 REST Endpoints

API v1 covering tasks, batch, resolve, config, events, speedtest, health and the legacy /add capture path.

~400 GPUI Deps Isolated

Crates excluded from default workspace members — the GUI builds only when explicitly requested.

4 Release Targets

Windows MSVC, Linux GNU, macOS aarch64 + x86_64 — thin-LTO, stripped, sha256-signed in CI.

128-bit Auth Token

getrandom-generated shared secret gating every endpoint except health and the dashboard.

Open Downloader Web Control Center — Obsidian Cobalt theme

Web Control Center — `od serve` daemon dashboard with live task state

Native GPUI desktop application with live progress

Native GPUI desktop app — live sparkline, per-item pause/resume, Speed Test

Engineering Honesty — Known Boundaries

The project states its edges plainly. DRM-protected streams (SAMPLE-AES, Widevine, FairPlay), live broadcasts and multi-track remuxing are explicit errors, not silent breakage. The GUI is Windows-first — od-core and od-cli are cross-platform, but the desktop app and install scripts target Windows 10/11 today. Raw GPUI has no text input yet, so paste-URL is clipboard-driven by design, not accident. And the repo itself warns: cargo check does not emit binaries — a hard-won note from stale .exe files biting twice.

Roadmap

Near-term work widens the desktop story: od-app on Linux and macOS once the GPUI input and packaging paths mature, a packaged extension release for the Chrome and Firefox stores (it currently loads unpacked), and deeper media-sniffing integration so captured streams flow straight into HLS/DASH tasks without a manual Get click. Longer horizon: multi-connection scheduling beyond the current two-at-a-time policy, richer MCP tool coverage over config and journals, and browser-push of finished files back to the OS share sheet. The contract stays fixed — resolve first, journal everything, degrade honestly, and let every frontend share one engine.