Skip to content

Server Configuration

The backend loads its configuration with app-config. Every setting can come from a file or from an environment variable.

The backend reads these files from backend/:

  1. .app-config.json maps each setting to an environment variable and gives its fallback. For example, port reads PORT and falls back to 50051.
  2. .app-config.<environment>.yaml overrides settings for one environment. .app-config.development.yaml sets up local development: the state directory, the dev Meilisearch key and the dev LiveKit keys.
  3. .app-config.schema.yaml describes every setting. app-config refuses to start the server when the loaded values don’t match it.

The generated backend configuration reference lists every setting.

Some settings default to paths inside the state directory (STATE_DIR, or $XDG_STATE_HOME/mzchat when it is unset):

  • databaseUrl defaults to file:<state dir>/backend.db.
  • jwtSecret defaults to the contents of <state dir>/jwt.secret. The backend generates that file on first start. Deleting it logs every user out.
  • meiliDbPath defaults to <state dir>/meilisearch.

Optional services stay off until they are configured:

  • Search needs MEILI_URL.
  • Voice calls need LIVEKIT_API_KEY and LIVEKIT_API_SECRET.
  • S3 uploads need S3_ENDPOINT, S3_ACCESS_KEY and S3_SECRET_KEY. Without S3, uploads go to UPLOADS_PATH.
  • The IRC bridge needs IRC_ENABLE=true.
Terminal window
export PORT=50059
export STATE_DIR=/var/lib/mzchat
export CANONICAL_ADDRESS=https://chat.example.com
bun run src/main.ts serve