Verified against code on 2026-03-25.
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 selection, chapter selection, archive write |
| Continuous monitor | cmd/monitor.go |
config load, ticker loop, dynamic reload, latest-chapter fetch |
| Source integration | internal/source/ |
highest churn; mixed API, HTML scraping, browser automation |
| Archive assembly | internal/download/, internal/files/ |
image fetch, retry, 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/config/, internal/browser/ |
compose sources, concurrency, config/runtime lifecycle |
| Core domain helpers | internal/domain/, internal/parse/, internal/templater/, internal/sanitize/, internal/semaphore/ |
shared logic independent from any source |
| Integration layer | internal/source/, internal/sharedhttp/, internal/download/ |
fetch remote data, retry transient failures, browser-backed scraping |
| Output + observability | internal/files/, internal/logger/, internal/perf/, internal/buildinfo/ |
archive write, logging, profiling, build metadata |
Rule: source-specific scraping logic stays in internal/source/. Generic retry, browser lifecycle, 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.
- Skip existing archives.
- Fetch image URLs.
- Download images concurrently.
- Write
.cbz.
- Load config and env overrides.
- Initialize logger and optional
pprof. - Start config reload watcher.
- Tick on
checkInterval. - For each monitored manga, resolve source adapter.
- Fetch latest chapter and skip if archive already exists.
- Download and archive latest chapter.
- 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
- Browser-backed sources:
- none currently
- shared lifecycle in
internal/browser/remains available for future JS-heavy sources
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