Skip to content

Environment variables

Marrow has two .env files: one for the FastAPI backend (api/.env) and one for the Next.js frontend (web/.env.local). When deploying with docker-compose.prod.yml, both are sourced from a single root .env (see .env.prod.example).

VariableDefaultDescription
DATABASE_URLPostgreSQL connection string. Example: postgresql://marrow:marrow@localhost:5433/marrow.
SECRET_KEYSigning key for the session JWT. Use a long random string in production (e.g. openssl rand -hex 32).
VariableDefaultDescription
STORAGE_PATH./storageDirectory where attachments are stored. Relative paths resolve from api/. Inside the API container, this is /data/storage and is backed by a Docker volume.

Marrow checks auth in priority order: OIDC session cookie → X-API-Key header → anonymous. If neither OIDC nor API_KEY is set, all requests are allowed — fine for dev, never for prod.

VariableDefaultDescription
API_KEYunsetStatic key for X-API-Key header. Bypasses RBAC (superuser equivalent). Used by the CLI and scripts.
CORS_ORIGINShttp://localhost:3000Comma-separated list of allowed origins.

Set OIDC_ISSUER to enable. All other OIDC vars are required when enabled.

VariableDescription
OIDC_ISSUEROIDC discovery URL, e.g. https://accounts.google.com.
OIDC_CLIENT_IDClient ID from your IdP.
OIDC_CLIENT_SECRETClient secret from your IdP.
OIDC_REDIRECT_URIWhere the IdP redirects after login. Must match what’s registered. Example: http://localhost:8000/api/auth/callback.
FRONTEND_URLBase URL of the web app. Used as the post-login redirect target.
COOKIE_DOMAINDomain for the marrow_session cookie. For dev: localhost. For prod with split subdomains: .marrow.so.

See OIDC for setup walkthroughs.

Frontend (web/.env.local for dev, container env for prod)

Section titled “Frontend (web/.env.local for dev, container env for prod)”

These are read at runtime, not build time. The container generates a small /config.js file from these env vars at startup, so the same prebuilt image works in any deployment without rebuilding.

VariableDefaultDescription
MARROW_API_URLhttp://localhost:8000URL the browser uses to reach the API. Must be reachable from end-user browsers.
MARROW_API_KEYunsetIf API_KEY is set on the backend, set this to match.
MARROW_OIDC_ENABLEDunsetSet to true when OIDC is configured on the backend. Enables the /login route and route-protection middleware.
INTERNAL_API_URLsame as MARROW_API_URLURL Next.js uses for SSR fetches inside the Docker network. Set to http://api:8000 in the prod compose file.

When using docker-compose.prod.yml, both files are replaced by a single root .env. Additional vars used only by the Compose file:

VariableDefaultDescription
MARROW_VERSIONlatestImage tag pulled from GHCR.
POSTGRES_USERmarrowPostgres username.
POSTGRES_DBmarrowPostgres database name.
POSTGRES_PASSWORDRequired. Postgres password.
API_PORT8000Host port the API binds to.
WEB_PORT3000Host port the web binds to.