BrainDocs

Environment variables

Required and optional environment variables for Brain.

See .env.example in the repository for the full commented list.

Required

VariablePurpose
BRAIN_DATABASE_URLPostgres URL (DATABASE_URL also accepted)
BETTER_AUTH_SECRETSession signing (openssl rand -base64 32)
COMMAND_CODE_API_KEYCommand Code models (omit only if you rely solely on custom models)

Production / public origin

VariablePurpose
BRAIN_PUBLIC_URLPublic origin (cookies, OAuth redirects, SEO)
BETTER_AUTH_URLUsually the same as BRAIN_PUBLIC_URL
BRAIN_BOOTSTRAP_TOKENRequired to create the first operator in production
PORTNext listen port (default 3000)
EVE_NEXT_PRODUCTION_PORTeve loopback port in production start (default 4274)

Schedules

VariablePurpose
BRAIN_INTERNAL_TOKENBearer between eve ↔ Next for scheduled runs
BRAIN_INTERNAL_URLNext origin for due-sweep (default http://127.0.0.1:3000)
BRAIN_OPERATOR_USER_IDOptional host operator for briefs (defaults to first user)
EVE_BASE_URL / BRAIN_EVE_URLOptional direct eve HTTP host for server-side runs

Email (optional)

VariablePurpose
BRAIN_EMAIL_FROMFrom header for invites / reset mail
BRAIN_SMTP_URLPrefer a single SMTP URL
BRAIN_SMTP_HOST / PORT / SECURE / USER / PASSDiscrete SMTP fields

License

VariablePurpose
BRAIN_LICENSE_SECRETSigns/verifies BRAIN1 keys (falls back to BETTER_AUTH_SECRET)

Sandbox (attached repo)

Brain pins microsandbox for Agent coding. There is no Brain-specific sandbox API key in .env.example. Hosts may need the microsandbox platform install or MSB_PATH pointing at the binary — see Attached repo.

MCP fallbacks (optional)

Prefer Tools → Set up / Menu Connect. Env remains deploy-time fallback:

AppsVariables
SlackSLACK_MCP_CLIENT_ID, SLACK_MCP_CLIENT_SECRET
Slack inbound (Events / HITL)SLACK_BOT_TOKEN, SLACK_SIGNING_SECRET, optional SLACK_INBOUND_CHANNEL_IDS
AsanaASANA_MCP_CLIENT_ID, ASANA_MCP_CLIENT_SECRET
GmailGOOGLE_MCP_CLIENT_ID, GOOGLE_MCP_CLIENT_SECRET
GitHubGITHUB_MCP_CLIENT_ID, GITHUB_MCP_CLIENT_SECRET
SnowflakeSNOWFLAKE_MCP_SERVER_URL, SNOWFLAKE_PAT_TOKEN
MongoDBMONGODB_MCP_URL, MONGODB_MCP_TOKEN
MCP ToolboxTOOLBOX_MCP_URL, TOOLBOX_MCP_TOKEN
RybbitRYBBIT_MCP_URL, RYBBIT_MCP_TOKEN
BytebotBYTEBOT_MCP_URL, BYTEBOT_MCP_TOKEN

DCR apps (ClickUp, Notion, Linear, Atlassian, Zernio, Sentry, dFlow) do not need client id/secret env vars.

Security notes

  • Treat the host as trusted: MCP tokens live under .eve/
  • Use strong secrets for BETTER_AUTH_SECRET, BRAIN_BOOTSTRAP_TOKEN, and BRAIN_INTERNAL_TOKEN
  • Prefer private network + SSL for Postgres (?sslmode=require when required)
  • Keep BRAIN_PUBLIC_URL accurate behind reverse proxies so OAuth callbacks stay correct
  • Vitest uses BRAIN_TEST_DATABASE_URL / brain_test — never your operator DB