Skip to content
memghost.com Open App

Environment Variables

Backend (Go API)

Core

VariableDefaultDescription
DATABASE_URLpostgres://memghost:memghost@db:5432/memghost?sslmode=disablePostgreSQL connection string
PORT8080HTTP server listen port
JWT_SECRET_KEY(required)Secret key for JWT token signing. Generate with openssl rand -hex 32
DATA_DIR/dataDirectory for onboarding import data files

AI / Embeddings

VariableDefaultDescription
AI_ENABLEDfalseMaster toggle for all AI features
AI_EMBEDDING_PROVIDERollamaEmbedding provider (ollama, openrouter)
AI_EMBEDDING_BASE_URLhttp://ollama:11434Provider API URL for embeddings
AI_EMBEDDING_API_KEY(none)API key (for OpenRouter)
AI_EMBEDDING_MODELnomic-embed-textEmbedding model name
AI_EMBEDDING_DIMENSIONS768Vector dimensions (must match model)
AI_LLM_PROVIDERollamaLLM chat provider (ollama, openrouter, anthropic)
AI_LLM_BASE_URLhttp://ollama:11434Provider API URL for chat
AI_LLM_API_KEY(none)API key (for OpenRouter or Anthropic)
AI_LLM_MODELqwen3:8bChat model name

Text-to-Speech (TTS)

VariableDefaultDescription
AI_TTS_ENABLEDfalseEnable text-to-speech synthesis
AI_TTS_BASE_URLhttp://kokoro:8880Kokoro TTS API URL
AI_TTS_DEFAULT_VOICEaf_heartDefault voice ID (see Voice guide)
AI_TTS_DEFAULT_FORMATmp3Audio format: mp3, wav, opus, flac
AI_TTS_DEFAULT_SPEED1.0Playback speed multiplier
TTS_AUDIO_DIR/tts-audioDirectory for synthesized audio files

Speech-to-Text (STT)

VariableDefaultDescription
AI_STT_ENABLEDfalseEnable speech-to-text transcription
AI_STT_BASE_URLhttp://whisper:8178Whisper STT API URL
AI_STT_MODELwhisper-large-v3-turboWhisper model name
AI_STT_LANGUAGEenDefault transcription language

Sandbox

VariableDefaultDescription
SANDBOX_ENABLEDfalseEnable Deno-based plugin sandbox execution

Optional Integrations

VariableDefaultDescription
OPENFGA_URL(none)OpenFGA authorization service URL
ZIPKIN_URL(none)Zipkin distributed tracing endpoint
OIDC_ENABLEDfalseEnable OpenID Connect authentication
OIDC_ISSUER(none)OIDC issuer URL (e.g., https://accounts.google.com)
OIDC_CLIENT_ID(none)OIDC client ID
OIDC_CLIENT_SECRET(none)OIDC client secret
OIDC_REDIRECT_URI(none)OIDC callback URL
OIDC_DISPLAY_NAME(none)Display name on login page
OIDC_SCOPES(none)Comma-separated OIDC scopes

Frontend (Next.js)

VariableDefaultDescription
NEXT_PUBLIC_API_URL(empty)API base URL for browser requests. Empty means same-origin (proxied by Caddy).
API_INTERNAL_URL(empty)Server-side URL for Next.js to reach the backend (used by API rewrites and the SSE streaming proxy)

In the production compose, Caddy handles all routing so these frontend variables are typically left empty (the defaults work correctly).

Database (PostgreSQL)

These are set on the db service in Docker Compose:

VariableDefaultDescription
POSTGRES_USERmemghostDatabase user
POSTGRES_PASSWORDmemghostDatabase password (override with DB_PASSWORD in .env)
POSTGRES_DBmemghostDatabase name

Docker Compose Environment

VariableDefaultDescription
DB_PASSWORDmemghostDatabase password (used in connection strings)
JWT_SECRET_KEYchange-me-in-productionJWT signing key
SITE_ADDRESSlocalhostCaddy site address (domain or IP)
PORT80Host HTTP port
HTTPS_PORT443Host HTTPS port

Using a .env File

Create a .env file next to your docker-compose.yml to override defaults:

.env
DB_PASSWORD=my-secure-password
JWT_SECRET_KEY=64-char-hex-string
SITE_ADDRESS=home.example.com
AI_ENABLED=true
AI_TTS_ENABLED=true
AI_STT_ENABLED=true

Docker Compose automatically reads .env from the same directory as the compose file.