Self-hosting
Configuration
Every environment variable the API reads, and the binary's three modes.
The API is one binary with three modes:
openhunt-api serve # the HTTP server
openhunt-api worker # background jobs (GC loops, email)
openhunt-api migrate # apply migrations and exitThe compose stacks run serve and worker from the same image.
Environment variables
| Variable | Default | What it does |
|---|---|---|
DATABASE_URL | — (required) | Postgres connection string. |
BIND_ADDR | 127.0.0.1:8080 | Address the server listens on. 0.0.0.0:8080 inside containers. |
AUTO_MIGRATE | false | Apply pending migrations on startup. The compose stacks set 1; flip off if you prefer explicit migrate runs. |
ALLOWED_ORIGINS | http://localhost:3000,http://localhost:5173 | Comma-separated origins allowed for CORS — and required for cookie-authenticated writes, so it doubles as CSRF protection. Set to your web app's origin. |
COOKIE_SECURE | true | Mark session cookies Secure. Set false only for plain-HTTP localhost setups. |
COOKIE_DOMAIN | unset | Cookie Domain attribute — set to .your-domain.com when web and API live on sibling subdomains. |
PUBLIC_WEB_URL | unset | Absolute web-app base used for links placed in email (verification, password reset). |
RUST_LOG | — | Log filter; the stacks use info,sqlx=warn. |
The web tier
The web app needs NEXT_PUBLIC_API_URL at build time (it's baked into
the client bundle) pointing at the API's public URL, and serves tiles from
its public directory. When the web server resolves share links
server-side it uses API_INTERNAL_URL to reach the API over the private
network instead.
Postgres
The stack defaults to the postgis/postgis:17-3.5 image with a named
volume, but the API only needs plain Postgres — any 17.x works. The
pipeline doesn't touch Postgres at all; it works on files and produces
files.