Skip to content

About

πŸ“š A lightweight, self-hosted PDF and EPUB indexing library and reader. Built with Rust and Svelte, it turns your server's local directory into an accessible, filesystem-driven digital archive.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

20 Commits

Folders and files

Repository files navigation

NextChapter logo

NextChapter

Your library. Your files. One gorgeous reader.

A lightweight, self-hosted PDF & EPUB library with a blazing-fast full-text search engine and a beautiful built-in web reader.

License CI Formats Platforms Built with Buy Me A Coffee


NextChapter in action


Important

NextChapter began as an enhanced fork of Inkheart by Nystik and has grown into its own project β€” adding native EPUB reading, multi-arch CI/CD (linux/amd64 + linux/arm64), nine curated themes, and a deeply reworked reader experience.


🧭 The idea

Your filesystem is the source of truth. No database. No metadata curation. No lock-in.

Drop your files into folders, point NextChapter at the directory, and it:

  1. πŸ“‚ Mirrors your exact folder hierarchy
  2. πŸ–ΌοΈ Extracts high-resolution cover art automatically
  3. πŸ” Builds an instant full-text search index (PDF pages and EPUB chapters)
  4. πŸ“– Serves it all through a sleek web reader β€” desktop, tablet, and mobile

It deliberately does one thing exceptionally well: a fast, beautiful way to read and search your own documents. It's not a comic scraper, not an OPDS manager, not a metadata librarian.


✨ Highlights

πŸ“š LibraryπŸ“– Readers
  • Filesystem-driven β€” your folder tree is the library, zero redundancy
  • Full-text search β€” powered by Tantivy; searches inside PDF pages and EPUB chapters with heading boosts, and only re-indexes files that changed (mtime)
  • Smart covers β€” automatic cover extraction from PDF first pages & EPUB metadata, with graceful fallback
  • Pins & Collections β€” pin favourite folders to the sidebar, group documents into custom collections
  • OpenGraph previews β€” share a link to any page or chapter and get a rich preview card
  • PDF β€” PDF.js engine with continuous scroll, page spreads, thumbnails, and outline navigation
  • EPUB β€” epub.js engine with TOC sidebar, paginated or continuous-scroll flow, and a location pill (Page n / m)
  • Keyboard & touch β€” ← β†’ Space PgUp PgDn page turns, swipe on mobile, safe with open dialogs
  • Progress that sticks β€” resumes exactly where you left off, down to the CFI location, saved locally
  • Deep links β€” /reader/:id?page=4 or any CFI anchor for direct linking
🎨 AppearanceπŸ›‘οΈ Operations
  • 9 curated themes β€” Light, Dark, Glassmorphism, Neomorphism, Aurora, Neo-Brutalism, Cyberpunk, Monochrome + a system mode
  • Theme the book, not just the app β€” reader canvas follows the selected theme reliably, even after switching back and forth
  • Per-theme color scheme β€” native controls, scrollbars, and form inputs match too
  • Mobile-first responsive β€” drawer sidebar, auto-collapsing toolbars, touch navigation
  • Single static binary + SPA β€” Rust (Actix-Web) backend, Svelte frontend, distroless container
  • Multi-arch images β€” linux/amd64 & linux/arm64: Raspberry Pi 4/5, Apple Silicon, NAS, VPS β€” all native
  • Runs as non-root β€” UID 1000 inside the container
  • Optional auth β€” drop-in Firebase Auth gate with account whitelisting
  • Reverse-proxy friendly β€” sub-path deployments via BASE_PATH

πŸš€ Quickstart

Create a docker-compose.yml:

services:
  nextchapter:
    image: ghcr.io/keshavsapra/nextchapter:latest
    container_name: nextchapter
    restart: unless-stopped
    ports:
      - "8080:8080"
    volumes:
      - /path/to/your/books:/media         # Your PDFs and EPUBs
      - /path/to/covers:/covers            # Extracted cover images
      - /path/to/thumbnails:/thumbnails    # OpenGraph preview thumbnails
      - /path/to/config:/config            # Search index, settings, and pins
    environment:
      - BIND_ADDR=0.0.0.0
      - BIND_PORT=8080
      - SCAN_INTERVAL=600                  # Filesystem re-scan interval in seconds
      - TEXT_INDEX_ENABLED=true            # Enable full-text search indexing

Ensure the storage directories exist with write permissions for the container's non-root user (UID 1000):

mkdir -p /path/to/{covers,thumbnails,config,books}
sudo chown -R 1000:1000 /path/to/covers /path/to/thumbnails /path/to/config

Tip

Alternatively, set user: "0:0" in the compose file to run as root on the host.

Then:

docker compose up -d

…and open http://localhost:8080.

Note

The first index build over a large collection can take a few minutes. Since /config is persisted, later restarts only scan for new or modified files.


πŸ’» Cross-platform deployment

Images are published as multi-architecture containers (linux/amd64, linux/arm64) β€” Docker picks the right one automatically:

Platform Works with
Linux / VPS Ubuntu, Debian, Fedora, Arch, Alpine
Home servers / NAS Synology, Unraid, TrueNAS SCALE, QNAP, Portainer
Single-board Raspberry Pi 4B / 5, Rock Pi, Orange Pi
macOS / Windows Docker Desktop, including native Apple Silicon

Docker CLI

docker run -d \
  --name nextchapter \
  --restart unless-stopped \
  -p 8080:8080 \
  -v /path/to/your/books:/media \
  -v /path/to/covers:/covers \
  -v /path/to/thumbnails:/thumbnails \
  -v /path/to/config:/config \
  ghcr.io/keshavsapra/nextchapter:latest

βš™οΈ Configuration

Configure via environment variables or a nextchapter.toml (legacy inkheart.toml also accepted).

Environment Variable Description Default
MEDIA_DIR Directory containing your PDF and EPUB files /media
IMAGE_DIR Directory where book covers are cached /covers
THUMBNAIL_DIR Directory for on-demand page preview thumbnails /thumbnails
CONFIG_DIR Directory storing user data, pins, collections, and search index Parent dir of CONFIG_PATH
CONFIG_PATH Optional path to a nextchapter.toml file ./nextchapter.toml
BIND_ADDR Network address the server binds to 127.0.0.1 (0.0.0.0 in Docker)
BIND_PORT HTTP port 8080
SCAN_INTERVAL Filesystem scan interval for changes (in seconds) 600 (10 min)
COVER_WIDTH Width in pixels for extracted cover art 900
THUMBNAIL_WIDTH Width in pixels for preview thumbnails 300
TEXT_INDEX_ENABLED Enables full-text search indexing true
BASE_PATH Subdirectory path prefix (e.g. /books) when behind reverse proxy ""
FIREBASE_CONFIG_PATH Path to firebase.json for optional Google/email auth ./firebase.json
FIREBASE_WHITELIST Path to text file with whitelisted user IDs None

🌐 Reverse proxy & subdirectory setup

Root domain

location / {
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

Subdirectory (e.g. /library/)

Set BASE_PATH=/library in the container environment, then:

location /library/ {
    proxy_pass http://127.0.0.1:8080/;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

Works the same with Caddy, Traefik, or Cloudflare Tunnels.


πŸ› οΈ Building from source

Local Docker build

docker build -t nextchapter:local -f docker/dockerfile .

CI/CD

Every push triggers .github/workflows/docker.yml, which builds multi-arch images (linux/amd64, linux/arm64) and publishes them to GitHub Container Registry (ghcr.io).


πŸ—οΈ Architecture

nextchapter/
β”œβ”€β”€ backend/            # Rust Actix-Web server
β”‚   β”œβ”€β”€ indexer/        # Filesystem scanner, PDF/EPUB cover & chapter extraction
β”‚   β”‚   └── text_search/# Tantivy search engine, mtime change tracking, HTML parser
β”‚   β”œβ”€β”€ server/         # REST API routes, auth extractor, static file serving
β”‚   └── pdfium/         # Native PDFium bindings for PDF rendering
β”œβ”€β”€ frontend/           # Svelte 4 SPA
β”‚   β”œβ”€β”€ src/ui/         # NativePdf (PDF.js) & EpubReader (epub.js) components
β”‚   └── src/stores/     # LocalStorage reading progress, themes, collections, pins
└── docker/             # Multi-stage multi-arch Dockerfile (cargo-chef + node + distroless)

πŸ“Έ Screenshots

Folders Files Reader

Reader spread OpenGraph link preview


πŸ“„ License & credits


Built with πŸ¦€ Rust, ⚑ Svelte, and πŸ“š far too many unread books

About

πŸ“š A lightweight, self-hosted PDF and EPUB indexing library and reader. Built with Rust and Svelte, it turns your server's local directory into an accessible, filesystem-driven digital archive.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages