.env is read by pydantic-settings. Empty values are treated as unset and fall back to defaults. Required vars raise at process boot if missing. backend/env_example mirrors the tables below.
AUTH_PROVIDER selects the auth backend. Both share one contract: Authorization: Bearer <token>. hanko (production) validates a per-user JWT issued by Hanko (sent via Bearer header or hanko cookie). dev (local only) compares the Bearer token against the static FAIR_DEV_TOKEN; anyone with the token gets full dev-user access.
With AUTH_PROVIDER=hanko, the hotosm_auth library reads the cookie, JWT and OSM variables straight from the environment. This backend reads LOGIN_URL, LOGIN_INTERNAL_API_KEY and LOGIN_BACKEND_URL, and checks HANKO_API_URL, COOKIE_SECRET, COOKIE_DOMAIN, COOKIE_SECURE, JWT_AUDIENCE and OSM_REDIRECT_URI at startup.
Name
Required
Default
Description
AUTH_PROVIDER
no
hanko
One of hanko, dev.
FAIR_DEV_TOKEN
when AUTH_PROVIDER=dev
null
Static dev token. Generate with openssl rand -hex 32. Never commit. Compose builds it into the UI, which signs in with it, so anyone who can open the UI can read it.
HANKO_API_URL
when AUTH_PROVIDER=hanko
null
Hanko backend URL.
COOKIE_SECRET
when AUTH_PROVIDER=hanko
null
Used to verify Hanko-signed cookies. At least 32 characters.
COOKIE_DOMAIN
no
inferred from HANKO_API_URL
Cookie scope domain. Inferred as the last two host labels, or localhost.
COOKIE_SECURE
no
true when HANKO_API_URL is https
Secure cookie flag. Only true turns it on.
JWT_AUDIENCE
no
null
Expected aud claim.
LOGIN_URL
no
https://login.hotosm.org
HOT login portal URL.
LOGIN_INTERNAL_API_KEY
no
null
Server-to-server key against the login portal.
LOGIN_BACKEND_URL
no
null
Login portal backend URL.
OSM_REDIRECT_URI
no
{HANKO_API_URL}/auth/osm/callback
OSM OAuth callback for the connect-OSM-account flow. Set it when the app path differs from the default.
COOKIE_SAMESITE
no
lax
SameSite flag of the auth cookie.
JWT_ISSUER
no
auto
Expected iss claim. auto means HANKO_API_URL.
OSM_CLIENT_ID
no
null
OSM OAuth client. Setting it with OSM_CLIENT_SECRET turns the connect-OSM-account flow on.
OSM_CLIENT_SECRET
no
null
Secret of the OSM OAuth client.
OSM_SCOPES
no
read_prefs
Space-separated OSM OAuth scopes.
OSM_API_URL
no
https://www.openstreetmap.org
OSM API root.
ADMIN_EMAILS
no
""
Comma-separated Hanko emails allowed to use the /api/admin/ user-mapping routes.
FAIR_* values are read by this backend. The ZENML_STORE_* values are read by
the zenml library itself when it opens a connection, so both sets point at the
same server.
Name
Required
Default
Description
FAIR_ZENML_STORE_URL
yes
(none)
URL of the deployed ZenML server.
FAIR_STAC_API_URL
yes
(none)
URL of the STAC API root (eoapi-stac-fastapi). Trailing slashes are stripped.
FAIR_STAC_API_KEY
prod
null
Bearer token for the STAC Transactions extension.
FAIR_STAC_DSN
prod
null
pgstac Postgres DSN. When set, STAC writes go to pgstac directly, so the API can be read-only.
ZENML_STORE_URL
yes (at runtime)
null
Same server as FAIR_ZENML_STORE_URL.
ZENML_STORE_API_KEY
one of the two
null
Service-account key. Mint with zenml service-account create fair-backend.
ZENML_STORE_USERNAME
one of the two
null
Username, paired with ZENML_STORE_PASSWORD. The compose stack's default user is default with an empty password.
Seconds each HTTP probe waits before marking a dependency unreachable in GET /api/v1/health/.
PREDICTION_SYNC_INTERVAL
no
15
Seconds between prediction-status poll re-enqueues.
DELETE_PREDICTION_INPUT_TILES
no
true
When true, deletes a map request's staged input tiles from object storage once its run ends or its submission fails.
MAP_REQUEST_MAX_AREA_SQKM
no
5000
Largest map request area in km²; a larger one is rejected with HTTP 400. Keep it equal to the frontend's VITE_MAP_LARGE_AREA_MAX_SIZE_SQKM.
TRAINING_SYNC_INTERVAL
no
30
Seconds between training-status poll re-enqueues.
STAC_CACHE_TTL
no
300
Seconds the shared cache holds a STAC item before re-fetching. Raise in prod for lower STAC load; lower in dev to see property changes faster.
STAC_BULK_FETCH_WORKERS
no
16
Thread pool size for parallel STAC item fetches when ?expand=stac is used on list endpoints.
PMTILES_MIN_ZOOM
no
10
Min zoom passed to tippecanoe for PMTiles generation.
PMTILES_MAX_ZOOM
no
20
Max zoom passed to tippecanoe for PMTiles generation.
VALIDATION_REFRESH_INTERVAL
no
300
Seconds between rewrites of a published validation project's done.bin and results.parquet.
VALIDATION_BUILD_TIMEOUT
no
3600
Seconds a validation build may stay building before the next GET /validation/projects/{slug}/ queues it again. That discards the result of a build still running, so set it above the longest build.
The frontend reads VITE_* variables at build time and from config.js at container start; the runtime value wins. frontend/.env.sample describes each one. Restart the Vite dev server, or the container and the api service that serves config.js, after a change.