Open Form

open-form start

Serve the production build from one Node process: form pages, Studio, the submission and admin API, and responses in SQLite on a persistent disk or in Postgres.

npm start
# or
npx open-form start

Serves the output of open-form build: the form pages, Studio, the submission and admin API, and responses in SQLite (or Postgres). Run build first; start exits with an error when there's no build. Its startup lines include where responses go, with any password hidden.

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 with at least 8 different ones, not one word or pattern repeated — a passphrase of a few words works.
OPEN_FORM_DATABASE_URLPostgres connection string; responses go there instead of SQLite. Default: storage.url in open-form.config.ts. See Postgres.
OPEN_FORM_DBSQLite file path. Default: storage.path in open-form.config.ts, else .open-form/open-form.db.
OPEN_FORM_SECRETSigning secret, at least 16 characters; a shorter one stops start. Default: generated once into a secret file next to the database.
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, unless studio.public is 'read-only': then anyone can read Studio and nobody can change anything. Changing the password 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