Self-Hosting

Environment Variables

Complete reference of environment variables for configuring Appstrate.

Every variable below is defined in packages/env/src/index.ts with strict Zod validation. Required vars throw at boot if missing.

Core

VariableRequiredDefaultDescription
NODE_ENVNodevelopmentdevelopment | production | test
PORTNo3000Server port
APP_URLNohttp://localhost:3000Public URL for OAuth callbacks. Must be HTTPS when NODE_ENV=production
TRUSTED_ORIGINSNohttp://localhost:3000,http://localhost:5173CORS origins, comma-separated
TRUST_PROXYNofalsefalse | true | number of trusted reverse-proxy hops (X-Forwarded-For)
COOKIE_DOMAINNoCross-subdomain session cookies
LOG_LEVELNoinfodebug | info | warn | error

Auth and Crypto

VariableRequiredDefaultDescription
BETTER_AUTH_SECRETYesSession signing secret
UPLOAD_SIGNING_SECRETYesMin 16 chars. Signs file-upload tokens (separate from BETTER_AUTH_SECRET so it can rotate independently)
CONNECTION_ENCRYPTION_KEYYes32 bytes, base64. Encrypts stored credentials
RUN_TOKEN_SECRETNoSigns run tokens issued to sidecars. Tokens are unsigned if absent
GOOGLE_CLIENT_IDNoEnables Google sign-in. Paired with GOOGLE_CLIENT_SECRET
GOOGLE_CLIENT_SECRETNoGoogle OAuth secret
GITHUB_CLIENT_IDNoEnables GitHub sign-in. Paired with GITHUB_CLIENT_SECRET
GITHUB_CLIENT_SECRETNoGitHub OAuth secret

Generate the required secrets with:

openssl rand -base64 32

Database

VariableRequiredDefaultDescription
DATABASE_URLNoPostgreSQL URL. Falls back to PGlite if absent
PGLITE_DATA_DIRNo./data/pglitePGlite data directory

Redis

VariableRequiredDefaultDescription
REDIS_URLNoRedis URL. Falls back to in-process adapters: LocalQueue (cron evaluator), LocalPubSub (EventEmitter), RateLimiterMemory

Storage (S3)

VariableRequiredDefaultDescription
S3_BUCKETNoS3 bucket name. Absent = filesystem storage
S3_REGIONConditionalRequired when S3_BUCKET is set
S3_ENDPOINTNoCustom S3 endpoint (MinIO, R2, etc.)
S3_PUBLIC_ENDPOINTNoS3_ENDPOINTBrowser-facing URL for presigned URLs. Falls back to S3_ENDPOINT
FS_STORAGE_PATHNo./data/storageFilesystem fallback path when S3 is not configured

Run Execution (Docker)

VariableRequiredDefaultDescription
RUN_ADAPTERNoprocessdocker or process. Docker is required for credential isolation
DOCKER_SOCKETNo/var/run/docker.sockPath to the Docker socket
SIDECAR_POOL_SIZENo2Pre-warmed sidecar containers ready to accept runs. 0 disables the pool
PI_IMAGENoappstrate-pi:latestAgent runtime Docker image
SIDECAR_IMAGENoappstrate-sidecar:latestSidecar proxy Docker image
PLATFORM_API_URLNoauto-detectedHow the sidecar reaches the platform. Defaults to http://host.docker.internal:{PORT}

Modules

VariableRequiredDefaultDescription
MODULESNooidc,webhooksComma-separated module list. Set to empty to disable. External npm packages supported
OIDC_INSTANCE_CLIENTSNo"[]"JSON array of instance-level OIDC OAuth clients (used by satellite dashboards)

Run Limits

Both variables accept any JSON object at the env layer; keys are strictly validated at boot by apps/api/src/services/run-limits.ts. See Rate Limits for the full semantics.

VariableDefaultDescription
PLATFORM_RUN_LIMITS"{}"Caps every run (classic + inline + scheduled). Keys: timeout_ceiling_seconds (default 1800), per_org_global_rate_per_min (default 200), max_concurrent_per_org (default 50)
INLINE_RUN_LIMITS"{}"Caps POST /api/runs/inline. Keys: rate_per_min (default 60), manifest_bytes (65536), prompt_bytes (200000), max_skills (20), max_tools (20), max_authorized_uris (50), wildcard_uri_allowed (false), retention_days (30)

Email (SMTP)

The five SMTP variables are individually optional at the schema level. When you enable email (verification, invitations), the mail service validates at boot that the full set is present — leaving any one out disables the feature without failing the boot.

VariableRequiredDefaultDescription
SMTP_HOSTNo (required for email)SMTP host
SMTP_PORTNo587SMTP port
SMTP_USERNo (required for email)SMTP username
SMTP_PASSNo (required for email)SMTP password
SMTP_FROMNo (required for email)Sender email address

Proxy and System Providers

VariableRequiredDefaultDescription
SYSTEM_PROXIESNo"[]"JSON array of system-wide HTTP proxies selectable per-run
PROXY_URLNoOutbound HTTP proxy for sidecar containers
SYSTEM_PROVIDER_KEYSNo"[]"JSON array of built-in LLM providers (id, label, api, baseUrl, apiKey, models[])
VariableRequiredDefaultDescription
LEGAL_TERMS_URLNoTerms of service URL shown in the UI footer
LEGAL_PRIVACY_URLNoPrivacy policy URL shown in the UI footer

On this page