openreader/docs-site/docs/start-here/vercel-deployment.md
Richard R 63483e055e refactor(docs): reorganize and enhance documentation structure
- Rename configuration.md to auth.md for clarity
- Rename storage-and-blob-behavior.md to object-blob-storage.md
- Split server library import into dedicated documentation page
- Rename intro.md to introduction.md
- Merge support.md into support-and-contributing.md
- Add interactive tabs to configuration and setup guides
- Improve cross-references and navigation between documentation pages
- Update sidebar structure and Docusaurus config for new file paths
2026-02-11 04:16:02 -07:00

2.9 KiB

title
Vercel Deployment

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

This guide covers deploying OpenReader WebUI to Vercel with external Postgres and S3-compatible object storage.

What works on Vercel

  • Documents (PDF/EPUB/TXT/MD) work with POSTGRES_URL + external S3 storage.
  • Audiobook routes work on Node.js serverless functions using ffmpeg-static/ffprobe-static.

:::warning DOCX Conversion Limitation docx conversion requires soffice (LibreOffice), which is not available in a standard Vercel runtime. :::

1. Environment Variables

POSTGRES_URL=postgres://...
USE_EMBEDDED_WEED_MINI=false
S3_ACCESS_KEY_ID=...
S3_SECRET_ACCESS_KEY=...
S3_BUCKET=...
S3_REGION=us-east-1
S3_ENDPOINT=https://...
S3_FORCE_PATH_STYLE=true
S3_PREFIX=openreader
BASE_URL=https://your-app.vercel.app
AUTH_SECRET=...
NEXT_PUBLIC_NODE_ENV=production
NEXT_PUBLIC_ENABLE_AUDIOBOOK_EXPORT=true
NEXT_PUBLIC_ENABLE_WORD_HIGHLIGHT=true

:::tip For all variables and defaults, see Environment Variables. :::

2. FFmpeg/ffprobe packaging in Vercel functions

ffmpeg-static and ffprobe-static binaries must be included in function traces. This repo already does that in next.config.ts via outputFileTracingIncludes for:

  • /api/audiobook
  • /api/audiobook/chapter
  • /api/audiobook/status
  • /api/whisper

:::info serverExternalPackages should include ffmpeg-static and ffprobe-static so package paths resolve at runtime instead of being bundled into route output. :::

If you change route paths or split handlers, update outputFileTracingIncludes accordingly.

3. Function memory sizing

FFmpeg workloads benefit from more memory/CPU. This repo includes:

{
  "$schema": "https://openapi.vercel.sh/vercel.json",
  "functions": {
    "app/api/audiobook/route.ts": { "memory": 3009 },
    "app/api/whisper/route.ts": { "memory": 3009 }
  }
}

Adjust memory per route if your files are larger or your plan differs.

4. Runtime expectations and caveats

  • Audiobook APIs require S3 configuration; otherwise they return 503.
  • For production Vercel deploys, use POSTGRES_URL instead of SQLite.
  • Filesystem-to-object-store migrations run via server scripts/entrypoint (scripts/migrate-fs-v2.mjs), not API routes.
  • Vercel deployments do not run scripts/openreader-entrypoint.mjs, so run pnpm migrate-fs in a controlled environment when migrating legacy filesystem data.

5. Smoke test after deploy

  1. Upload and read a PDF/EPUB document.
  2. Confirm sync/blob fetch works across refreshes/devices.
  3. Generate at least one audiobook chapter and play/download it.
  4. If using word highlighting, verify timestamps are produced and rendered.