Environment Variables
Environment Variables
Section titled “Environment Variables”The backend reads its configuration from environment variables. A .env file
is optional — loading is done through godotenv and every variable has a
safe default for local development.
The reference template lives at backend/.env.example:
# ServerPORT=8080DATABASE_URL=postgres://kazier:kazier@localhost:5432/kazier_dev?sslmode=disableUPLOAD_DIR=./uploadsMAX_FILE_SIZE_MB=50OCR_LANG=fra+eng
# Security — change in production (never commit)AUTH_SECRET=dev-secret-change-me
# First admin (created only if the users table is empty)ADMIN_USERNAME=adminADMIN_PASSWORD=change-meReference
Section titled “Reference”| Variable | Default | Description |
|---|---|---|
PORT | 8080 | HTTP listening port. |
DATABASE_URL | postgres://kazier:kazier@localhost:5432/kazier_dev?sslmode=disable | PostgreSQL connection URL (lib/pq). |
UPLOAD_DIR | ./uploads | Directory where uploaded physical files are stored as <UPLOAD_DIR>/<user_id>/<resource_id>.<ext>. |
MAX_FILE_SIZE_MB | 50 | Maximum upload size in MB. Exceeding it returns FILE_TOO_LARGE (HTTP 413). |
OCR_LANG | fra+eng | Tesseract language list for OCR jobs (+-separated). |
AUTH_SECRET | dev-secret-change-me | Signing secret for PASETO v4-local tokens. Must be random and secret in production. |
ADMIN_USERNAME | — | Username of the bootstrap admin. Required on first start if the users table is empty. |
ADMIN_PASSWORD | — | Password of the bootstrap admin. Required on first start. |
Bootstrap admin
Section titled “Bootstrap admin”The first admin is created only when the users table is empty. If the
user table is empty and ADMIN_USERNAME or ADMIN_PASSWORD is missing, the
server refuses to start.
The environment never overwrites an existing account — admin credentials are ignored on subsequent starts.
Production checklist
Section titled “Production checklist”- Set a strong random
AUTH_SECRET(e.g.openssl rand -hex 32). - Change
ADMIN_PASSWORD. - Use a dedicated PostgreSQL user/password (not
kazier/kazier). - Use a
DATABASE_URLwith real credentials and an external database if needed. - Back up
UPLOAD_DIRand the database. - Never commit a
.envfile (reference:backend/.env.example).