Environment Variables
Every variable a Crudy deployment reads.
The backend reads its configuration from environment variables and validates them at boot. Missing or weak secrets cause the process to exit before the server starts listening.
Required at boot
The framework's assertSecretsHardened check runs first. It enforces these and any module-declared secrets.
| Variable | Required | Notes |
|---|---|---|
JWT_SECRET | yes | At least 32 characters. Must not match known defaults (changeme, password, secret, admin, ...). Must have at least 8 unique characters of entropy. |
LICENSE_FILE | yes | Path to the license.lic file Crudy issued for your deployment. Read once at boot. |
LICENSE_PUBLIC_KEY or LICENSE_PUBLIC_KEY_FILE | yes | The verification key Crudy shipped alongside your license. Inline PEM or a path. |
If any check fails the backend logs the failures with the [secrets] prefix and exits.
Never deploy with a placeholder secret. The check rejects common default values (including changeme, change-this-to-a-long-random-secret-in-production, postgres, admin, test, dev) and any string under 32 characters or with low entropy.
Database
| Variable | Default | Notes |
|---|---|---|
DB_HOST | localhost | PostgreSQL hostname. In the generated compose file this is postgres. |
DB_USER | required | PostgreSQL role used by the backend. |
DB_PASSWORD | required | Password for that role. |
DB_NAME | required | Database name. |
The generated docker-compose.yml reads DB_USER, DB_PASSWORD and DB_NAME from your .env.
Admin account
| Variable | Default | Notes |
|---|---|---|
ADMIN_EMAIL | break-glass@crudy.invalid | Identifier of the sealed break-glass account created on first boot, the only one holding every permission. It has no password and cannot sign in until crudy admin reset unseals it for 4 hours; it must enrol a second factor at first sign-in and every sign-in notifies the holders of the audit view. Use it to create named users, then let it reseal. Read only on first boot. Older installs keep their admin account; crudy admin seal turns it into the break-glass account. |
Do not set ADMIN_EMAIL=admin@example.com for the global admin. That email is used by dev seeds for an org-scoped admin and conflating the two creates a misleading permission state.
Network and CORS
| Variable | Default | Notes |
|---|---|---|
CORS_ORIGIN | http://localhost:3001 | Comma-separated list of allowed origins for the API. |
TRUSTED_PROXIES | loopback,linklocal,uniquelocal | Hops allowed to set X-Forwarded-For: IPs, CIDRs, those keywords, or none. List your proxy or CDN ranges when they have public addresses. An invalid value stops boot. |
BACKEND_PORT | 3000 | Host port the backend container publishes. |
FRONTEND_PORT | 3001 | Host port the frontend container publishes. |
API_URL | http://localhost:3000 | URL the browser uses to reach the backend. Read by the frontend at runtime, so changing it needs a restart, not a rebuild. Required in production. |
Outgoing mail uses the active email connector when one exists, otherwise these variables. An app whose signIn.methods lists email_code or email_link refuses to boot when neither is set.
| Variable | Default | Notes |
|---|---|---|
SMTP_HOST | unset | SMTP server. Unset means no environment provider. |
SMTP_PORT | 587 | 465 implies implicit TLS. |
SMTP_SECURE | true on 465 | true for implicit TLS, false for STARTTLS. |
SMTP_USER / SMTP_PASS | unset | Set both or neither. The password is never logged. |
SMTP_FROM | required with SMTP_HOST | Sender, e.g. App <no-reply@example.com>. |
SMTP_ALLOW_INSECURE_HOSTS | unset | Comma-separated hosts allowed without TLS. Loopback is always allowed. |
AUTH_CODE_PEPPER | required with email sign-in | 32+ random characters. |
APP_URL | required with email sign-in | Public frontend origin that emailed links point at. |
Operational toggles
| Variable | Default | Notes |
|---|---|---|
NODE_ENV | required by Docker images | development or production. |
DISABLE_RATE_LIMIT | unset | Set to true only for local load testing. Never in production. |
Module-declared secrets
A module can declare additional required secrets in its BackendModule.requiredSecrets array. The framework adds them to the boot-time check:
requiredSecrets: [
{ name: 'SMTP_PASSWORD', minLength: 16, description: 'SMTP relay password' },
]If the module is wired into the app, the variable must be present at boot. The same length and entropy checks apply.
Where to put values
- Local dev:
.envin the app root, loaded bydocker composeand by the generatedMakefiletargets. - Production: your secrets manager. Mount values into the backend container.
- Never commit
.envfiles to source control. The framework ships.env.exampleas the documented template.
Verifying
After setting variables, make health confirms the backend is up and reports db: connected. If the backend fails to start, its logs (make dev-logs or docker logs <container>) will show the [secrets] failures or the license verification error.