Project

bun-readlater-epub

active

Self-hosted read-later service that turns saved article URLs into EPUBs in a Calibre library for OPDS readers.

Overview

bun-readlater-epub takes a URL from a Safari bookmarklet, extracts the article and writes a self-contained EPUB in a dedicated Calibre library. OPDS clients such as KOReader handle delivery and reading, which keeps the service focused on capture and conversion.

It is designed for one user on a trusted network. Authentication is a shared token and the queue is intentionally serial.

How it works

The Bun HTTP service records each submission in SQLite and passes it to a serial queue. The fetch stage normalises and deduplicates URLs, applies timeout and size limits, extracts readable HTML and can fall back to an archived copy.

Images are fetched, resized, converted to greyscale e-ink modes and embedded locally. The EPUB packager and Calibre metadata.db writer use Bun and standard-library primitives rather than external EPUB or Calibre management libraries. The result appears in a dedicated library for downstream OPDS clients.

Features
Safari capture

A Safari bookmarklet uses a plain form submit for compatibility and returns a small acknowledgement page after saving.

Defensive fetching

Browser-like requests, timeouts, retries, content-type checks, size limits, canonical URL deduplication and tracking-parameter removal.

Offline EPUBs

Readable article HTML and locally embedded images are packaged directly into self-contained EPUB files.

E-ink image modes

Adaptive greyscale processing includes gray8 and gray4-dither output modes.

Calibre library writer

Creates the Calibre-compatible library hierarchy and updates metadata.db without invoking Calibre.

Queue visibility

The web UI shows queue status, item detail, attempt history, and retry or refetch controls.

Architecture
Safari bookmarklet URL + shared token Bun service HTTP + SQLite queue Fetch + extract clean HTML · local images EPUB packager self-contained article Calibre library files + metadata.db OPDS / KOReader delivery + offline reading Saved article URL to offline EPUB