Open Form

open-form start

Serve the production build — forms, API and SQLite in one process.

pnpm start
# or
pnpm exec open-form start

Serves the output of open-form build: the form pages, Studio, the submission and admin API, and responses in SQLite. Run build first; start exits with an error when there's no build.

At startup it renders every form once, so a broken form fails the deploy instead of a respondent. It shuts down cleanly on SIGINT and SIGTERM.

Flags

FlagDefaultDescription
-p, --port <port>$PORT, else port in config, else 3000Port to listen on.
--host <host>$HOST, else 0.0.0.0Host to bind.
--out-dir <dir>distBuild directory to serve.

Environment variables

VariablePurpose
PORTPort to listen on.
HOSTHost to bind.
OPEN_FORM_ADMIN_PASSWORDEnables Studio and the admin API; you sign in with it. At least 16 characters — a passphrase of a few words works.
OPEN_FORM_DBSQLite file path. Default: storage.path in open-form.config.ts, else .open-form/open-form.db.
OPEN_FORM_SECRETSigning secret. Default: generated once into .open-form/secret.
OPEN_FORM_WEBHOOK_SECRETSigns webhook deliveries. Base64, optionally after a whsec_ prefix; a value that isn't stops start.
OPEN_FORM_TRUST_PROXYNumber of reverse proxies in front of the server (usually 1), or true / false. Reads the client IP from X-Forwarded-For and the protocol and host from X-Forwarded-Proto / X-Forwarded-Host. Any other value is an error. trustProxy in open-form.config.ts takes precedence.
OPEN_FORM_SECURE_COOKIESBehind a trusted proxy cookies are always marked Secure; 0 marks them Secure only for HTTPS requests.

start loads .env from the folder it runs in when there is one. Variables already set in the environment win, so your platform's settings override the file.

Without OPEN_FORM_ADMIN_PASSWORD, forms work but Studio is disabled. Changing it signs everyone out of Studio.

Put the server behind HTTPS. Forms and Studio work behind a proxy that ends TLS without further setup, but set OPEN_FORM_TRUST_PROXY to the exact number of proxies: without it every visitor shares the proxy's address, so one person can use up a form's rate limit or lock everyone out of Studio sign-in. Never set it higher, or clients can pick their own IP.

Persistent disk

.open-form/ holds the database and the generated secret, so start needs a disk that survives restarts and redeploys: a VPS, Docker with a volume, or Railway and Fly.io with a volume. See Production and Storage.

On this page