Skip to content

Deployment

Hotaru runs as one Docker container built from the Dockerfile. Its data lives in SQLite on a persistent volume at /data, and migrations run when the app starts. There is exactly one container, never more: see ADR-0001.

How to set it up step by step, with Docker Compose and Caddy, on Coolify, or behind another proxy: self-hosting.md. This page is the reference: the settings, the optional browser container, and what happens on a redeploy.

Every page and API endpoint except /health needs a login (auth.md).

The container

Image node:26-bookworm-slim, runs as the non-root user node
Port 3000 (PORT)
Volume /data: hotaru.db, durable.db and the image cache
Health GET /health, and a Docker HEALTHCHECK
Start docker-entrypoint.sh: with LITESTREAM_REPLICA_URL, Litestream restores a missing database, then runs the app and streams every change; without it, the app runs alone and logs a warning
Admin CLI node /app/packages/core/scripts/user.ts inside the container (auth.md)

Environment variables

Set them in your platform’s environment, or in .env with Docker Compose (.env.example). Never commit them.

Required:

Variable Value Why
ORIGIN the public URL, such as https://hotaru.example.com SvelteKit behind a proxy needs it to accept form submissions (CSRF check). Better Auth uses it as its base URL too. Without it, the app doesn’t start
BETTER_AUTH_SECRET 32+ random characters, e.g. from openssl rand -base64 32 Signs sessions and encrypts stored tokens, such as Raindrop’s, Readwise’s and MyMind’s, and users’ own OpenRouter keys. Without it, the app doesn’t start. Changing it logs everyone out, and everyone has to connect Raindrop, Readwise Reader and MyMind again and set their own OpenRouter key again (raindrop.md, forwarding.md)

Optional:

Variable Default What it does
ADDRESS_HEADER x-real-ip (set in the image) The header in which the reverse proxy passes the client address, for rate limits (auth.md). XFF_DEPTH, PROTOCOL_HEADER and HOST_HEADER work as in adapter-node
REGISTRATION_MODE unset (off) Who may register until an admin chooses on Settings → Accounts: off, invite or open. The older REGISTRATION_ENABLED=true means open (accounts.md)
RESEND_API_KEY unset A Resend key with sending access, re_…. Sends email confirmation, password reset and invite links. Without it (and EMAIL_FROM), the links are written to the server log (email.md)
EMAIL_FROM unset The sender of those emails, such as Hotaru <[email protected]>, on the domain Resend verified (email.md)
OPENROUTER_API_KEY unset Model and jev calls of the AI pipeline, starting with the gate (gate.md). Only admins use it; everyone else needs a key of their own for AI (costs.md). Without it, AI is off for admins too, and items are still fetched and shown. Give it a monthly limit at OpenRouter as a backstop behind the per-user budgets (costs.md)
CHAT_MODEL anthropic/claude-haiku-5.5 The OpenRouter model of the chat agent (chat.md)
SCHEDULER_ENABLED on false stops the server from fetching sources by itself (scheduler.md)
SCHEDULER_MIN_INTERVAL_MINUTES 15 Most often a source is fetched, 5–60 minutes
PIPELINE_ENABLED on false keeps the server from opening durable.db and running the AI item pipeline (pipeline.md)
YOUTUBE_API_KEY unset YouTube Data API key for video durations, live streams and large thumbnails. Without it, Hotaru reads the watch pages of recent videos, which YouTube may block for servers (youtube.md)
YOUTUBE_PROXY_URL unset A proxy for requests to YouTube only (http://, https://, or experimental socks5://), for servers that YouTube asks to sign in (youtube.md)
GITHUB_TOKEN unset A GitHub token for following releases: 5,000 API requests an hour instead of 60 per IP address. Any token works; it needs no permissions (source-types.md)
IMAGE_CACHE_MAX_MB 2048 Largest size of the image cache. Cleanup deletes the least recently used images beyond it (images.md)
IMAGE_CACHE_DIR /data/images (next to the database) Where the image cache lives
SCREENSHOTS off on once the browser container runs: screenshots of pages for items without an image (images.md)
SCREENSHOT_BROWSER_URL unset The browser container below, such as ws://browser:3001/<secret path>
SCREENSHOT_CPU_PERCENT, SCREENSHOT_TIMEOUT_MS, SCREENSHOT_MIN_FREE_MB, SCREENSHOT_MAX_LOAD 25, 20000, 512, 0.8 How much the screenshot queue may take: the share of one core on average, the most time per page, and no screenshots while free memory or load per core cross these lines (images.md)
SCREENSHOT_BROWSER, SCREENSHOT_SANDBOX, SCREENSHOT_MAX_MEMORY_MB unset, on, 768 For a local Chromium that Hotaru starts itself when there is no SCREENSHOT_BROWSER_URL (development): its path, its sandbox (off turns it off), its memory
LITESTREAM_REPLICA_URL unset Continuous backup of both databases; an empty volume restores from it (backups.md)
LITESTREAM_SFTP_HOST_KEY unset For an SFTP replica: refuses any other server (backups.md)
DATABASE_PATH /data/hotaru.db (set in the image) Database file on the volume
DURABLE_DATABASE_PATH /data/durable.db (set in the image) pi-durable’s file for the item pipeline, next to the database (pipeline.md)
VAPID_PUBLIC_KEY, VAPID_PRIVATE_KEY unset Your own VAPID key pair for push notifications. Without them, the server makes one on first use and keeps it in the database, so nothing needs setting. Changing the key makes every device subscribe again (notifications.md)
VAPID_SUBJECT unset (the ORIGIN when it’s https) Who runs the server, for the push services: mailto:you@your-domain or the instance’s https address. Apple refuses anything else, so an invalid value is ignored with a warning (notifications.md)
PUSH_BATCH_WINDOW_SECONDS unset (90) How long new items are collected into one push notification, 1–3600
BODY_SIZE_LIMIT 5M (set in the image) Largest request body. OPML uploads need more than adapter-node’s default 512 KB (import-export.md)

BETTER_AUTH_URL overrides ORIGIN for Better Auth, if they ever differ. OPENROUTER_BASE_URL points the OpenRouter client elsewhere; only the e2e tests and pnpm dev:faux set it, at a fake (agents.md). PUSH_TEST_ENDPOINT_ORIGIN lets push notifications go to one local http address, the e2e tests’ fake push service. Never in production, either of them. RAINDROP_API_URL, READWISE_API_URL, MYMIND_API_URL, YOUTUBE_PLAYER_URL and EMAIL_OUTBOX exist for tests only.

Screenshots: a browser in its own container

Items without an image get a screenshot of their page (SI-543, images.md). The browser runs in a second container from the official Playwright image, never in the app container: pages run JavaScript, and that container has no access to /data. Hotaru connects to it, and the browser fetches nothing itself. Every request goes back through the app, which refuses private addresses.

With Docker Compose, compose.screenshots.yaml adds it:

  1. In .env, set SCREENSHOT_BROWSER_PATH to a long random path, from openssl rand -hex 16. It works as a password, because anyone who can reach the port and knows the path can use the browser.
  2. Also set SCREENSHOTS=on and SCREENSHOT_BROWSER_URL=ws://browser:3001/<the same path>.
  3. Start it: docker compose -f compose.yaml -f compose.screenshots.yaml up -d (plus -f compose.caddy.yaml if you use Caddy).

On Coolify: New resource → Docker Compose, on the same server, with the browser service from that file and the path written into it. Then:

  • Turn on Connect to Predefined Network in the resource’s settings, then Redeploy it (a restart doesn’t apply it), so the browser joins the coolify network.
  • There it is reached by its full container name, browser-<resource id> (docker ps shows it), not the short service name.
  • Other containers on coolify can reach the port as well, so the secret path is what keeps them out.

For either setup:

  • No port to the outside. Don’t add a domain or publish the port.

  • Limits: mem_limit and cpus are what the browser may use. Docker enforces them, also when a page misbehaves.

  • Check it. In the app container (it starts in /app/apps/web):

    Terminal window
    node -e "require('playwright-core').chromium.connect(process.env.SCREENSHOT_BROWSER_URL).then(async b => { console.log('connected, Chromium', b.version()); await b.close() }).catch(e => { console.error('failed:', e.message); process.exit(1) })"

    It prints connected, Chromium …. getaddrinfo EAI_AGAIN means the two aren’t on one network. While screenshots work, the app’s log stays quiet: it logs only failures ([screenshots] …), and “Trying again in 10 minutes” when it can’t reach the browser.

  • Upgrades: when playwright-core changes version, change both version numbers in the compose file too. Client and server must match.

  • The proxy and the switches in the compose file also keep the browser off the network. Every request goes through the app, so these are a second line of defence.

The first user

After the first deploy, create the admin account inside the container (Coolify: the app → Terminal; Docker Compose: docker compose exec hotaru …):

Terminal window
node /app/packages/core/scripts/user.ts create --email [email protected] --name "Your Name" --username you --admin

More in auth.md.

Redeploys keep the data

The database is on the /data volume, outside the image. A redeploy builds a new image, starts a new container with the same volume, and applies new migrations on start. CI checks this: it builds the image, writes a row, replaces the container and checks that the row is still there.

Open pages notice a redeploy within 3 minutes, or as soon as the tab comes back into view, and offer Reload: it loads the new version and its service worker, and keeps a half-written agent chat message. Nothing to configure: the version is the build’s time.

Behind Cloudflare or another CDN

The server sends Cache-Control: no-cache, no-store, must-revalidate (and CDN-Cache-Control: no-store) for /service-worker.js and /_app/version.json (apps/web/server/fresh.ts), so browsers always check for a new service worker and version. A CDN in front of the server can still keep its own copy: Cloudflare, for example, caches .js files for hours by default. Then browsers keep the old service worker after a deploy, the Reload offer doesn’t appear, and new features of the worker, such as push notifications, silently don’t work: the push service accepts each push, and the old worker drops it.

With Cloudflare:

  • Caching → Cache Rules: a rule for the two paths (URI path equals /service-worker.js or /_app/version.json) with Bypass cache.
  • Caching → Configuration → Browser Cache TTL: Respect existing headers.
  • After setting this up, purge both paths once (Caching → Configuration → Custom Purge), or everything. Browsers then fetch the new worker the next time the app opens or comes back into view, and existing push subscriptions start working without subscribing again.

Other CDNs: bypass or don’t cache those two paths, and purge them after each deploy if they were cached. Files under /_app/immutable/ change name with every build and may be cached forever.

Uptime alert

The /health endpoint answers 200 with {"status":"ok"} while the server runs and the database answers, and 503 otherwise. Docker and Coolify restart the container when its health check fails. For an alert, add https://hotaru.example.com/health to an uptime monitor, or set up a notification in Coolify.

Search engines

robots.txt disallows everything, and every response carries X-Robots-Tag: noindex, nofollow. Hotaru is a personal reader, not a public site.