rcarmo/bun-packrat

Single-file web archive: SQLite-backed, self-contained HTML, iOS Safari compatible

4

stars

47

commits

TypeScript

primary language

Aug 21, 2026

updated

README

bun-packrat

Packrat archive index

bun-packrat captures rendered web pages and source PDFs into SQLite. Web pages use Chromium MHTML as the source of record. Direct PDFs are retained byte-for-byte, deduplicated by SHA-256 and extracted with bounded PDF.js workers.

The service runs on Bun with SQLite FTS5, an in-process job queue and Playwright. It is designed for desktop browsers and Safari on iPhone and iPad.

Features

  • one SQLite database for captures, metadata, search, tags and jobs;
  • canonical Chromium MHTML with SHA-256 verification;
  • byte-exact source PDFs with inline/range delivery and extracted text;
  • offline full-page and simplified Article views;
  • a Markdown reader that uses authenticated, same-origin archived images when available;
  • server-side full-text search, filters and pagination;
  • HTML, Markdown ZIP, EPUB 3 and on-demand PDF exports;
  • HTTP API, bookmarklet, Bun CLI and an authenticated queue monitor at /status;
  • HTTP Basic authentication by default;
  • consistent online backup and streaming integrity verification;
  • read-only, resumable ArchiveBox migration and verified original-PDF enrichment.

Start with Docker

Set a password, then build and start the service:

export PACKRAT_AUTH_PASSWORD='replace-with-a-secret'
make up

Open http://localhost:3047/ and sign in as packrat.

For an unauthenticated service on a trusted network, set PACKRAT_AUTH_DISABLED=1 explicitly.

Develop locally

bun install
bun run typecheck
bun test
PACKRAT_AUTH_DISABLED=1 bun run start

The default database path is ./data/packrat.db.

Project status

Packrat v0.3.0 runs on Bun 1.4 and includes fresh web/PDF capture, search, offline reading, export, deletion, backup, verification, queue recovery, ArchiveBox import and original-PDF enrichment. It also:

  • recompresses embedded JPEG, PNG and WebP MIME parts when MHTML exceeds 20 MiB;
  • tries colour WebP quality 75, then greyscale WebP quality 75;
  • attempts zstd for every accepted web or imported HTML body and stores it only when smaller;
  • migrates existing bodies only when verified zstd output is smaller.

See the v0.3.0 implementation plan. ArchiveBox hostname cutover and retirement checks are separate operational work.

See the documentation index for setup, configuration, architecture, API, CLI and operations. Requirements and delivery status are tracked in the product requirements and implementation plan.

Licence

MIT © 2026 Rui Carmo

Contributors

rcarmo

46 commits

piclaw-bot

1 commits

rcarmo/bun-packrat

Single-file web archive: SQLite-backed, self-contained HTML, iOS Safari compatible

4

stars

47

commits

TypeScript

primary language

Aug 21, 2026

updated

README

bun-packrat

Packrat archive index

bun-packrat captures rendered web pages and source PDFs into SQLite. Web pages use Chromium MHTML as the source of record. Direct PDFs are retained byte-for-byte, deduplicated by SHA-256 and extracted with bounded PDF.js workers.

The service runs on Bun with SQLite FTS5, an in-process job queue and Playwright. It is designed for desktop browsers and Safari on iPhone and iPad.

Features

  • one SQLite database for captures, metadata, search, tags and jobs;
  • canonical Chromium MHTML with SHA-256 verification;
  • byte-exact source PDFs with inline/range delivery and extracted text;
  • offline full-page and simplified Article views;
  • a Markdown reader that uses authenticated, same-origin archived images when available;
  • server-side full-text search, filters and pagination;
  • HTML, Markdown ZIP, EPUB 3 and on-demand PDF exports;
  • HTTP API, bookmarklet, Bun CLI and an authenticated queue monitor at /status;
  • HTTP Basic authentication by default;
  • consistent online backup and streaming integrity verification;
  • read-only, resumable ArchiveBox migration and verified original-PDF enrichment.

Start with Docker

Set a password, then build and start the service:

export PACKRAT_AUTH_PASSWORD='replace-with-a-secret'
make up

Open http://localhost:3047/ and sign in as packrat.

For an unauthenticated service on a trusted network, set PACKRAT_AUTH_DISABLED=1 explicitly.

Develop locally

bun install
bun run typecheck
bun test
PACKRAT_AUTH_DISABLED=1 bun run start

The default database path is ./data/packrat.db.

Project status

Packrat v0.3.0 runs on Bun 1.4 and includes fresh web/PDF capture, search, offline reading, export, deletion, backup, verification, queue recovery, ArchiveBox import and original-PDF enrichment. It also:

  • recompresses embedded JPEG, PNG and WebP MIME parts when MHTML exceeds 20 MiB;
  • tries colour WebP quality 75, then greyscale WebP quality 75;
  • attempts zstd for every accepted web or imported HTML body and stores it only when smaller;
  • migrates existing bodies only when verified zstd output is smaller.

See the v0.3.0 implementation plan. ArchiveBox hostname cutover and retirement checks are separate operational work.

See the documentation index for setup, configuration, architecture, API, CLI and operations. Requirements and delivery status are tracked in the product requirements and implementation plan.

Licence

MIT © 2026 Rui Carmo

Contributors

rcarmo

46 commits

piclaw-bot

1 commits

Languages

TypeScript

99.0%