Environment variables

Copy .env.example to .env.local for local work, or add these to your host.

Required

VariablePurpose
BETTER_AUTH_SECRETSigns session cookies; 32+ random bytes.
BETTER_AUTH_URLPublic URL of the app, e.g. https://assay.example.com. Falls back to APP_URL.
GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRETGoogle OAuth client; callback /api/auth/callback/google.
GITHUB_CLIENT_ID / GITHUB_CLIENT_SECRETGitHub OAuth app; callback /api/auth/callback/github.
MONGODB_URIMongoDB connection string. The database is the one named in its path, else MONGODB_DB_NAME, else sql_script_monitoring; users, roles, checks and runs all live there.
DATABASE_URLThe built-in data source: the PostgreSQL database checks run against unless they name another data source.
UPSTASH_REDIS_REST_URLUpstash Redis REST URL.
UPSTASH_REDIS_REST_TOKENUpstash Redis REST token.

At least one sign-in provider (Google or GitHub) must be set.

In production the server refuses to start without BETTER_AUTH_SECRET, MONGODB_URI, DATABASE_URL and APP_URL (on Vercel the production domain stands in for APP_URL); the log names the missing variables. Optional features that are not configured stay off and log one warning each at start.

Running checks

VariablePurpose
CHECK_TIMEOUT_MSHow long a check's SQL may run, all statements together, before PostgreSQL stops it. Default 30000 (30 s); values are kept between 1000 and 300000.
CHECK_CONCURRENCYHow many checks one server instance runs at the same time; more wait for a free slot. Default 4.
PG_POOL_MAXMost connections one server instance opens to DATABASE_URL. Default 10.
PG_SOURCE_POOL_MAXMost connections one server instance opens to each data source added in Settings. Default 3.
ALLOW_PRIVATE_DATA_SOURCEStrue lets added data sources use hosts on private networks (10.x, 192.168.x, localhost, *.internal), and lets those skip TLS. Off by default, so a connection string cannot reach internal services or the cloud metadata endpoint. Turn it on when self-hosting next to a private database.
SEED_DATABASE_URLOptional. A role that may create tables, used only by npm run seed:demo. Lets DATABASE_URL be a SELECT-only role.
RUN_RETENTION_DAYSDays a run is kept before MongoDB deletes it. Default 90; 0 keeps runs forever.

The scheduled GitHub workflow runs checks outside your host, so it needs these too, along with MONGODB_DB_NAME and the certificate URLs; Scheduling lists which to add as secrets and which as variables.

Alerts

See Notifications.

VariablePurpose
ASSAY_SECRET_KEYNeeded for alerts and data sources: 32 random bytes, base64 (openssl rand -base64 32). Encrypts channel secrets and data source connection strings, and signs OAuth state. Without it no destination or data source can be saved; changing it makes saved ones unreadable.
APP_URLPublic URL used in alert links and one-click redirects. On Vercel the production domain is used when unset.
CRON_SECRETBearer token the scheduled workflow sends to POST /api/notifications/dispatch. Unset, that endpoint refuses every call. Add it, with APP_URL, as a GitHub Actions secret too.
SLACK_CLIENT_ID / SLACK_CLIENT_SECRETEnable Add to Slack. Redirect URL <APP_URL>/api/integrations/slack/callback.
SLACK_SIGNING_SECRETEnables the Acknowledge and Mute 24 h buttons in Slack alerts.
DISCORD_CLIENT_ID / DISCORD_CLIENT_SECRETEnable Add to Discord. Redirect URL <APP_URL>/api/integrations/discord/callback.
TELEGRAM_BOT_TOKEN / TELEGRAM_BOT_USERNAMEEnable Telegram: the bot from @BotFather, and its username without the @.
TELEGRAM_WEBHOOK_SECRETIn production, lets Telegram push updates to Assay; run npm run telegram:webhook once after setting it. Without it the settings page polls Telegram while someone links a chat.

Optional

VariablePurpose
AI_ENABLEDtrue turns on the AI assistant. Off by default, because every request spends AI Gateway credits.
AI_GATEWAY_API_KEYAI Gateway key for hosts other than Vercel. On Vercel the gateway authenticates with OIDC and no key is needed.
AI_GATEWAY_MODELOverrides the default model, as a provider/model id.
DEMO_MODEtrue makes the workspace a public demo: viewers may run the seeded demo checks, 20 runs per hour each, and visitors can try it as guests without an account (see Accounts and roles). Leave unset otherwise.
TRUSTED_PROXY_COUNTSelf-hosted demo only: how many proxies in front of Assay append to X-Forwarded-For, so a guest's address is read from the entry the outermost of them added, not one the visitor made up. Default 1; 0 trusts no forwarding header, so all guests share one quota. Ignored on Vercel, which sets the client address itself.
ALLOWED_EMAIL_DOMAINSComma-separated email domains allowed to sign in. Empty allows everyone.
CA_CERT_BLOB_URLhttps:// URL of the CA certificate PostgreSQL's server certificate is verified against. With CLIENT_CERT_BLOB_URL and CLIENT_KEY_BLOB_URL, also a client certificate.
AUTH_DEV_PASSWORD_LOGINtrue also offers email and password sign-in, in local development only; ignored in production.

See also