This document provides a comprehensive reference for all environment variables used to configure Sim Studio. Environment variables control database connections, authentication, AI provider integrations, storage backends, feature flags, and deployment settings.
For deployment-specific configuration examples, see 1.2. Deployment Options For runtime configuration and feature toggles, see 9.3. Feature Flags & Runtime Config
Sim Studio uses environment variables for configuration through a strict validation system based on @t3-oss/env-nextjs. All environment variables are defined and validated in apps/sim/lib/core/config/env.ts, which exports a typed env object used throughout the application.
The system implements a universal getter getEnv that handles context-switching:
next-runtime-env for runtime injection, supporting Docker environment variables without re-builds apps/sim/app/(auth)/login/login-form.tsx18process.env packages/db/index.ts8The following diagram illustrates how environment variables propagate from infrastructure sources to the application runtime.
Environment Variable Propagation
Sources: apps/sim/lib/core/config/env.ts1-18 apps/sim/.env.example1-35 apps/sim/instrumentation-node.ts9
Environment variables are loaded in this precedence order (highest to lowest):
export or Docker).env.local (local overrides, gitignored).env.{NODE_ENV} (e.g., .env.production).env (default base)Sources: apps/sim/.env.example1-35 packages/db/index.ts8-11
These variables must be set for Sim Studio to function. Minimum lengths and formats are enforced by the configuration schema.
| Variable | Type | Description | Generation |
|---|---|---|---|
DATABASE_URL | url | PostgreSQL connection string (must include pgvector) | postgresql://user:pass@host:5432/db |
BETTER_AUTH_SECRET | string | Secret for session signing | openssl rand -hex 32 |
BETTER_AUTH_URL | url | Base URL for authentication service | http://localhost:3000 |
NEXT_PUBLIC_APP_URL | url | Public-facing application URL | http://localhost:3000 |
ENCRYPTION_KEY | string | Key for encrypting environment variables | openssl rand -hex 32 |
INTERNAL_API_SECRET | string | Secret for internal API route encryption | openssl rand -hex 32 |
API_ENCRYPTION_KEY | string | Key for encrypting user API keys | openssl rand -hex 32 |
Sources: apps/sim/.env.example1-22 packages/db/index.ts8-11
The application requires PostgreSQL with the pgvector extension. The connection is managed via postgres-js and drizzle-orm packages/db/index.ts1-13
| Variable | Required | Default | Description |
|---|---|---|---|
DATABASE_URL | Yes | - | Full connection string packages/db/index.ts8 |
POSTGRES_PORT | No | 5432 | Optional port override apps/sim/.env.example5 |
Sources: packages/db/index.ts8-21 apps/sim/.env.example1-6
Sim Studio uses Better Auth for session management. Verification flows are gated by email service availability apps/sim/app/(auth)/verify/use-verification.ts32-36
| Variable | Description |
|---|---|
DISABLE_AUTH | Bypasses auth entirely for private network deployments apps/sim/.env.example12 |
NEXT_PUBLIC_TURNSTILE_SITE_KEY | Cloudflare Turnstile key for signup bot protection apps/sim/app/(auth)/signup/signup-form.tsx97 |
RESEND_API_KEY | Key for Resend email provider; if missing, emails log to console apps/sim/.env.example24-25 |
ADMIN_API_KEY | Enables admin API for GitOps (workflow export/import) apps/sim/.env.example33 |
Sources: apps/sim/app/(auth)/signup/signup-form.tsx97-101 apps/sim/app/(auth)/verify/use-verification.ts162-164 apps/sim/.env.example7-35
The AI execution layer routes requests based on configured API keys. Local models are supported via Ollama or vLLM endpoints.
AI Provider Routing
Sources: apps/sim/.env.example27-30 apps/sim/tools/http/request.ts80-88
| Variable | Default | Description |
|---|---|---|
OLLAMA_URL | http://localhost:11434 | Endpoint for local Ollama server apps/sim/.env.example28 |
VLLM_BASE_URL | http://localhost:8000 | Base URL for self-hosted vLLM (OpenAI-compatible) apps/sim/.env.example29 |
VLLM_API_KEY | - | Optional bearer token for vLLM apps/sim/.env.example30 |
Sources: apps/sim/.env.example27-31
SSO providers (OIDC/SAML) can be registered directly in the database using scripts that consume specific environment variables packages/db/scripts/register-sso-provider.ts12-32
| Variable | Type | Description |
|---|---|---|
SSO_ENABLED | boolean | Master toggle for SSO features |
SSO_PROVIDER_TYPE | oidc | saml | Type of identity provider |
SSO_ISSUER | url | The IdP issuer URL |
SSO_DOMAIN | string | Email domain to map to this provider |
SSO_OIDC_CLIENT_ID | string | Client ID for OIDC |
SSO_SAML_CERT | string | PEM string of the SAML certificate |
Sources: packages/db/scripts/register-sso-provider.ts12-32 packages/db/scripts/register-sso-provider.ts160-224
Sim Studio uses OpenTelemetry for server-side tracing, controlled by the following variables in the instrumentation layer apps/sim/instrumentation-node.ts15-26
| Variable | Default | Description |
|---|---|---|
TELEMETRY_ENDPOINT | https://telemetry.simstudio.ai/v1/traces | OTLP exporter endpoint apps/sim/instrumentation-node.ts16 |
NEXT_TELEMETRY_DISABLED | - | Set to 1 to disable all OTel instrumentation apps/sim/instrumentation-node.ts50 |
NODE_ENV | development | Used to set the deployment.environment resource attribute apps/sim/instrumentation-node.ts121 |
Refresh this wiki