Skip to main content

Environment variables

167 variables, generated from two sources: the variables the Rust crates read (env::var and the env_* helpers), and medbrains/.env.example with its comments. Example is the value .env.example uses for local development, not necessarily the compiled default; the server's own defaults are in crates/medbrains-server-core/src/config.rs. Settings layer as compiled defaults, then config.toml, then environment variables.

NameExampleWhat it doesRead by
ABDM_BASE_URLhttps://abhasbx.abdm.gov.inABDM (Ayushman Bharat Digital Mission)config file (RawConfig) or deploy kit
ABDM_BEARER_TOKENsecret: set in your secret store, never commitconfig file (RawConfig) or deploy kit
ABDM_CLIENT_IDmedbrains-server
ABDM_CLIENT_SECRETsecret: set in your secret store, never commitmedbrains-server
ABDM_ENVIRONMENTmedbrains-server
ABDM_HIE_GATEWAY_URLhttps://dev.abdm.gov.in/gateway/v0.5config file (RawConfig) or deploy kit
ABDM_HIP_IDmedbrains.hipconfig file (RawConfig) or deploy kit
AI_MODELmedbrains-server-services
AI_PROVIDERanthropicAnthropic API — dev/eval on synthetic data only (production AI is Bedrock above; startup warns that this provider is outside India). There is NO Anthropic API key anywhere: the server, and the eval harness, sign in with their AWS identity bmedbrains-server, medbrains-server-services
AI_QUERY_TEST_DATABASE_URLmedbrains-ai
ANATOMY_CDN_ORIGINhttps://dxxxxxxxxxxxx.cloudfront.netCDN origin serving the body-site anatomy model (bare https://host). Joins the SPA's CSP connect-src. Leave unset when the model is served from /anatomy.medbrains-server
ANTHROPIC_AWS_PROFILEmedbrains-claude # laptop only; unset = ambient AWS credentialsconfig file (RawConfig) or deploy kit
ANTHROPIC_AWS_REGIONap-south-1 # where STS signs the identity token (default)config file (RawConfig) or deploy kit
ANTHROPIC_FEDERATION_RULE_IDfdrl_01TsZUU4SvQdgNzheHcx7mpTconfig file (RawConfig) or deploy kit
ANTHROPIC_ORGANIZATION_IDd6f15fb3-c3e7-41d0-a30e-b32170a1420aconfig file (RawConfig) or deploy kit
ANTHROPIC_SERVICE_ACCOUNT_IDsvac_01YAU6D9HuQytpETGjhuYrgQconfig file (RawConfig) or deploy kit
ANTHROPIC_WORKSPACE_IDwrkspc_016nVbho3L6ZPaHea3kJ3Z2yconfig file (RawConfig) or deploy kit
APP_ORIGINhttps://medbrains.localhostconfig file (RawConfig) or deploy kit
BEDROCK_API_KEYsecret: set in your secret store, never commitconfig file (RawConfig) or deploy kit
BEDROCK_BASE_URLmedbrains-server, medbrains-server-services
BEDROCK_REGIONap-south-1medbrains-server, medbrains-server-services
COOKIE_DOMAINmedbrains-server
CORS_ORIGINhttps://medbrains.localhost,https://medbrains-desktop.localhost,https://medbrains-icd.localhostCORS & Cookiesconfig file (RawConfig) or deploy kit
DATABASE_URLpostgres://medbrains_app:medbrains_dev@localhost:5435/medbrainsPostgreSQL Three roles, three URLs (docs/ops/DB-ROLES.md): DATABASE_URL medbrains_app — requests; row level security applies MIGRATION_DATABASE_URL medbrains (owner) — migrations and seeding WORKER_DATABASE_URLmedbrains-analytics, medbrains-ancillary, medbrains-auth, medbrains-authz, medbrains-automation-store, medbrains-billing, medbrains-db, medbrains-health-intel, medbrains-health-services, medbrains-kernel, medbrains-knowledge, medbrains-mrd, medbrains-nabh, medbrains-reports, medbrains-research, medbrains-security-intel, medbrains-server, medbrains-sop-flows, medbrains-vte
DB_POOL_ACQUIRE_TIMEOUT_SECS5config file (RawConfig) or deploy kit
DB_POOL_IDLE_TIMEOUT_SECS600config file (RawConfig) or deploy kit
DB_POOL_MAX_CONNECTIONS20config file (RawConfig) or deploy kit
DB_POOL_MAX_LIFETIME_SECS1800config file (RawConfig) or deploy kit
DB_POOL_MIN_CONNECTIONS2config file (RawConfig) or deploy kit
DB_SLOW_QUERY_MS250config file (RawConfig) or deploy kit
DB_STATEMENT_CACHE_CAPACITY256config file (RawConfig) or deploy kit
DLT_ENFORCEtrue # India: refuse to send if no registered template matches event scopeconfig file (RawConfig) or deploy kit
EMAIL_FROM_ADDRESShospital@example.commedbrains-infra-settings
EMAIL_FROM_NAMEMedBrains Hospitalconfig file (RawConfig) or deploy kit
EMAIL_PROVIDERsendgrid # or "ses" (pending SigV4)Email — SendGrid (production) or stub (dev) when unsetconfig file (RawConfig) or deploy kit
EVAL_AI_MODELmedbrains-ai-eval
EVAL_AI_PRICEmedbrains-ai-eval
EVAL_AI_PROVIDERanthropic EVAL_AI_MODEL=claude-haiku-5-5 make eval-ai-liveLive eval against Anthropic (make eval-ai-live):medbrains-ai-eval
EXPO_PUBLIC_API_BASEhttps://medbrains.localhostconfig file (RawConfig) or deploy kit
FLOW_TICK_SECSmedbrains-flow
GITHUB_ISSUES_API_URLmedbrains-client-errors
GITHUB_ISSUES_INCLUDE_CLIENT_STACKfalsemedbrains-client-errors
GITHUB_ISSUES_LABELSbug,client-errormedbrains-client-errors
GITHUB_ISSUES_REPOowner/repomedbrains-client-errors
GITHUB_ISSUES_TOKENsecret: set in your secret store, never commitGitHub issue creation for frontend crash reports (optional)medbrains-client-errors
GOTENBERG_URLhttp://127.0.0.1:3005Server-side PDF rendering (documents API). Point at the gotenberg container from docker-compose. Unset = documents endpoints 503.medbrains-print
HOST0.0.0.0Serverconfig file (RawConfig) or deploy kit
ICD_API_INCLUDE2026-01_enconfig file (RawConfig) or deploy kit
ICD_API_PORT8382config file (RawConfig) or deploy kit
ICD_API_SAVE_ANALYTICSfalseconfig file (RawConfig) or deploy kit
JWT_PRIVATE_KEYsecret: set in your secret store, never commitJWT (Ed25519 keys — leave unset for auto-generated dev keypair; REQUIRED when MEDBRAINS_ENV=production)config file (RawConfig) or deploy kit
JWT_PUBLIC_KEYsecret: set in your secret store, never commitconfig file (RawConfig) or deploy kit
LOADTEST_DEBUGmedbrains-loadtest
LOADTEST_DOCTOR_IDmedbrains-loadtest
LOADTEST_FORWARDEDmedbrains-loadtest
LOADTEST_PASSWORDsecret: set in your secret store, never commitmedbrains-loadtest
LOADTEST_USERNAMEmedbrains-loadtest
MB_OS_TEST_ARCHmedbrains-os-test
MB_OS_TEST_ONLYmedbrains-os-test
MEDBRAINS_ABDM_SECRET_KEYsecret: set in your secret store, never commitKeys the Aadhaar/ID fingerprints used to spot the same person twice. Changing it orphans every stored fingerprint.config file (RawConfig) or deploy kit
MEDBRAINS_ADVISORY_BUNDLE/usr/share/medbrains/advisories.jsonmedbrains-security-intel
MEDBRAINS_ADVISORY_FETCHoffcheck reads the advisory bundle shipped with the release (scripts/build_advisory_bundle.py); with neither it reports "could not check", never "no vulnerabilities".medbrains-security-intel
MEDBRAINS_API_BASEmedbrains-server
MEDBRAINS_BINDING_SIGNING_KEYsecret: set in your secret store, never commitopenssl x509 -in cert.pem -pubkey -noout | openssl pkey -pubin -outform der \ | openssl dgst -sha256 -binary | base64config file (RawConfig) or deploy kit
MEDBRAINS_DEPLOY_MODEmedbrains-core
MEDBRAINS_DISABLE_OUTBOX_WORKERmedbrains-server
MEDBRAINS_DISABLE_SIMULATOR_SCHEDULERmedbrains-server
MEDBRAINS_ENABLE_E2E_SEEDmedbrains-server
MEDBRAINS_ENVproductionDeployment environment: development (default) | production. production refuses to start without JWT keys and disables demo seeding.medbrains-core, medbrains-dictation, medbrains-outbox, medbrains-payment-gateway, medbrains-seed, medbrains-server
MEDBRAINS_EVENT_TOKEN_KEYsecret: set in your secret store, never commitconfig file (RawConfig) or deploy kit
MEDBRAINS_HOSTEDtrue (MedBrains-hosted installs default ON). Off, the── Security intelligence (RFC-OSINT phase 1) Dependency advisories: the server compares the crate/npm versions it was built from with OSV. Network lookups are OFF unless set here, or unlessmedbrains-core, medbrains-security-intel
MEDBRAINS_IDENTIFIER_HMAC_KEYsecret: set in your secret store, never commitProduction will not start without MEDBRAINS_IDENTIFIER_HMAC_KEY. The ABDM, NHCX and PACS keys are optional: without one the server starts with that integration off (ABDM + UHI, NHCX, or the PACS password) and its settings screen says whichconfig file (RawConfig) or deploy kit
MEDBRAINS_LOG_FAILED_PAYLOADS0Log the query and JSON body of failed requests (not 401s), identity masked, clinical values kept. Turn on only while chasing a failure.medbrains-server-core
MEDBRAINS_LOG_PAYLOAD_SIZESmedbrains-server-core
MEDBRAINS_NHCX_SECRET_KEYsecret: set in your secret store, never commitEncrypts the ABDM client secret at rest. Changing it means re-entering the secret on the ABDM settings screen.config file (RawConfig) or deploy kit
MEDBRAINS_NOTIFY_SIMULATORtrueMessage simulator — dev and test ONLY. SMS, WhatsApp and email are stored in simulated_messages and shown in Admin → Message Simulator instead of being sent. The server refuses to start with this on and MEDBRAINS_ENV=production.medbrains-server
MEDBRAINS_OBJECTS_HOT/var/lib/medbrains/objectsGenerated-document storage root (LocalFs object store). Defaults to ./data/objects in dev; the deploy kit sets /var/lib/medbrains/objects.medbrains-server
MEDBRAINS_OSV_URLmedbrains-security-intel
MEDBRAINS_PACS_ALLOWED_HOSTSpacs.example-hospital.inEncrypts each hospital's PACS password at rest. Changing it means re-entering it in Radiology → PACS.config file (RawConfig) or deploy kit
MEDBRAINS_PACS_SECRET_KEYsecret: set in your secret store, never commitEncrypts the NHCX client secret and private key at rest. Changing it means re-entering both in Settings → NHCX.config file (RawConfig) or deploy kit
MEDBRAINS_PUBLIC_BASE_URLhttps://hims.example.org # where apps reach this serverHospital binding QR (Admin -> Devices -> Bind apps). Apps scan it and talk only to this server, pinned to its TLS key.medbrains-print-data, medbrains-signing, medbrains-sso-login
MEDBRAINS_RETENTION_DRY_RUNtrueRetention enforcement: set true to log what the daily pass WOULD purge without deleting anything.medbrains-server
MEDBRAINS_SECRETS_BACKENDsecret: set in your secret store, never commitSecrets backend (where runtime secrets — payment keys, OAuth creds — resolve from). env (default) | file | aws. Unset → derived from MEDBRAINS_DEPLOY_MODE (onprem → file at /etc/medbrains/secrets, saas/hybrid → aws). The 'aws' backend (AWmedbrains-server
MEDBRAINS_SEED_ADMIN_PASSWORDsecret: set in your secret store, never commitInitial admin password for first seed. REQUIRED in production (dev falls back to admin123). The account is flagged for forced password change on first login in production.medbrains-seed
MEDBRAINS_SEED_ADMIN_PASSWORD_CHOSENsecret: set in your secret store, never commitmedbrains-seed
MEDBRAINS_SEED_ADMIN_PASSWORD_HASHsecret: set in your secret store, never commitmedbrains-seed
MEDBRAINS_SEED_ADMIN_USERNAMEmedbrains-seed
MEDBRAINS_SEED_DEMO_DATAmedbrains-seed
MEDBRAINS_SEED_HOSPITAL_NAMEmedbrains-seed
MEDBRAINS_SIGNATURE_KEY_ENCRYPTION_KEYsecret: set in your secret store, never commitLocal cryptographic material Use different random 32+ byte values per environment/tenant group. SIGNATURE key wraps doctor Ed25519 signing keys at rest. EVENT token key encrypts opaque QR/barcode event tokens.config file (RawConfig) or deploy kit
MEDBRAINS_SINGLE_HOSPITALmedbrains-auth
MEDBRAINS_SSO_SCREEN_BASEmedbrains-sso-login
MEDBRAINS_TENANT_ID<tenant-uuid>Deployment ↔ tenant binding (on-prem single-hospital). Pins this deployment to its hospital so the sign-in page brands correctly, host-independent and stable across restarts (no custom-domain match needed). The public brand endpoint (/api/pmedbrains-setup
MEDBRAINS_TENANT_LOGOhttps://cdn.example/hospital-logo.svgmedbrains-setup
MEDBRAINS_TENANT_NAMEAlagappa Medical College & Hospitalmedbrains-setup
MEDBRAINS_TLS_SPKI_SHA256... # base64 SHA-256 of the cert's public key:config file (RawConfig) or deploy kit
MEDBRAINS_VENDOR_BACKFILL_MAXmedbrains-core
MEDBRAINS_VENDOR_EMAIL_DOMAINSmedbrains-core
MIGRATION_DATABASE_URLpostgres://medbrains:medbrains_dev@localhost:5435/medbrainsThe connection migrations and seeding run on. Must own the schema — the application role deliberately cannot create tables or alter policies, so without this the server fails at boot with "permission denied for schema public" before it hasmedbrains-server
NHCX_BASE_URLhttps://apisbx.abdm.gov.in/hcx/v1 # sandboxNHCX (insurance claims gateway, India)config file (RawConfig) or deploy kit
NHCX_BEARER_TOKENsecret: set in your secret store, never commitconfig file (RawConfig) or deploy kit
NHCX_PARTICIPANT_CODEhospital@nhcxconfig file (RawConfig) or deploy kit
NHCX_PRIVATE_KEY_PEMsecret: set in your secret store, never commitconfig file (RawConfig) or deploy kit
NHCX_RECIPIENT_PUBLIC_KEYsecret: set in your secret store, never commitconfig file (RawConfig) or deploy kit
NOTIFY_SOCKETmedbrains-proxy
NO_COLORmedbrains-server-core
NRCES_BUNDLE_DIRmedbrains-facilities, medbrains-fhir, medbrains-fhir-api, medbrains-nhcx-callback, medbrains-server
OLLAMA_API_BASE_URLmedbrains-server-services
OPENROUTER_API_KEYsecret: set in your secret store, never commitmedbrains-server-services
OUT_DIRmedbrains-security-intel
PORT3000config file (RawConfig) or deploy kit
RAZORPAY_KEY_IDmedbrains-payment-gateway, medbrains-pharmacy-delivery
RAZORPAY_KEY_SECRETsecret: set in your secret store, never commitmedbrains-payment-gateway, medbrains-pharmacy-delivery
RAZORPAY_WEBHOOK_SECRETsecret: set in your secret store, never commitmedbrains-payment-gateway
REPORTS_DATABASE_URLpostgres://medbrains_app:medbrains_dev@replica:5432/medbrainsReports, analytics, dashboard tiles and the AI query tool run on a pool of their own (docs/ops/DB-ROLES.md, "The report database"): read only, each statement stopped after the timeout, at most N heavy reports per hospital. Set REPORTS_DATABmedbrains-server
REPORTS_DB_POOL_MAX_CONNECTIONS4medbrains-server
REPORTS_MAX_CONCURRENT_PER_TENANT2config file (RawConfig) or deploy kit
REPORTS_SLOT_WAIT_MS5000config file (RawConfig) or deploy kit
REPORTS_STATEMENT_TIMEOUT_MS15000config file (RawConfig) or deploy kit
RESEARCH_TEST_DATABASE_URLmedbrains-ancillary, medbrains-research
RUST_LOGmedbrains_server=debug,tower_http=debugLoggingconfig file (RawConfig) or deploy kit
S3_ACCESS_KEY_IDsecret: set in your secret store, never commitconfig file (RawConfig) or deploy kit
S3_BUCKETmedbrains-alagappa-uploads-ap-south-1S3 — patient document uploads (MLC, MRD, consent forms, etc.) Bucket is provisioned by infra/terraform/modules/hospital-package. Leave blank for local dev; the /api/upload/presign endpoints return 400 Bad Request when S3 is not configured.config file (RawConfig) or deploy kit
S3_ENDPOINT# leave blank for AWS; set for MinIOconfig file (RawConfig) or deploy kit
S3_REGIONap-south-1config file (RawConfig) or deploy kit
S3_SECRET_ACCESS_KEYsecret: set in your secret store, never commitconfig file (RawConfig) or deploy kit
SECURE_COOKIEStrueconfig file (RawConfig) or deploy kit
SENDGRID_API_KEYsecret: set in your secret store, never commitconfig file (RawConfig) or deploy kit
SMTP_HOSTmail.medbrains.localhost(make dev-mail-mailboxes) every account uses the same dev value.config file (RawConfig) or deploy kit
SMTP_INSECURE_TLS1Dev only: accept the local Stalwart's mkcert TLS cert. The SMTP client (rustls) doesn't use the OS keychain, so it sees the dev cert as untrusted and sends fail "invalid peer certificate". Never set in production.medbrains-outbox
SMTP_PASSWORDsecret: set in your secret store, never commitconfig file (RawConfig) or deploy kit
SMTP_PORT587config file (RawConfig) or deploy kit
SMTP_TLSstarttls # starttls | implicit | noneconfig file (RawConfig) or deploy kit
SMTP_USERNAMEconfig file (RawConfig) or deploy kit
SNOMED_FHIR_AUTHORIZATIONmedbrains-snomed
SNOMED_FHIR_BASE_URLmedbrains-snomed
SNOMED_FHIR_TIMEOUT_MSmedbrains-snomed
SNOMED_IMPORT_DIRmedbrains-terminology
SNOMED_MAX_UNPACKED_BYTESmedbrains-terminology
SNOMED_UPLOAD_MAX_BYTESmedbrains-terminology
SPICEDB_ENDPOINThttp://localhost:50051ReBAC — SpiceDB sidecar (optional; falls back to PgAuthzBackend)medbrains-authz-spicedb, medbrains-server
SPICEDB_TESTmedbrains-authz-spicedb
SPICEDB_TOKENsecret: set in your secret store, never commitmedbrains-authz-spicedb, medbrains-server
SSO_CONFIG_FILEmedbrains-identity
STALWART_ADMIN_SECRETsecret: set in your secret store, never commitmedbrains-mail-provisioning
STALWART_ADMIN_USERadminmedbrains-mail-provisioning
STALWART_API_URLhttps://localhost:8086medbrains-mail-provisioning
STALWART_INSECURE_TLS1medbrains-mail-provisioning
TEST_APP_DATABASE_URLmedbrains-server
TRIAL_SIGNUPmedbrains-onboarding, medbrains-server
TRUSTED_PROXIES127.0.0.1/32,::1/128config file (RawConfig) or deploy kit
TWILIO_ACCOUNT_SIDACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxSMS — Twilio (production) or stub (dev) when unsetconfig file (RawConfig) or deploy kit
TWILIO_AUTH_TOKENsecret: set in your secret store, never commitconfig file (RawConfig) or deploy kit
TWILIO_FROM_NUMBER+91XXXXXXXXXXconfig file (RawConfig) or deploy kit
TWILIO_MESSAGING_SERVICE_SIDMGxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # India DLT routing (optional)config file (RawConfig) or deploy kit
UHI_GATEWAY_PUBLIC_KEY_PRODUCTIONMCowBQYDK2VwAyEA...config file (RawConfig) or deploy kit
UHI_GATEWAY_PUBLIC_KEY_SANDBOXMCowBQYDK2VwAyEA...UHI provider (Settings -> UHI). The gateway's public key (base64 SPKI) as NHA issues it, per environment; unset falls back to the UHI registry.config file (RawConfig) or deploy kit
UHI_PREVIEW_SERVICEStrueOffer services UHI does not yet support from a provider (teleconsultation with online payment, lab tests). Leave unset.config file (RawConfig) or deploy kit
WHATSAPP_ACCESS_TOKENsecret: set in your secret store, never commitconfig file (RawConfig) or deploy kit
WHATSAPP_PHONE_NUMBER_ID000000000000000WhatsApp — Meta Cloud APIconfig file (RawConfig) or deploy kit
WHO_ICD_API_BASE_URLhttps://id.who.intmedbrains-platform
WHO_ICD_AUTH_MODEoauthmedbrains-platform
WHO_ICD_CLIENT_ID<client-id>Cloud fallback mode: register at https://icd.who.int/icdapi and keep credentials out of source control. Local proxy mode should stay the default for dev/research installs.medbrains-platform
WHO_ICD_CLIENT_SECRETsecret: set in your secret store, never commitmedbrains-platform
WHO_ICD_RELEASE_ID2026-01medbrains-platform
WHO_ICD_TOKEN_URLsecret: set in your secret store, never commitmedbrains-platform
WORKER_DATABASE_URLpostgres://medbrains_outbox_worker:medbrains_dev@localhost:5435/medbrainsThe background workers' pool. They have no request to take a tenant from — the outbox drains one queue for every hospital, and the escalation passes have to find overdue work before they can act on it per tenant — so this names a role thatmedbrains-server