Verified against code on 2026-08-07.
mangarr is a Go CLI for:
- one-shot manga chapter downloads
- continuous monitoring for newly released chapters
- packaging downloaded chapters into
.cbzarchives
| Domain | Main entrypoints | Notes |
|---|---|---|
| Download now | cmd/download.go |
source discovery and chapter selection |
| Continuous monitor | cmd/monitor.go |
config load, reload-aware scheduler, latest-chapter selection |
| Source integration | internal/source/ |
highest churn; mixed API and HTML scraping |
| Chapter acquisition | internal/acquire/, internal/download/, internal/files/ |
naming, existing-file policy, page resolution, image fetch, CBZ creation |
| Ops + packaging | .github/workflows/release.yml, .goreleaser.yaml, ci.Dockerfile |
release binaries and multi-arch Docker images |
| Layer | Packages | Responsibility |
|---|---|---|
| CLI surface | main.go, cmd/ |
parse flags, bootstrap commands, orchestrate flows |
| Application orchestration | cmd/, internal/acquire/, internal/config/ |
compose sources, acquire chapters, concurrency, config/runtime lifecycle |
| Core domain helpers | internal/domain/, internal/parse/, internal/templater/, internal/sanitize/ |
shared logic independent from any source |
| Integration layer | internal/source/, internal/sharedhttp/, internal/download/ |
fetch remote data and retry transient failures |
| Output + observability | internal/files/, internal/logger/, internal/perf/, internal/buildinfo/ |
atomic archive publication, logging, profiling, build metadata |
Rule: source-specific scraping logic stays in internal/source/. Generic retry, archive creation, and parsing stay shared.
- Validate CLI input and destination path.
- Construct source adapter from
-s. - Fetch manga metadata and chapter list.
- Resolve requested chapter set.
- Pass each selected chapter to
internal/acquire/. - Apply naming and existing-file policy.
- Resolve and download pages concurrently.
- Publish the
.cbzarchive.
- Load config and env overrides.
- Initialize logger and optional
pprof. - Start config reload watcher.
- Tick on
checkInterval. - For each monitored manga, resolve source adapter.
- Pass the latest chapter to the shared acquisition module.
- Report its downloaded or skipped outcome.
- Concurrency caps:
- chapter jobs:
maxConcurrentChapterProcesses - monitor source jobs:
maxConcurrentSourceProcesses - image downloads:
maxConcurrentImageDownloads
- chapter jobs:
- Retry policy:
- shared in
internal/sharedhttp/ - retries transport failures and
500/502/503/504 - fails fast on
404/429/401/403/405
- shared in
internal/source/: upstream site drift; brittle selectors; auth/rate-limit changescmd/monitor.go: long-lived concurrency and shutdown behaviorinternal/config/config.go: config template, defaults, env overrides, live reloadinternal/download/: retry behavior and archive write seam