This page lists all environment variables used to configure the ReArch backend, frontend, and supporting services. Variables are grouped by function.
Variable Default Description MONGODB_URImongodb://localhost:27017/rearchMongoDB connection string. PORT5000HTTP port the backend listens on. DATA_PATH./dataLocal path for temporary file storage. LOG_LEVEL— Logging verbosity.
Variable Default Description AUTH_MODELOCALAuthentication mode. One of LOCAL, OAUTH, KEYCLOAK_FIREWALL, or NONE. JWT_SECRET— Required. Secret key for signing JWT tokens. Use a strong random string (at least 32 characters).JWT_EXPIRY24hJWT token lifetime. Accepts values like 1h, 24h, 7d. ADMIN_EMAILadmin@example.comEmail for the bootstrap admin user. Created on first startup if no users exist. ADMIN_PASSWORD— Password for the bootstrap admin user. Required in LOCAL mode.
Variable Default Description OAUTH_CLIENT_ID— OIDC client ID from your identity provider. OAUTH_CLIENT_SECRET— OIDC client secret. OAUTH_REDIRECT_URI— Callback URL where the provider redirects after login (e.g., https://app.example.com/auth/callback). OAUTH_ISSUER_URL— OIDC issuer URL. Used to discover the .well-known/openid-configuration endpoint.
No additional variables are required. All requests are granted full admin access without credentials.
Variable Default Description KEYCLOAK_REALM_URL— Full URL to the Keycloak realm (e.g., https://auth.example.com/realms/rearch). KEYCLOAK_CLIENT_ID— Backend client ID in Keycloak (confidential client). KEYCLOAK_CLIENT_SECRET— Backend client secret from the Keycloak admin console.
Variable Default Description DOCKER_NETWORK— Overlay network name for container routing. Used in Swarm mode. APP_DOMAIN— Base domain for dynamic subdomain routing of conversation containers. FRONTEND_URL— Public URL of the frontend. Used for CORS and redirect configuration. CONVERSATION_CONTAINER_IMAGE— Default Docker image for conversation containers.
Configure Redis using either a URL or individual parameters:
Variable Default Description REDIS_URLredis://localhost:6379Redis connection URL. Takes precedence over individual parameters. REDIS_HOSTlocalhostRedis hostname. Used when REDIS_URL is not set. REDIS_PORT6379Redis port. REDIS_PASSWORD— Redis password. REDIS_TLSfalseEnable TLS for Redis connections.
Variable Default Description ENCRYPTION_KEY— 64-character hex string (32 bytes) for AES-256-GCM encryption of API keys stored in the database. Generate with: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))". Falls back to deriving a key from JWT_SECRET if not set.
Variable Default Description RATE_LIMIT_AUTH_MAX10Maximum login/register requests per window per IP. RATE_LIMIT_AUTH_WINDOW_MS900000Rate limit window duration in milliseconds (default: 15 minutes).
Variable Default Description MCP_PROXY_URLhttp://localhost:3100URL of the MCP proxy service. The backend uses this for health checks and reload commands. MCP_PROXY_SECRET— Shared secret for container-to-proxy authentication. Leave empty to disable authentication (development only).
Variable Default Description MCP_PROXY_PORT3100Port the proxy HTTP server listens on. MCP_PROXY_SECRET— Shared secret for request authentication via X-MCP-Secret header. MONGODB_URImongodb://localhost:27017/rearchMongoDB connection string for reading MCP server configurations.
These variables are used in the docker-compose-traefik.yml file for production deployments:
Variable Description DOMAINBase domain. Subdomains are derived: app.<DOMAIN>, api.<DOMAIN>, auth.<DOMAIN>. JWT_SECRETJWT signing key for the backend. JWT_EXPIRYJWT token lifetime. ADMIN_EMAILBootstrap admin email. ADMIN_PASSWORDBootstrap admin password. KEYCLOAK_ADMINKeycloak admin console username. KEYCLOAK_ADMIN_PASSWORDKeycloak admin console password. KEYCLOAK_DB_PASSWORDPostgreSQL password for the Keycloak database. KEYCLOAK_BACKEND_CLIENT_SECRETClient secret for the rearch-backend Keycloak client. OAUTH2_PROXY_CLIENT_SECRETClient secret for the rearch-proxy Keycloak client. OAUTH2_PROXY_COOKIE_SECRETRandom 32-byte base64-encoded string for cookie encryption. Generate with: openssl rand -base64 32 | tr -- '+/' '-_' CONVERSATION_CONTAINER_IMAGEDocker image used for conversation containers. MCP_PROXY_SECRETShared secret for MCP proxy authentication.
The frontend is a static SPA served by nginx. Runtime configuration is injected at container startup via window.__RUNTIME_CONFIG__:
Variable Default Description VITE_API_URL/apiBackend API URL. VITE_SOCKET_URL— WebSocket URL for real-time events. VITE_KEYCLOAK_URL— Keycloak base URL (only when using Keycloak auth). VITE_KEYCLOAK_REALM— Keycloak realm name. VITE_KEYCLOAK_CLIENT_ID— Keycloak public client ID for the frontend SPA.
Use these commands to generate the secrets required by ReArch:
# JWT secret, Keycloak passwords, MCP proxy secret
# OAuth2 Proxy cookie secret (URL-safe)
openssl rand -base64 32 | tr -- ' +/ ' ' -_ '
# Encryption key for LLM API keys (64-char hex)
node -e " console.log(require('crypto').randomBytes(32).toString('hex')) "