Environment Variables
All environment variables for a production deployment of CHANGENTS.AI.
Core
| Variable | Required | Description |
|---|---|---|
NODE_ENV | ✓ | Set to production for all deployments |
PORT | ✓ | Backend Express port (on-prem default: 8085) |
FRONTEND_PORT | ✓ | Frontend server port (on-prem default: 8087) |
Database
| Variable | Required | Description |
|---|---|---|
MONGODB_URI | ✓ | MongoDB connection string (e.g., mongodb+srv://user:pass@cluster.mongodb.net/changents) |
REDIS_URL | ✓ | Redis connection URL (e.g., redis://localhost:6379) |
Workflow runs, schedules and the background sweeps do not need Redis: they are coordinated through MongoDB (see below).
Runs and background work
Workflow runs are queued in MongoDB and executed by a worker. With several backend instances, loops that must run once (schedules, reminders, sweeps, monitors) run on one instance at a time, chosen by a lease in MongoDB that passes to another instance when the holder stops.
| Variable | Default | Description |
|---|---|---|
WORKER_ROLE | all | all: serve the API and run workflows. api: serve the API and queue runs only. worker: run workflows. With api, run at least one worker or all |
RUN_CONCURRENCY_PER_ORG | 3 | Runs one organisation (or personal account) has going at once, across all workers |
RUN_WORKER_CONCURRENCY | 4 | Runs one worker process executes at once |
RUN_NODE_CONCURRENCY | 4 | Steps of one run that execute at once when branches are independent. 1 runs one step at a time |
RUN_QUEUE_LEASE_MS | 120000 | How long a worker's claim on a run lasts without renewal. A run whose worker stopped is picked up after this |
RUN_QUEUE_MAX_ATTEMPTS | 3 | Times a run may be interrupted before it is marked failed |
RUN_QUEUE_POLL_MS | 2000 | How often an idle worker looks for queued runs |
LEADER_LEASE_ENABLED | true | false runs every background loop on every instance |
MARKETING_SCHEDULER_ENABLED | off | true runs the daily marketing pipeline without Redis (MARKETING_SCHEDULE_CRON, MARKETING_SCHEDULE_TZ) |
DPO_REPORT_ENABLED | off | true sends the weekly DPO report, with or without Redis (DPO_REPORT_CRON, DPO_REPORT_TZ) |
Authentication — JWT & Sessions
| Variable | Required | Description |
|---|---|---|
JWT_SECRET | ✓ | 32+ character random string for JWT signing |
JWT_EXPIRES_IN | Token lifetime (default: 24h) | |
SESSION_SECRET | ✓ | 32+ character random string for session signing |
Authentication — Google OAuth
| Variable | Required | Description |
|---|---|---|
GOOGLE_CLIENT_ID | ✓ | From Google Cloud Console → OAuth 2.0 credentials |
GOOGLE_CLIENT_SECRET | ✓ | From Google Cloud Console |
EXPO_PUBLIC_GOOGLE_CLIENT_ID | ✓ | Same as above — exposed to Expo/mobile client |
Callback URL to register in Google Console:
https://yourdomain.com/api/auth/google/callbackAuthentication — Apple Sign-In
| Variable | Required | Description |
|---|---|---|
APPLE_CLIENT_ID | ✓ | Your App's Service ID (e.g., com.yourco.changents.signin) |
APPLE_TEAM_ID | ✓ | Your Apple Developer Team ID |
APPLE_KEY_ID | ✓ | Key ID from Apple Developer → Keys |
APPLE_PRIVATE_KEY | ✓ | Contents of the .p8 private key file |
EXPO_PUBLIC_APPLE_CLIENT_ID | ✓ | Same as APPLE_CLIENT_ID |
Authentication — Microsoft OAuth
| Variable | Required | Description |
|---|---|---|
MICROSOFT_CLIENT_ID | ✓ | Azure AD App registration Client ID |
MICROSOFT_CLIENT_SECRET | ✓ | Azure AD App registration Client Secret |
EXPO_PUBLIC_MICROSOFT_CLIENT_ID | ✓ | Same as MICROSOFT_CLIENT_ID |
AI / LLM
| Variable | Required | Description |
|---|---|---|
ANTHROPIC_API_KEY | * | Claude API key (required unless on-prem only) |
GOOGLE_CLOUD_PROJECT_ID | Google Cloud project ID for Vertex AI | |
GOOGLE_CLOUD_LOCATION | GCP region (e.g., us-central1) | |
GOOGLE_APPLICATION_CREDENTIALS | Path to service account JSON (Vertex AI) | |
OLLAMA_ALLOW_LOCAL | true to allow Ollama on localhost (on-prem requirement) | |
OLLAMA_ENDPOINT | Ollama server URL (e.g., http://localhost:11434) | |
OLLAMA_MODEL | Default model name (e.g., qwen2.5:7b) |
Model response cache
A model call with temperature 0, no tools, no streaming and no images is answered from a cache when the same call was made recently. It is never used for a RESTRICTED step, for text that looks like special-category data (health, religion and similar), or for an organisation or request in No-Retention Mode. Entries are kept per organisation. The cache uses Redis when REDIS_URL is set, and memory in the backend process otherwise.
| Variable | Required | Description |
|---|---|---|
LLM_CACHE | off turns the cache off. Default on | |
LLM_CACHE_TTL_SECONDS | How long an answer is kept. Default 3600, max 86400 | |
LLM_CACHE_MAX_ENTRIES | Size of the in-memory cache. Default 500 |
Health checks
| Path | Answers |
|---|---|
/health | Always 200 while the process runs. The body says OK or DEGRADED. Kept for existing healthchecks |
/health/live | Always 200 while the process runs. Use it for a liveness probe |
/health/ready | 503 when MongoDB is unreachable (or a dependency named in READINESS_CRITICAL), otherwise 200. Use it for a readiness probe |
/health/ready also reports the agent service and the model host. They fail it only when you name them.
| Variable | Required | Description |
|---|---|---|
READINESS_CRITICAL | Extra checks that fail readiness, comma-separated: python (agent service), model (model host) | |
READINESS_TIMEOUT_MS | Timeout for each check. Default 2000 | |
READINESS_CACHE_MS | How long a result is reused. Default 5000 |
Connectors and actions
Calls to HubSpot, Xero, Telegram and WhatsApp have a timeout, are retried only when a repeat cannot do the work twice, and stop for a while after a provider keeps failing.
An action you confirm on a result (send an email, post a message, schedule a meeting, update a CRM record, export a document) is performed once per run, step and set of arguments. Pressing it again answers duplicate: true and sends nothing.
| Variable | Required | Description |
|---|---|---|
CONNECTOR_HTTP_TIMEOUT_MS | Timeout for each connector call. Default 15000 | |
CONNECTOR_HTTP_RETRIES | Retries after the first attempt. Default 2 | |
ACTION_TIMEOUT_MS | Timeout for one action. Default 60000 | |
ACTION_LEDGER_STALE_MINUTES | After this long, an action whose sender stopped mid-send may be tried again. Default 15 |
Error tracking
Off unless SENTRY_DSN is set. When it is, uncaught errors and every 5xx are reported with the request's trace id. Reports carry no request bodies, cookies, auth headers, query strings, console log lines or emails. Exception messages and extra context are redacted first. Once enabled, the error tracking provider is a sub-processor of your data.
| Variable | Required | Description |
|---|---|---|
SENTRY_DSN | Turns error tracking on | |
SENTRY_ENVIRONMENT | Environment name on each report. Default NODE_ENV | |
SENTRY_RELEASE | Release name. Default RAILWAY_GIT_COMMIT_SHA | |
SENTRY_TRACES_SAMPLE_RATE | 0 to 1. Default 0 (errors only, no performance traces) |
Run traces
Off unless OTEL_EXPORTER_OTLP_ENDPOINT is set. When it is, each finished run is sent once to that collector as OpenTelemetry traces (OTLP over HTTP in JSON, posted to the collector's standard v1/traces path under the endpoint): one span for the run and one for each step that ran. A span carries ids, step names, timings, status, the model that served the step, token counts and the estimated cost. It never carries a prompt, an input or a result. A run does not wait for the export and does not fail if the collector is down.
With AIR_GAPPED=true the endpoint must be on your own network; anything else is refused and logged once. A collector outside your network receives step names and run ids, so treat its operator as a sub-processor.
| Variable | Required | Description |
|---|---|---|
OTEL_EXPORTER_OTLP_ENDPOINT | The collector's base URL, for example http://otel-collector:4318 | |
OTEL_EXPORTER_OTLP_HEADERS | Headers for the collector, as name=value pairs separated by , | |
OTEL_SERVICE_NAME | Service name on each trace. Default changents-backend |
Decision log
| Variable | Required | Description |
|---|---|---|
DECISION_LOG | off stops writing decision log rows. Decisions are unchanged (default: on) | |
DECISION_LOG_TTL_DAYS | Days a decision log row is kept before it is deleted (default: 180) |
See Audit Logs.
Feedback loop
| Variable | Required | Description |
|---|---|---|
MODEL_ROUTER_LEARNING | off, shadow (default) or on. Shadow computes the per agent and model correction from ratings, check scores and failures and logs the model it would pick; only on changes routing (MODEL_ROUTER must not be off) | |
MODEL_ROUTER_LEARNING_MIN_SAMPLES | Weighted signals an agent and model need before the correction moves (default: 20). The correction is capped at one quality point and fades out over 30 days | |
KNOWN_ANSWER_SWEEP | on runs the sandbox known-answer checks once a week and opens an Operations Office issue when a check that passed last time fails (default: off). Refused under NODE_ENV=production | |
KNOWN_ANSWER_SANDBOX_MONGODB_URI | The local sandbox database the sweep runs against (mongodb://localhost…). The sandbox must be seeded first (scripts/sandbox/run.sh up) | |
KNOWN_ANSWER_TIMEOUT_MS | Longest a sweep may run before it is stopped (default: six hours) |
See Rate a result.
Licensing (on-prem only)
| Variable | Required | Description |
|---|---|---|
LICENSE_KEY | ✓ | From your welcome email (starts CHNGT2.). Its signature is verified offline; no secret needed |
Not set on the hosted/cloud product — only on-prem deployments enforce this.
Payments
| Variable | Required | Description |
|---|---|---|
STRIPE_SECRET_KEY | * | Stripe secret key (required if using Stripe) |
STRIPE_WEBHOOK_SECRET | Stripe webhook signing secret | |
EXPO_PUBLIC_STRIPE_PUBLISHABLE_KEY | * | Stripe publishable key (for frontend) |
STRIPE_CREDITS_WEBHOOK_SECRET | Signing secret of the credits webhook endpoint | |
AIRWALLEX_CLIENT_ID | Airwallex client id (fallback payment rail) | |
AIRWALLEX_API_KEY | Airwallex API key | |
AIRWALLEX_WEBHOOK_SECRET | Airwallex webhook signing secret | |
AIRWALLEX_API_URL | Airwallex API base URL |
Stripe is the primary payment rail; Airwallex is used only when Stripe is not configured or fails.
Push Notifications
Optional. Without these, push notifications are off and nothing is sent. See Push Notifications.
| Variable | Description |
|---|---|
VAPID_PUBLIC_KEY | Browser push: public half of a P-256 key pair, base64url |
VAPID_PRIVATE_KEY | Browser push: private half, base64url. Secret |
VAPID_SUBJECT | Browser push: mailto: address or https:// URL the push services can reach |
EXPO_ACCESS_TOKEN | Mobile push: optional access token; setting it turns mobile push on |
EXPO_PUSH_ENABLED | Mobile push: true turns it on without a token |
Frontend Public Variables
These are prefixed EXPO_PUBLIC_ and are included in the frontend bundle. Do not put secrets here.
| Variable | Description |
|---|---|
EXPO_PUBLIC_API_URL | Backend API base URL (e.g., https://api.yourco.com) |
EXPO_PUBLIC_APP_NAME | App display name |
EXPO_PUBLIC_SUPPORT_EMAIL | Support email shown in the app |
Railway-Specific
When deploying on Railway, these variables are injected automatically:
| Variable | Description |
|---|---|
RAILWAY_PUBLIC_DOMAIN | Public domain assigned by Railway (auto-set) |
RAILWAY_ENVIRONMENT | Current Railway environment (production, staging) |
Use ${{RAILWAY_PUBLIC_DOMAIN}} in your OAuth callback URLs within the Railway dashboard.
Generating Secrets
# Generate a 32-byte JWT secret
openssl rand -hex 32
# Generate a 64-byte session secret
openssl rand -hex 64