Skip to content
Back to the app

Environment Variables ​

All environment variables for a production deployment of CHANGENTS.AI.


Core ​

VariableRequiredDescription
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 ​

VariableRequiredDescription
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.

VariableDefaultDescription
WORKER_ROLEallall: 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_ORG3Runs one organisation (or personal account) has going at once, across all workers
RUN_WORKER_CONCURRENCY4Runs one worker process executes at once
RUN_NODE_CONCURRENCY4Steps of one run that execute at once when branches are independent. 1 runs one step at a time
RUN_QUEUE_LEASE_MS120000How long a worker's claim on a run lasts without renewal. A run whose worker stopped is picked up after this
RUN_QUEUE_MAX_ATTEMPTS3Times a run may be interrupted before it is marked failed
RUN_QUEUE_POLL_MS2000How often an idle worker looks for queued runs
LEADER_LEASE_ENABLEDtruefalse runs every background loop on every instance
MARKETING_SCHEDULER_ENABLEDofftrue runs the daily marketing pipeline without Redis (MARKETING_SCHEDULE_CRON, MARKETING_SCHEDULE_TZ)
DPO_REPORT_ENABLEDofftrue sends the weekly DPO report, with or without Redis (DPO_REPORT_CRON, DPO_REPORT_TZ)

Authentication — JWT & Sessions ​

VariableRequiredDescription
JWT_SECRET✓32+ character random string for JWT signing
JWT_EXPIRES_INToken lifetime (default: 24h)
SESSION_SECRET✓32+ character random string for session signing

Authentication — Google OAuth ​

VariableRequiredDescription
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/callback

Authentication — Apple Sign-In ​

VariableRequiredDescription
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 ​

VariableRequiredDescription
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 ​

VariableRequiredDescription
ANTHROPIC_API_KEY*Claude API key (required unless on-prem only)
GOOGLE_CLOUD_PROJECT_IDGoogle Cloud project ID for Vertex AI
GOOGLE_CLOUD_LOCATIONGCP region (e.g., us-central1)
GOOGLE_APPLICATION_CREDENTIALSPath to service account JSON (Vertex AI)
OLLAMA_ALLOW_LOCALtrue to allow Ollama on localhost (on-prem requirement)
OLLAMA_ENDPOINTOllama server URL (e.g., http://localhost:11434)
OLLAMA_MODELDefault 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.

VariableRequiredDescription
LLM_CACHEoff turns the cache off. Default on
LLM_CACHE_TTL_SECONDSHow long an answer is kept. Default 3600, max 86400
LLM_CACHE_MAX_ENTRIESSize of the in-memory cache. Default 500

Health checks ​

PathAnswers
/healthAlways 200 while the process runs. The body says OK or DEGRADED. Kept for existing healthchecks
/health/liveAlways 200 while the process runs. Use it for a liveness probe
/health/ready503 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.

VariableRequiredDescription
READINESS_CRITICALExtra checks that fail readiness, comma-separated: python (agent service), model (model host)
READINESS_TIMEOUT_MSTimeout for each check. Default 2000
READINESS_CACHE_MSHow 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.

VariableRequiredDescription
CONNECTOR_HTTP_TIMEOUT_MSTimeout for each connector call. Default 15000
CONNECTOR_HTTP_RETRIESRetries after the first attempt. Default 2
ACTION_TIMEOUT_MSTimeout for one action. Default 60000
ACTION_LEDGER_STALE_MINUTESAfter 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.

VariableRequiredDescription
SENTRY_DSNTurns error tracking on
SENTRY_ENVIRONMENTEnvironment name on each report. Default NODE_ENV
SENTRY_RELEASERelease name. Default RAILWAY_GIT_COMMIT_SHA
SENTRY_TRACES_SAMPLE_RATE0 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.

VariableRequiredDescription
OTEL_EXPORTER_OTLP_ENDPOINTThe collector's base URL, for example http://otel-collector:4318
OTEL_EXPORTER_OTLP_HEADERSHeaders for the collector, as name=value pairs separated by ,
OTEL_SERVICE_NAMEService name on each trace. Default changents-backend

Decision log ​

VariableRequiredDescription
DECISION_LOGoff stops writing decision log rows. Decisions are unchanged (default: on)
DECISION_LOG_TTL_DAYSDays a decision log row is kept before it is deleted (default: 180)

See Audit Logs.


Feedback loop ​

VariableRequiredDescription
MODEL_ROUTER_LEARNINGoff, 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_SAMPLESWeighted 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_SWEEPon 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_URIThe local sandbox database the sweep runs against (mongodb://localhost…). The sandbox must be seeded first (scripts/sandbox/run.sh up)
KNOWN_ANSWER_TIMEOUT_MSLongest a sweep may run before it is stopped (default: six hours)

See Rate a result.


Licensing (on-prem only) ​

VariableRequiredDescription
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 ​

VariableRequiredDescription
STRIPE_SECRET_KEY*Stripe secret key (required if using Stripe)
STRIPE_WEBHOOK_SECRETStripe webhook signing secret
EXPO_PUBLIC_STRIPE_PUBLISHABLE_KEY*Stripe publishable key (for frontend)
STRIPE_CREDITS_WEBHOOK_SECRETSigning secret of the credits webhook endpoint
AIRWALLEX_CLIENT_IDAirwallex client id (fallback payment rail)
AIRWALLEX_API_KEYAirwallex API key
AIRWALLEX_WEBHOOK_SECRETAirwallex webhook signing secret
AIRWALLEX_API_URLAirwallex 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.

VariableDescription
VAPID_PUBLIC_KEYBrowser push: public half of a P-256 key pair, base64url
VAPID_PRIVATE_KEYBrowser push: private half, base64url. Secret
VAPID_SUBJECTBrowser push: mailto: address or https:// URL the push services can reach
EXPO_ACCESS_TOKENMobile push: optional access token; setting it turns mobile push on
EXPO_PUSH_ENABLEDMobile 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.

VariableDescription
EXPO_PUBLIC_API_URLBackend API base URL (e.g., https://api.yourco.com)
EXPO_PUBLIC_APP_NAMEApp display name
EXPO_PUBLIC_SUPPORT_EMAILSupport email shown in the app

Railway-Specific ​

When deploying on Railway, these variables are injected automatically:

VariableDescription
RAILWAY_PUBLIC_DOMAINPublic domain assigned by Railway (auto-set)
RAILWAY_ENVIRONMENTCurrent Railway environment (production, staging)

Use ${{RAILWAY_PUBLIC_DOMAIN}} in your OAuth callback URLs within the Railway dashboard.


Generating Secrets ​

bash
# Generate a 32-byte JWT secret
openssl rand -hex 32

# Generate a 64-byte session secret
openssl rand -hex 64

What's Next? ​

Served from this deployment. No page view leaves it.