Space Works Organization · 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, worker and beat validate their settings at start (lib/env.ts) and refuse to run with a missing secret,
a plain-text database or Redis connection, or mismatched public origins.
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. Keep at least 2 connections in the pool (connection_limit ≥ 2): the worker's storage clean-up holds one while it works through another. The bundled stack uses the least-privilege role sworg_app. |
DIRECT_URL |
no | Direct or session connection for prisma migrate (a role that owns the schema). Defaults to DATABASE_URL. Same TLS rule. |
REDIS_URL |
production | Rate limits, the read cache and the BullMQ job queues (docs/ARCHITECTURE.md). Production requires rediss://. |
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, cards 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 …". |
LANDING_ENABLED |
no | true (default) shows the landing page at /. false makes / follow the data (product rules §12.2): the one public organisation, the organisations list when there are several, or sign-in when there are none. Runtime value; set it on the website (and the backend in split hosting). |
WEB_TELEMETRY_ALLOWED_ORIGINS |
no | Comma-separated bare https:// origins the operator approves for optional outside web analytics: collectors you host (Plausible, Umami, PostHog) and each vendor's script and collection hosts (see docs/SECURITY.md). Settings can only point at an origin listed here, and the Content Security Policy widens for these origins on public pages only. Runtime value, never NEXT_PUBLIC_; set it on the backend and the website. Empty keeps the strict default. |
WEB_TELEMETRY_MIXPANEL_TOKEN |
no | Public Mixpanel project token. Off without it. While set, Mixpanel replaces the page-analytics provider (after consent) and its hosts are added to the policy on public pages. Never committed. |
WEB_TELEMETRY_MIXPANEL_API_HOST, WEB_TELEMETRY_MIXPANEL_SDK_HOST |
no | Bare https:// origins; default https://api.mixpanel.com (EU projects: https://api-eu.mixpanel.com) and https://cdn.mxpnl.com. The SDK host must not be this site's own origin. |
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/jobs and POST /api/internal/outbox (hosts without a beat process) and POST /api/internal/run-jobs (hosts with no worker, driven by an online cron). |
INNGEST_SIGNING_KEY |
no | Switches on the fully cloud option for background jobs: Inngest calls /api/inngest on a schedule and the due jobs run there, with no worker or beat. The SDK verifies every call with this key; without it /api/inngest answers 404. Write-only; from the Inngest dashboard. |
INNGEST_JOBS_CRON |
no | How often Inngest runs the jobs, as a five-field cron expression. Default * * * * * (once a minute, about 44,000 runs a month). |
INNGEST_DEV |
no | 1 lets the local Inngest dev server call /api/inngest without a signing key. Development only: production refuses to start with it. |
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. An account with this address from before 0.7 is kept as super admin on upgrade. |
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. |
EMAIL_PROVIDER |
no | smtp (default), ses, resend or postmark. Email stays off until the chosen provider is fully set up. Super admin → Settings overrides it. |
SMTP_HOST, SMTP_PORT, SMTP_SECURE |
with smtp |
Relay host, port (587, or 465 with SMTP_SECURE=true). |
SMTP_USER, SMTP_PASSWORD |
with smtp |
Relay login. |
AWS_SES_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY |
with ses |
Amazon SES v2 region (AWS_REGION is used when empty) and an access key allowed to send. AWS_SESSION_TOKEN is optional for temporary keys; instance-role lookup is not supported. |
SES_TOPIC_ARN |
no | The one SNS topic SES bounce and complaint reports may come from. Without it SES reports are refused. |
RESEND_API_KEY |
with resend |
Resend API key. |
POSTMARK_SERVER_TOKEN, POSTMARK_MESSAGE_STREAM |
with postmark |
Server token and message stream (outbound). |
EMAIL_WEBHOOK_SECRET |
no | Resend's webhook signing secret (whsec_…) or the password Postmark's webhook sends as basic auth. |
SMS_PROVIDER |
no | twilio or msg91: how phone sign-in codes are texted. Off until its fields are set; Super admin → Auth wins over these. |
TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN |
with twilio |
Account SID and auth token. The token also verifies delivery reports. |
TWILIO_API_KEY_SID, TWILIO_API_KEY_SECRET |
no | An API key instead of the auth token for sending (delivery reports then need the auth token too). |
TWILIO_FROM, TWILIO_MESSAGING_SERVICE_SID |
with twilio |
The sending number with its country code, or a messaging service SID (used instead when both are set). |
MSG91_AUTH_KEY, MSG91_TEMPLATE_ID |
with msg91 |
Auth key and the approved (DLT) Flow template, which takes the variables otp and brand. |
MSG91_SENDER_ID |
no | The registered sender id, when the template does not carry it. |
SMS_WEBHOOK_SECRET |
no | The token MSG91's delivery report address carries (?token=). Twilio reports are checked by their signature. |
SMS_DAILY_COUNTRY_CAP |
no | The most phone codes asked for numbers of one country calling code in a day, across the install. Default 500. |
MESSAGING_MATTERMOST_HOSTS |
no | Comma-separated Mattermost host names that are allowed even though they resolve to private addresses (a server on the same network). Any other host an organisation or the platform types in must be public. |
MESSAGE_LOG_RETENTION_DAYS |
no | Days the member message log (channel, kind and delivery state; never the text, a number or an address) is kept. Default 90, between 7 and 730. |
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. |
AUTH_GOOGLE_ID, AUTH_GOOGLE_SECRET |
no | Google sign-in fallback (GOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRET also read). Super admin → Settings overrides. |
AUTH_GITHUB_ID, AUTH_GITHUB_SECRET |
no | GitHub sign-in fallback. Only a verified primary email can sign in. |
LOGIN_METHODS |
no | The deployment's choice of sign-in methods: a comma list of password, google, apple, github, oidc, saml, supabase, firebase and passkey and phone. When set it wins over the Super admin switches (shown there as set by the server, read-only); a method still needs its own configuration (for oidc and saml, at least one enabled provider). Unset leaves the switches to Super admin, where only password is on by default. A provider configured only here (AUTH_GOOGLE_ID and the like) stays off until it is switched on. The installer sets it when you pick extra options. Super admins always sign in with a password. |
AUTH_SUPABASE_URL, AUTH_SUPABASE_ANON_KEY, AUTH_SUPABASE_PROVIDERS |
no | Supabase Auth bridge: project URL, publishable (anon) key (public values) and a comma list of email and the OAuth providers the project enables (default email). The project must use asymmetric JWT signing keys; the legacy shared HS256 secret is refused. |
AUTH_FIREBASE_API_KEY, AUTH_FIREBASE_AUTH_DOMAIN, AUTH_FIREBASE_PROJECT_ID, AUTH_FIREBASE_APP_ID, AUTH_FIREBASE_PROVIDERS |
no | Firebase Auth bridge: public web app values and a comma list from google.com, microsoft.com, apple.com, github.com, facebook.com, twitter.com, yahoo.com, emailLink, password (default google.com). AUTH_FIREBASE_APP_ID is optional. |
AUTH_APPLE_ID, AUTH_APPLE_TEAM_ID, AUTH_APPLE_KEY_ID, AUTH_APPLE_PRIVATE_KEY |
no | Apple sign-in fallback: services ID, team ID, key ID and the .p8 key with newlines as \n. |
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 (Render). |
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. |
Background jobs (worker and beat)
The worker and beat roles (npm run build:jobs, then npm run worker and npm run beat) run every
background job on BullMQ over REDIS_URL (docs/ARCHITECTURE.md).
| Variable | Default | Description |
|---|---|---|
JOBS_QUEUE_PREFIX |
swo:jobs |
Prefix for the BullMQ keys in Redis. Lowercase letters, digits, :, _ and -, up to 40 characters. Give two installations sharing one Redis different prefixes. |
JOBS_HEALTH_PORT |
3460 |
Port of the worker's and beat's GET /health. |
QUEUE_OUTBOX_CONCURRENCY, QUEUE_SCHEDULED_CONCURRENCY |
5, 2 | Jobs one worker runs at once per queue, 1 to 64. |
JOBS_INPROCESS |
false |
Development only, and only without REDIS_URL: true runs every periodic job (outbox delivery, membership sweep, retention…) from a one-minute timer in the web process. Ignored in production. |
Object storage
Every stored file (logos, page images, card artwork, member photos) goes to one private bucket through one
client (lib/storage/client.ts). Member photos sit under organisations/<org>/members/<member>/, so erasing a
member deletes that prefix. Card files are never stored: every card, single or bulk, is drawn when it is asked for.
| Store | S3_ENDPOINT |
S3_REGION |
S3_FORCE_PATH_STYLE |
|---|---|---|---|
| Silo (MinIO) on a VPS | https://minio:9000 (set by the bundled stack) |
any, us-east-1 by default |
1 |
| Cloudflare R2 | https://<account-id>.r2.cloudflarestorage.com |
auto |
1 |
| Amazon S3 | empty | the bucket's region | 0 |
The access key needs to read, write, delete and list objects in the bucket (R2: an API token with Object Read &
Write, limited to the bucket). On a self-managed bucket with versioning (MinIO, S3), also grant
s3:ListBucketVersions on the bucket and s3:DeleteObjectVersion on its objects: erasing a member or a photo
deletes every stored version, not just the current one. The bundled Silo policy (deploy/storage-policy.json)
has both. Without them, only current objects are deleted, the earlier versions stay, and the server logs it.
The application sends checksums only where S3 requires them, which R2 and Silo both accept.
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. |
WEB_TELEMETRY_ALLOWED_ORIGINS, WEB_TELEMETRY_MIXPANEL_TOKEN, WEB_TELEMETRY_MIXPANEL_API_HOST, WEB_TELEMETRY_MIXPANEL_SDK_HOST |
both | Optional outside web analytics. The website's proxy builds the Content Security Policy from them (it never reads the database); the backend validates the saved settings against them. Set the same values on both. |
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 database; TEST_QUEUE_REDIS_URL at a disposable Redis turns on the BullMQ suites. DEMO_PASSWORD and DEMO_MFA_SECRET feed npm run db:seed-demo.
Deployment (bundled .env and cloud.env)
| Variable | Default | Description |
|---|---|---|
SWO_REPOSITORY |
SpaceWorks-Labs/SpaceWorks-Organization |
Repository the installer, updater and runner follow (a fork works). |
SWO_BACKEND_IMAGE, SWO_FRONTEND_IMAGE |
ghcr.io/<owner>/spaceworks-organization-backend / -frontend |
Image names, derived from the repository owner. |
SWO_IMAGE_TAG |
.spaceworks-version, else latest |
The release the stack runs. |
SWO_LAYER |
none |
none plain HTTP through Caddy, tls automatic HTTPS, proxy your own proxy on 127.0.0.1:8080, cloudflared a Cloudflare Tunnel (no published ports). |
CLOUDFLARE_TUNNEL_TOKEN |
Connector token of your Cloudflare tunnel (SWO_LAYER=cloudflared; secret, read only by the cloudflared service, never by the app). The layer sets TRUSTED_PROXY_IP_HEADER=cf-connecting-ip for the app. See DEPLOYMENT_CLOUDFLARE.md. |
|
SWO_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 (SWO_LAYER=tls). |
|
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 (SWO_LAYER=proxy). |
APP_BIND, APP_PORT |
127.0.0.1, 8080 |
Where the cloud stack's app listens. |
POSTGRES_PASSWORD |
generated | Owner role sworg (migrations, backups). |
POSTGRES_APP_PASSWORD |
generated | Runtime role sworg_app (data only). |
REDIS_PASSWORD |
generated | Redis requirepass. |
MINIO_ROOT_USER, MINIO_ROOT_PASSWORD |
generated | Silo administrator. |
S3_APP_PASSWORD |
generated | Secret of the sworg-app storage identity, limited to the bucket. |
BACKUP_INTERVAL_HOURS |
24 |
Scheduled database dump and bucket mirror interval. |
SILO_IMAGE_TAG |
pinned | Silo release. |
Backup settings (backup.env)
Written by the installer menu's Backups option (scripts/vps-backup-settings.sh) into the owner-only
backup.env beside .env, and read only by scripts/vps-offsite-backup.sh. They are host settings, not
application environment, so they are in no .env or Compose file. See
DEPLOYMENT_VPS.md.
| Variable | Description |
|---|---|
BACKUP_AGE_RECIPIENT |
age public key; off-site copies are encrypted to it. The private key stays off the server. |
OFFSITE_ENDPOINT, OFFSITE_BUCKET, OFFSITE_PREFIX |
The off-site S3-compatible bucket and folder. |
OFFSITE_ACCESS_KEY_ID, OFFSITE_SECRET_ACCESS_KEY |
A key limited to that bucket. |
OFFSITE_KEEP_DAYS |
Days copies stay in the bucket (90). |
OFFSITE_CA |
offsite-ca.crt when a private endpoint uses its own CA. |
Scripts and images
| Variable | Used by | Description |
|---|---|---|
SWO_DIR |
install.sh, deploy job |
Install directory (/opt/spaceworks-organization). |
SWO_INSTALL_REPOSITORY_PINNED |
installer | Set when the repository was chosen before download. |
SWO_STATIC_ENV_FILE |
wrapper | Settings file (<install>/.env bundled, /etc/spaceworks-organization/cloud.env cloud). |
SWO_UPDATE_INSTALL_DIR |
wrapper, updater | The install a staged updater works on. |
SWO_COMPOSE_BUILD_LAYER |
wrapper, setup.sh --build |
1 builds the backend image from the checkout. |
SWO_BUILD_KEY |
wrapper | Throwaway Server Actions key for local builds (generated per run). |
SWO_COMPOSE_PROJECT |
wrapper | Compose project (sworg, sworg-cloud, sworg-smoke). |
SWO_TLS_DIR, SWO_BACKUP_DIR |
compose | Certificate and backup directories (./tls, ./backups). |
SWO_RUNNER_DIR |
install-runner.sh, vps-status.sh, vps-uninstall.sh |
Runner directory (/opt/spaceworks-organization-runner). |
SWO_DEPLOY |
GitHub repository variable | true enables the release workflow's deploy job. |
SWO_TOPOLOGY |
ops role | bundled or cloud; the runtime-role check runs only for bundled. |
SWO_NEXT_DIR |
entrypoint | Where the web build is (/app/.next, frontend /app/frontend/.next). |
SWO_DISABLE_BUILD_CACHE, SWO_FRONTEND_STANDALONE |
Dockerfile | Image build switches. |
SWO_SMOKE_PORT |
compose-smoke.sh |
The smoke test's edge port (18080). |
From SpaceWorks-Organization/docs/CONFIGURATION.md at 7cd1441, updated 2026-11-21. Suggest a change