Space Works Bookings · Install and run
Configuration reference
Every environment variable the app, its images and the deployment scripts read. Templates:
.env.example (development) and .env.production.example
(the bundled install's .env and the cloud cloud.env). The installer generates every secret for you.
In production the app validates its settings at start (lib/env.ts) and refuses to run with a missing secret,
a plain-text database or Redis connection, or mismatched public origins.
Local development stack
docker compose up -d --wait starts PostgreSQL 16, durable Redis 7, Silo and its private bucket initializer,
and Mailpit. Every published service binds to 127.0.0.1. The development template configures Silo at
http://127.0.0.1:9000 and unauthenticated capture-only SMTP at 127.0.0.1:1025; read messages at
http://localhost:8025. These fixtures must never be used in production.
Run npm run dev:stack to build and supervise the web app, worker and beat together. Local startup rejects
remote database/direct, Redis, storage and email targets before migrations or workers can run. The supervisor
uses SWB_DEV_WORKER_PORT (3460) and SWB_DEV_BEAT_PORT (3461), stops siblings on failure and drains workers on
shutdown. The different health ports let both processes coexist on the host; production containers each have their own
port 3460. Email and chat notifications are committed to the SQL outbox and delivered by the worker; beat
schedules relaying, booking reminders and reconciliation. JOBS_INPROCESS is an optional development fallback,
not the production job architecture. Stop with docker compose stop; volumes preserve database, queue and files.
Application
| Variable | Required | Description |
|---|---|---|
NODE_ENV |
production | production turns on the start-up validation, secure cookies and HSTS. |
DATABASE_URL |
yes | Runtime PostgreSQL URL. Production needs sslmode=require, verify-ca or verify-full; a transaction pooler on :6543 needs pgbouncer=true. The bundled stack uses the least-privilege role swbook_app. |
DIRECT_URL |
no | Direct or session connection for prisma migrate (a role that owns the schema). Defaults to DATABASE_URL. Same TLS rule. |
DATABASE_URL_SSLMODE |
no | require, verify-ca or verify-full: the image's entrypoint adds sslmode=<value> to DATABASE_URL and DIRECT_URL when they name none, for every role. For platforms that hand out a URL without TLS parameters (Render's managed PostgreSQL in render.yaml). Empty in the bundled stack, whose URLs already require TLS. |
REDIS_URL |
production | Rate limits, address blocks and the BullMQ job queues. Production requires rediss://; the server needs appendonly yes and maxmemory-policy noeviction. Unset in development to keep everything in memory. |
AUTH_SECRET |
yes | Auth.js secret, 32+ characters. |
AUTH_URL |
production | The public origin. Must equal NEXT_PUBLIC_BASE_URL. |
NEXT_PUBLIC_BASE_URL |
production | The canonical origin for links in receipts, sign-in links and email. Release images get it at start (placeholder replacement); your own builds compile it in. |
ALLOW_PLAIN_HTTP |
no | 1 allows an http:// origin, for a LAN or trial install on plain HTTP. Never on the internet. |
NEXT_PUBLIC_HOSTED_BY |
no | Footer credit "Hosted by …". |
ALLOWED_ACTION_ORIGINS |
no | Extra hostnames allowed to call Server Actions (a CDN in front). Build time only; release images refuse it. |
TRUSTED_PROXY_IP_HEADER |
production | The client-IP header your edge overwrites: x-real-ip (bundled Caddy), cf-connecting-ip (Cloudflare) or x-forwarded-for. |
TRUSTED_PROXY_HOPS |
no | With x-forwarded-for, how many trusted proxies append to it (default 1). |
CRON_SECRET |
production | Bearer secret for POST /api/internal/outbox and POST /api/internal/jobs, the external triggers for hosts without a worker. They only enqueue work; they answer 404 without the secret. |
JOBS_QUEUE_PREFIX |
no | Redis key prefix of the job queues (swb:jobs). Keeps several installs or test runs apart in one Redis. |
JOBS_HEALTH_PORT |
no | Port of the worker's and beat's own GET /health (3460). |
QUEUE_OUTBOX_CONCURRENCY |
no | Outbox jobs the worker runs at once, 1 to 64 (5). |
QUEUE_SCHEDULED_CONCURRENCY |
no | Scheduled jobs the worker runs at once, 1 to 64 (2). |
JOBS_INPROCESS |
no | Development only, with REDIS_URL unset: true runs every job inside npm run dev once a minute. Ignored in production. |
OUTBOX_RETENTION_DAYS |
no | Days to keep delivered outbox rows (30). |
HEALTHCHECK_SECRET |
production | Bearer secret for GET /api/health/db. /api/health is open liveness. |
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY |
production | Base64 of a 16, 24 or 32-byte key, stable across every container. Release images refuse to start without it. |
MFA_ENCRYPTION_KEY |
production | Base64 of 32 bytes; encrypts authenticator seeds. Never change it once in use. |
PAYMENT_SECRETS_KEY |
production | Base64 of 32 bytes; AES-GCM key for Razorpay and Stripe secrets at rest. Generated by the installer; back it up. |
SUPER_ADMIN_EMAIL |
yes | The first super admin. The installer creates it with the password you give; super admins are created, revoked and given passwords only on the server with bash scripts/admin.sh. Every migrate run keeps an existing account with this address as super admin. |
PWNED_PASSWORDS_CHECK |
no | 1 (default) refuses new passwords found in known data breaches, using Have I Been Pwned with k-anonymity (only a 5-character SHA-1 prefix leaves the server). 0 turns it off, for installs without internet access. |
EMAIL_FROM |
yes | Sender, Name <address@verified-domain>. Super admin → Settings overrides the email settings. |
SMTP_HOST, SMTP_PORT, SMTP_SECURE |
yes | Relay host, port (587, or 465 with SMTP_SECURE=true). |
SMTP_USER, SMTP_PASSWORD |
yes | Relay login. |
SMTP_SERVICE |
no | A Nodemailer well-known service instead of a host. |
SMTP_ALLOW_UNAUTHENTICATED |
no | 1 only for a private relay without authentication. |
S3_BUCKET, S3_REGION |
production | The private bucket. |
S3_ENDPOINT |
no | S3-compatible endpoint; HTTPS in production. |
S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY |
no | Both or neither (an IAM role). |
S3_FORCE_PATH_STYLE |
no | 1 for Silo, MinIO and R2. |
BACKUP_PROVIDER, BACKUP_LAST_SUCCESS_AT, BACKUP_RETENTION_DAYS |
no | Backup posture shown in Super admin → Operations. BACKUP_RETENTION_DAYS also sets how long scheduled dumps stay (14 in the bundled stack). |
MIGRATE_ON_START |
no | 1 makes the backend role apply migrations before starting. |
PORT, HOSTNAME |
no | Listening port and address inside the container (3000, 0.0.0.0). |
NODE_EXTRA_CA_CERTS |
no | Extra CA for Node; the bundled stack points it at its private CA. |
NEXT_DEV_ALLOWED_ORIGINS |
no | Development only: extra hosts allowed to load dev assets. |
Split hosting (website on Netlify)
| Variable | Where | Description |
|---|---|---|
DEPLOYMENT_MODE |
backend | backend serves only the API and Server Actions; monolith (default) serves everything. |
FRONTEND_GATEWAY_SECRET |
both | 64 hex characters shared by the website and the backend. |
BACKEND_ORIGIN, NEXT_PUBLIC_BACKEND_ORIGIN |
website | The backend's HTTPS origin. The frontend image gets it at start. |
FRONTEND_TRUSTED_IP_HEADER |
website | x-nf-client-connection-ip on Netlify, x-real-ip behind your own proxy. |
Tests and demo data
CI with ALLOW_INSECURE_PRODUCTION_TESTS=1 relaxes the TLS checks in CI only. TEST_DATABASE_URL points the
integration tests at a disposable, migrated database; TEST_QUEUE_REDIS_URL (default redis://127.0.0.1:6379/0)
is the Redis the queue tests use, each run under its own key prefix. DEMO_PASSWORD and DEMO_MFA_SECRET feed
npm run db:seed-demo. PLAYWRIGHT_PORT, PLAYWRIGHT_PRODUCTION_SERVER, PLAYWRIGHT_SERVER_COMMAND and
PLAYWRIGHT_CHANNEL tune the end-to-end runs.
Deployment (bundled .env and cloud.env)
| Variable | Default | Description |
|---|---|---|
SWB_REPOSITORY |
SpaceWorks-Labs/SpaceWorks-Bookings |
Repository the installer, updater and runner follow (a fork works). |
SWB_BACKEND_IMAGE, SWB_FRONTEND_IMAGE |
ghcr.io/<owner>/spaceworks-bookings-backend / -frontend |
Image names, derived from the repository owner. |
SWB_IMAGE_TAG |
.spaceworks-version, else latest |
The release the stack runs. |
SWB_LAYER |
none |
none plain HTTP through Caddy, tls automatic HTTPS, proxy your own proxy on 127.0.0.1:8080. |
SWB_STORAGE |
bundled |
external drops Silo for the S3_* bucket. |
PUBLIC_APP_BASE_URL |
The public origin; becomes AUTH_URL and NEXT_PUBLIC_BASE_URL. |
|
SITE_ADDRESS |
Caddy's site: <domain> for automatic HTTPS, http://<host> for plain HTTP. |
|
TLS_EMAIL |
Let's Encrypt account email (SWB_LAYER=tls). |
|
CADDY_GLOBAL_OPTIONS |
Caddy global options; docker/compose.tls.yml sets it to email <TLS_EMAIL>. |
|
HTTP_PORT, HTTP_PORT_BIND, TLS_HTTPS_PORT |
80, 0.0.0.0, 443 |
Caddy's published ports. |
API_BIND, API_PORT |
127.0.0.1, 8080 |
Where the app listens for your proxy (SWB_LAYER=proxy). |
APP_BIND, APP_PORT |
127.0.0.1, 8080 |
Where the cloud stack's app listens. |
POSTGRES_PASSWORD |
generated | Owner role swbook (migrations, backups). |
POSTGRES_APP_PASSWORD |
generated | Runtime role swbook_app (data only). |
REDIS_PASSWORD |
generated | Redis requirepass. |
MINIO_ROOT_USER, MINIO_ROOT_PASSWORD |
generated | Silo administrator. |
S3_APP_PASSWORD |
generated | Secret of the swbook-app storage identity, limited to the bucket. |
BACKUP_INTERVAL_HOURS |
24 |
Scheduled database dump and bucket mirror interval. |
SILO_IMAGE_TAG |
October 26, 2026 release and multiarch digest | Bundled Silo server release; accepts tag@sha256:digest to retain an immutable operator override. |
MC_IMAGE_TAG |
October 26, 2026 release and multiarch digest | Matching standalone pgsty/mc for bucket initialization and object backup/restore. |
Scripts and images
| Variable | Used by | Description |
|---|---|---|
SWB_DIR |
install.sh, deploy job |
Install directory (/opt/spaceworks-bookings). |
SWB_INSTALL_REPOSITORY_PINNED |
installer | Set when the repository was chosen before download. |
SWB_STATIC_ENV_FILE |
wrapper | Settings file (<install>/.env bundled, /etc/spaceworks-bookings/cloud.env cloud). |
SWB_UPDATE_INSTALL_DIR |
wrapper, updater | The install a staged updater works on. |
SWB_COMPOSE_BUILD_LAYER |
wrapper, setup.sh --build |
1 builds the backend image from the checkout. |
SWB_BUILD_KEY |
wrapper | Throwaway Server Actions key for local builds (generated per run). |
SWB_COMPOSE_PROJECT |
wrapper | Compose project (swbook, swbook-cloud, swbook-smoke). |
SWB_TLS_DIR, SWB_BACKUP_DIR |
compose | Certificate and backup directories (./tls, ./backups). |
SWB_RUNNER_DIR |
install-runner.sh |
Runner directory (/opt/spaceworks-bookings-runner). |
SWB_DEPLOY |
GitHub repository variable | true enables the release workflow's deploy job. |
SWB_TOPOLOGY |
ops role | bundled or cloud; the runtime-role check runs only for bundled. |
SWB_NEXT_DIR |
entrypoint | Where the web build is (/app/.next, frontend /app/frontend/.next). |
SWB_DISABLE_BUILD_CACHE, SWB_FRONTEND_STANDALONE |
Dockerfile | Image build switches. |
SWB_SMOKE_PORT |
compose-smoke.sh |
The smoke test's edge port (18080). |
SWB_ADMIN_TOPOLOGY |
admin.sh |
bundled (default) or cloud: which stack's ops container runs docker/ops/admin.mjs. |
SWB_UPDATE_STAGE_DIR, SWB_UPDATE_STAGED, SWB_ROLLBACK |
updater | Internal hand-over from the running updater to the downloaded release's own updater. Never set them yourself. |
Installer (install.sh)
Each option of install.sh --help has an environment equivalent, for unattended runs.
| Variable | Option | Description |
|---|---|---|
SWB_REPOSITORY |
--repo |
Repository to install from (a fork works). |
SWB_DIR |
--dir |
Install directory (/opt/spaceworks-bookings). |
SWB_RELEASE |
--release |
A published release (0.5.0-main.<run>.<sha12>) instead of the latest. |
SWB_REF |
--ref |
A branch, tag or commit to build from source on the server; updates rebuild it. Recorded in .spaceworks-source-ref. |
SWB_ACTION |
--action |
On an existing install, one menu entry: update, status, backup, backup-settings, restore, rollback, reconfigure, harden, recover-admin, support, runner, runner-remove, uninstall, cancel. |
SWB_NONINTERACTIVE |
--non-interactive, --yes |
1 never asks: questions take SWB_ANSWER_<KEY>, else their default, and the run stops on a missing or invalid answer. |
SWB_DRY_RUN |
--dry-run |
1 runs the checks (and, from a checkout, the questions), prints the plan and changes nothing. |
SWB_GITHUB_TOKEN, GITHUB_TOKEN, GH_TOKEN |
A token (repo and read:packages) for a private repository: the release download, the updater and the GHCR login. Without one, gh auth token is tried. Never written to disk; Docker keeps its own ghcr.io login. |
|
SWB_GITHUB_USER |
The GHCR user name for that token (default: the token's own login). |
SWB_ANSWER_<KEY> answers a deployment question in a non-interactive install (the keys of
scripts/setup-questions.sh):
| Key | Default | Answer |
|---|---|---|
SWB_ANSWER_RUN_FRONTEND |
1 |
1 website on this server, 2 backend only (website on Netlify). |
SWB_ANSWER_SITE_ORIGIN |
The Netlify website's HTTPS origin (with RUN_FRONTEND=2). |
|
SWB_ANSWER_HTTPS_MODE |
1 (2 for a backend) |
1 plain HTTP, 2 automatic HTTPS with Caddy, 3 your own reverse proxy. |
SWB_ANSWER_PUBLIC_DOMAIN |
The domain, for HTTPS modes 2 and 3. | |
SWB_ANSWER_TLS_EMAIL |
Let's Encrypt email, for HTTPS mode 2. | |
SWB_ANSWER_WEBHOST |
localhost |
Host name or IP, for plain HTTP. |
SWB_ANSWER_STORAGE |
1 |
1 bundled Silo, 2 your own S3-compatible bucket. |
SWB_ANSWER_S3_ENDPOINT, SWB_ANSWER_S3_REGION, SWB_ANSWER_S3_BUCKET, SWB_ANSWER_S3_ACCESS_KEY, SWB_ANSWER_S3_SECRET_KEY |
region auto |
The external bucket, for storage 2. |
SWB_ANSWER_SUPER_ADMIN_EMAIL, SWB_ANSWER_SUPER_ADMIN_PASSWORD |
The first super admin (password 12 to 72 characters). | |
SWB_ANSWER_EMAIL_FROM |
Space Works Bookings <noreply@<domain>> |
Sender. |
SWB_ANSWER_SMTP_HOST, SWB_ANSWER_SMTP_PORT |
smtp-relay.brevo.com, 587 |
SMTP relay. |
SWB_ANSWER_SMTP_USER, SWB_ANSWER_SMTP_PASSWORD |
SMTP login. | |
SWB_ANSWER_INSTALL_RUNNER |
N |
Y installs the GitHub Actions runner (Linux with systemd). |
Hosting platforms
render.yaml (Render Blueprint) and .do/app.yaml (DigitalOcean App Platform) set the same application
variables as cloud.env. Render generates AUTH_SECRET, CRON_SECRET, HEALTHCHECK_SECRET and the three keys
(generateValue), creates the database and passes its URL with DATABASE_URL_SSLMODE=require, and defaults
NEXT_PUBLIC_BASE_URL and AUTH_URL to the service's own RENDER_EXTERNAL_URL. See
DEPLOYMENT_CLOUD.md.
From SpaceWorks-Bookings/docs/CONFIGURATION.md at 37a2113, updated 2026-10-29. Suggest a change