.env

Use this file to configure the AFFiNE revision, public server URL, persistent storage locations, and database credentials for Docker Compose deployments.

Set persistent paths and credentials before the first start. Changing these values after data exists can require a backup-and-restore workflow.

# Select a revision to deploy. Available values: stable, beta, canary.
AFFINE_REVISION=stable

# Set the host port that maps to the AFFiNE server container.
PORT=3010

# Set the public server URL used for outgoing links.
# AFFINE_SERVER_HTTPS=true
# AFFINE_SERVER_HOST=affine.yourdomain.com
# or
# AFFINE_SERVER_EXTERNAL_URL=https://affine.yourdomain.com

# Location of the database data to persist.
DB_DATA_LOCATION=~/.affine/self-host/postgres/pgdata

# Location of uploaded blobs, such as images and files, to persist.
UPLOAD_LOCATION=~/.affine/self-host/storage

# Location of configuration files to persist.
CONFIG_LOCATION=~/.affine/self-host/config

# Database credentials.
# Generate a strong password, for example with: openssl rand -base64 32
DB_USERNAME=affine
DB_PASSWORD=paste-your-generated-password-here
DB_DATABASE=affine

For production, set a unique strong DB_PASSWORD before running docker compose up -d for the first time.