# nyn-05/swiftfetch architecture

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

- Interactive diagram: https://gitdiagram.com/nyn-05/swiftfetch
- Repository: https://github.com/nyn-05/swiftfetch

## Overview

SwiftFetch is a Windows-first CLI download manager. Users submit URLs or a URL-list file, then the application queues and schedules downloads, probes remote resources, transfers bytes sequentially or in segments, safely finalizes files, and can extract completed ZIPs. Persistent queue state supports status, resume, and retry commands. The source index supports the main module relationships; several subsystem links below are documented in the README because their implementations were not excerpted.

Main entry points: [`src/download/resume.rs`](https://github.com/nyn-05/swiftfetch/blob/main/src/download/resume.rs) (Resume engine), [`src/storage/repository.rs`](https://github.com/nyn-05/swiftfetch/blob/main/src/storage/repository.rs) (Queue repository), [`src/app/commands_handler.rs`](https://github.com/nyn-05/swiftfetch/blob/main/src/app/commands_handler.rs) (Command handler), [`src/download/http.rs`](https://github.com/nyn-05/swiftfetch/blob/main/src/download/http.rs) (HTTP client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["CLI interface"]
  node_cli["CLI commands<br/>[mod.rs]"]
  node_config["Download configuration<br/>[config.rs]"]
end

subgraph group_orchestration["Application orchestration"]
  node_commands["Command handler"]
  node_batch["Batch scheduler<br/>[batch.rs]"]
end

subgraph group_transfer["Download engine"]
  node_engine["Resume engine<br/>[resume.rs]"]
  node_probe["Resource probe<br/>[probe.rs]"]
  node_http["HTTP client<br/>[http.rs]"]
  node_sequential["Sequential transfer<br/>[sequential.rs]"]
  node_segmented["Segmented transfer<br/>[segmented.rs]"]
  node_retry["Retry policy<br/>[retry.rs]"]
  node_progress["Transfer progress<br/>[progress.rs]"]
end

subgraph group_persistence["Persistence and files"]
  node_repository["Queue repository<br/>[repository.rs]"]
  node_schema["Queue schema<br/>[schema.rs]"]
  node_database[("SQLite queue")]
  node_writer["Partial-file writer<br/>[file_writer.rs]"]
  node_filesystem[("Output files")]
end

subgraph group_results["Completion and display"]
  node_archive["ZIP extraction<br/>[zip_extract.rs]"]
  node_status["Queue status<br/>[status.rs]"]
  node_display["Live progress display<br/>[progress.rs]"]
end

node_user(("User"))
node_remote{{"HTTP servers"}}

node_user -->|"submits commands"| node_cli
node_cli -->|"maps options"| node_config
node_cli -->|"dispatches"| node_commands
node_commands -->|"runs batches"| node_batch
node_commands -->|"reads queue"| node_repository
node_commands -->|"renders status"| node_status
node_commands -->|"shows progress"| node_display
node_batch -->|"queues records"| node_repository
node_batch -->|"runs transfers"| node_engine
node_engine -->|"probes resource"| node_probe
node_probe -->|"sends probes"| node_http
node_engine -->|"streams bytes"| node_sequential
node_engine -->|"dispatches ranges"| node_segmented
node_engine -->|"retries failures"| node_retry
node_sequential -->|"fetches content"| node_http
node_segmented -->|"fetches ranges"| node_http
node_retry -->|"retries requests"| node_http
node_engine -->|"records lifecycle"| node_repository
node_sequential -->|"writes partials"| node_writer
node_segmented -->|"writes segments"| node_writer
node_engine -->|"finalizes files"| node_writer
node_writer -->|"writes and renames"| node_filesystem
node_repository -->|"persists queue"| node_database
node_repository -->|"uses schema"| node_schema
node_http -->|"requests resources"| node_remote
node_sequential -->|"updates counters"| node_progress
node_segmented -->|"updates counters"| node_progress
node_display -->|"reads snapshots"| node_progress
node_status -.->|"lists records"| node_repository
node_engine -.->|"extracts completed ZIPs"| node_archive
node_archive -->|"uses safe file handling"| node_writer

click node_cli "https://github.com/nyn-05/swiftfetch/blob/main/src/cli/mod.rs"
click node_config "https://github.com/nyn-05/swiftfetch/blob/main/src/config.rs"
click node_commands "https://github.com/nyn-05/swiftfetch/blob/main/src/app/commands_handler.rs"
click node_batch "https://github.com/nyn-05/swiftfetch/blob/main/src/app/batch.rs"
click node_engine "https://github.com/nyn-05/swiftfetch/blob/main/src/download/resume.rs"
click node_probe "https://github.com/nyn-05/swiftfetch/blob/main/src/download/probe.rs"
click node_http "https://github.com/nyn-05/swiftfetch/blob/main/src/download/http.rs"
click node_sequential "https://github.com/nyn-05/swiftfetch/blob/main/src/download/sequential.rs"
click node_segmented "https://github.com/nyn-05/swiftfetch/blob/main/src/download/segmented.rs"
click node_retry "https://github.com/nyn-05/swiftfetch/blob/main/src/download/retry.rs"
click node_progress "https://github.com/nyn-05/swiftfetch/blob/main/src/download/progress.rs"
click node_repository "https://github.com/nyn-05/swiftfetch/blob/main/src/storage/repository.rs"
click node_schema "https://github.com/nyn-05/swiftfetch/blob/main/src/storage/schema.rs"
click node_writer "https://github.com/nyn-05/swiftfetch/blob/main/src/storage/file_writer.rs"
click node_archive "https://github.com/nyn-05/swiftfetch/blob/main/src/archive/zip_extract.rs"
click node_status "https://github.com/nyn-05/swiftfetch/blob/main/src/cli/status.rs"
click node_display "https://github.com/nyn-05/swiftfetch/blob/main/src/cli/progress.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_cli,node_config,node_user toneBlue
class node_commands,node_batch toneAmber
class node_engine,node_probe,node_http,node_sequential,node_segmented,node_retry,node_progress,node_remote toneMint
class node_repository,node_schema,node_database,node_writer,node_filesystem toneRose
class node_archive,node_status,node_display toneIndigo
```

## Components

### CLI interface

- [CLI commands](https://github.com/nyn-05/swiftfetch/blob/main/src/cli/mod.rs): `src/cli/mod.rs`
- [Download configuration](https://github.com/nyn-05/swiftfetch/blob/main/src/config.rs): `src/config.rs`

### Application orchestration

- [Command handler](https://github.com/nyn-05/swiftfetch/blob/main/src/app/commands_handler.rs): `src/app/commands_handler.rs`
- [Batch scheduler](https://github.com/nyn-05/swiftfetch/blob/main/src/app/batch.rs): `src/app/batch.rs`

### Download engine

- [Resume engine](https://github.com/nyn-05/swiftfetch/blob/main/src/download/resume.rs): `src/download/resume.rs`
- [Resource probe](https://github.com/nyn-05/swiftfetch/blob/main/src/download/probe.rs): `src/download/probe.rs`
- [HTTP client](https://github.com/nyn-05/swiftfetch/blob/main/src/download/http.rs): `src/download/http.rs`
- [Sequential transfer](https://github.com/nyn-05/swiftfetch/blob/main/src/download/sequential.rs): `src/download/sequential.rs`
- [Segmented transfer](https://github.com/nyn-05/swiftfetch/blob/main/src/download/segmented.rs): `src/download/segmented.rs`
- [Retry policy](https://github.com/nyn-05/swiftfetch/blob/main/src/download/retry.rs): `src/download/retry.rs`
- [Transfer progress](https://github.com/nyn-05/swiftfetch/blob/main/src/download/progress.rs): `src/download/progress.rs`

### Persistence and files

- [Queue repository](https://github.com/nyn-05/swiftfetch/blob/main/src/storage/repository.rs): `src/storage/repository.rs`
- [Queue schema](https://github.com/nyn-05/swiftfetch/blob/main/src/storage/schema.rs): `src/storage/schema.rs`
- **SQLite queue**
- [Partial-file writer](https://github.com/nyn-05/swiftfetch/blob/main/src/storage/file_writer.rs): `src/storage/file_writer.rs`
- **Output files**

### Completion and display

- [ZIP extraction](https://github.com/nyn-05/swiftfetch/blob/main/src/archive/zip_extract.rs): `src/archive/zip_extract.rs`
- [Queue status](https://github.com/nyn-05/swiftfetch/blob/main/src/cli/status.rs): `src/cli/status.rs`
- [Live progress display](https://github.com/nyn-05/swiftfetch/blob/main/src/cli/progress.rs): `src/cli/progress.rs`

### Other components

- **User**
- **HTTP servers**

## Connections

- User → CLI commands: submits commands (evidence: `README.md`)
- CLI commands → Download configuration: maps options (evidence: `src/cli/mod.rs`)
- CLI commands → Command handler: dispatches (evidence: `src/app/mod.rs`)
- Command handler → Batch scheduler: runs batches (evidence: `src/app/commands_handler.rs`)
- Command handler → Queue repository: reads queue (evidence: `src/app/commands_handler.rs`)
- Command handler → Queue status: renders status (evidence: `src/app/commands_handler.rs`)
- Command handler → Live progress display: shows progress (evidence: `src/app/commands_handler.rs`)
- Batch scheduler → Queue repository: queues records (evidence: `src/app/batch.rs`)
- Batch scheduler → Resume engine: runs transfers (evidence: `src/app/batch.rs`)
- Resume engine → Resource probe: probes resource (evidence: `src/download/resume.rs`)
- Resource probe → HTTP client: sends probes (evidence: `src/download/probe.rs`)
- Resume engine → Sequential transfer: streams bytes (evidence: `src/download/resume.rs`)
- Resume engine → Segmented transfer: dispatches ranges (evidence: `src/download/resume.rs`)
- Resume engine → Retry policy: retries failures (evidence: `src/download/resume.rs`)
- Sequential transfer → HTTP client: fetches content (evidence: `src/download/sequential.rs`)
- Segmented transfer → HTTP client: fetches ranges (evidence: `src/download/segmented.rs`)
- Retry policy → HTTP client: retries requests (evidence: `src/download/retry.rs`)
- Resume engine → Queue repository: records lifecycle (evidence: `src/download/resume.rs`)
- Sequential transfer → Partial-file writer: writes partials (evidence: `src/download/sequential.rs`)
- Segmented transfer → Partial-file writer: writes segments (evidence: `src/download/segmented.rs`)
- Resume engine → Partial-file writer: finalizes files (evidence: `src/download/resume.rs`)
- Partial-file writer → Output files: writes and renames (evidence: `src/storage/file_writer.rs`)
- Queue repository → SQLite queue: persists queue (evidence: `README.md`)
- Queue repository → Queue schema: uses schema (evidence: `src/storage/repository.rs`)
- HTTP client → HTTP servers: requests resources (evidence: `README.md`)
- Sequential transfer → Transfer progress: updates counters (evidence: `src/download/sequential.rs`)
- Segmented transfer → Transfer progress: updates counters (evidence: `src/download/segmented.rs`)
- Live progress display → Transfer progress: reads snapshots (evidence: `src/cli/progress.rs`)
- Queue status → Queue repository: lists records
- Resume engine → ZIP extraction: extracts completed ZIPs
- ZIP extraction → Partial-file writer: uses safe file handling (evidence: `src/archive/zip_extract.rs`)
