books

books is a self-hosted companion app for Xteink and CrossPoint e-readers. It turns EPUB files into device-ready XTC packages, stores them in a local library, exposes them over OPDS, and can send them straight to a reader over WiFi.

It is built for people who want a practical replacement for manual USB workflows: drop in a book, tune the rendering for e-ink, save it to your library, then download or transfer it to the device.

https://github.com/user-attachments/assets/4fdc84e8-ef6f-4507-b719-63970012ea24

Why books

  • Built around Xteink/CrossPoint instead of generic EPUB reading
  • Self-hosted, with your library and settings stored on your own server
  • Real conversion controls for e-ink output, not just file sync
  • OPDS support so devices can browse your generated books directly
  • Wireless transfer to the device without leaving the browser

What It Does

EPUB to XTC conversion

  • Render EPUB files for Xteink X4 and X3 screen sizes
  • Tune font family, size, weight, margins, line height, alignment, and hyphenation
  • Upload custom TTF/OTF fonts
  • Preview the result in a device-style frame before exporting
  • Generate standard XTC output or high-quality XTCH output
  • Apply 1-bit / 2-bit e-ink quantization and Floyd-Steinberg dithering
  • Add a configurable reading progress bar with chapter markers and page info

Library and catalog

  • Save source EPUB files and generated XTC files in private Vercel Blob storage
  • Edit title and author metadata after import
  • Re-open saved EPUBs for reconversion
  • Publish generated books through an authenticated OPDS feed at /opds
  • Browse and import books from Calibre-Web or any OPDS-compatible source

Device workflow

  • Discover compatible devices on the local network
  • Test connectivity before sending books
  • Transfer books wirelessly in direct or relay mode
  • Browse files on the device from the web UI
  • View device status such as firmware, WiFi mode, signal, memory, and uptime

Supported Devices

DeviceResolution
Xteink X4480 x 800
Xteink X3528 x 792

Typical Flow

  1. Open books in the browser and log in.
  2. Drop in an EPUB or import one from your OPDS / Calibre catalog.
  3. Tune typography and e-ink rendering while previewing pages live.
  4. Generate an XTC or XTCH file and store it in the library.
  5. Download it, browse it through OPDS, or send it directly to the device.

Quick Start

books is designed for a plain Node.js/Vercel runtime with PostgreSQL for metadata and Vercel Blob for private file storage. The project targets Node.js 24.x.

Local Development

pnpm install
pnpm db:dev
AUTH_USERNAME=admin AUTH_PASSWORD=secret pnpm dev

Open http://localhost:3000.

For local development, provide a PostgreSQL URL and Blob credentials in .env.local. The Prisma setup accepts Vercel-style names such as PRISMA_DATABASE_URL or POSTGRES_URL; DATABASE_URL is also supported. When the project is connected to Vercel storage, vercel env pull can populate the local values.

pnpm db:dev / prisma migrate dev does not start PostgreSQL for you. The configured PostgreSQL URL must point to a running local or remote database before running migrations.

Vercel Deployment

  1. Create a PostgreSQL database and set PRISMA_DATABASE_URL, POSTGRES_URL, or DATABASE_URL.
  2. Create a private Vercel Blob store and connect it to the project.
  3. Set the auth and public URL environment variables listed below.
  4. Deploy with Vercel. The install step runs prisma generate; run pnpm db:migrate during deployment or from CI before serving traffic.

Configuration

books requires authentication. These environment variables matter in practice:

VariableRequiredDescription
AUTH_USERNAMEYesLogin username for the web UI and OPDS basic auth
AUTH_PASSWORDYesLogin password and signing secret for sessions / download tokens
PUBLIC_URLRecommendedPublic base URL used when building OPDS links
PRISMA_DATABASE_URL / POSTGRES_URL / DATABASE_URLYesPostgreSQL connection string used by Prisma
BLOB_STORE_ID + VERCEL_OIDC_TOKENVercel recommendedOIDC credentials for a connected Vercel Blob store
BLOB_READ_WRITE_TOKENLocal/CI fallbackStatic Blob token used outside Vercel or when OIDC is unavailable

Using OPDS and Calibre-Web

books exposes an authenticated OPDS catalog at /opds. Add that URL to your e-reader to browse and download generated books from your books library.

The app can also connect to Calibre-Web, Calibre-Web-Automated, or another OPDS-compatible source. Configure the server from the Calibre tab, browse the catalog in the UI, and import EPUBs directly into books.

Sending Books to the Device

Open the Device tab, put the reader into File Transfer, and connect it over WiFi.

books supports two transfer modes:

  • Direct: the browser connects to the device directly
  • Relay: the books server connects to the device and streams the file

Use Relay when books is running on the same LAN as the e-reader. Use Direct when the browser can reach the device directly.

Network note

Direct mode is currently intended for HTTP/local-network usage. If you access books over HTTPS, use relay mode instead.

Building From Source

pnpm install
pnpm db:migrate
pnpm build
pnpm start

Tech Stack

  • Next.js 16 with React 19 and TypeScript
  • Node.js 24.x on Vercel
  • Tailwind CSS 4
  • Prisma ORM with PostgreSQL
  • Private Vercel Blob storage for EPUB, XTC/XTCH, cover, and font files
  • CREngine WASM for EPUB layout and rendering
  • Web Workers for image processing and dithering
  • WebSocket and HTTP APIs for device communication

License

MIT