Mosaic📔

Environment Variables

Complete reference for all server configuration options

Environment Variables

The Mosaic server is configured through environment variables. Copy the example file, edit it, then start the server from server-go/:

cp server-go/.env.example server-go/.env
cd server-go && go run ./cmd/mosaic-server

The server loads .env from its working directory and refuses to start when a required variable is missing.

Required

VariableDescriptionExample
DATABASE_URLPostgreSQL connection string (with ?sslmode=disable for local)postgres://mosaic:mosaic@localhost:5432/mosaic
JWT_SECRETSecret key for signing JWT tokensyour-super-secret-jwt-key-change-in-production
ADMIN_PASSWORDPassword for the bootstrap admin account. No default; must be setchange-me-in-production

Server

VariableDefaultDescription
PORT8080HTTP server listen port
ADMIN_USERNAMEadminBootstrap admin account username
MIGRATIONS_DIR./migrationsDirectory the server reads SQL migrations from
ALLOWED_ORIGINS(empty)Comma-separated CORS origins. Empty allows any origin and is for development only

Storage

VariableDefaultDescription
STORAGE_TYPElocalStorage backend: local or r2
LOCAL_STORAGE_PATH./storageDirectory for local file storage
FFMPEG_BINARYffmpegFFmpeg binary path for video processing

Cloudflare R2 (when STORAGE_TYPE=r2)

VariableDescription
R2_ENDPOINTR2 endpoint URL
R2_BUCKETR2 bucket name
R2_ACCESS_KEY_IDR2 access key ID
R2_SECRET_ACCESS_KEYR2 secret access key

AI

VariableDefaultDescription
HTML2LLM_URLhttps://html2llm.cyncyn.xyzExternal service for HTML-to-markdown conversion used in LLM processing

Docker Compose

When using Docker Compose, the POSTGRES_PASSWORD is also needed for the PostgreSQL service. JWT_SECRET and ADMIN_PASSWORD must be set too — the Compose file refuses to start without them:

Use server/docker-compose.yml with the configuration above. It sets the container database URL, waits for PostgreSQL, and mounts persistent data. See Server Deployment.

On this page