Skip to content

Environment variables

PetHealth is configured entirely with environment variables. With Docker Compose, put them in a .env file next to docker-compose.yml (env_file: .env), or list them under environment:. Restart the container after changing them.

Variable Default Description
JWT_SECRET — Required. Secret used to sign sessions. Generate it with openssl rand -hex 32. The server exits on startup if it’s missing. Changing it signs everyone out.
TZ UTC Server time zone (e.g. Europe/Madrid, America/Bogota). Used for “today” in emails, the calendar feed and backups. The web app uses each browser’s own date for the dashboard.
PORT 3001 Port inside the container. You normally change the host side of the port mapping instead ("8080:3001").
DATA_DIR /app/data Where the database, uploads and backups are stored. Mount a volume here.
NODE_ENV production Set by the image. Leave it as is.
Variable Default Description
ALLOW_REGISTRATION false true shows “Sign up” on the login screen, so anyone who can reach the app can create an account. Turn it on only while your family creates their accounts.
LOGIN_RATE_LIMIT 10 Failed sign-in/sign-up attempts allowed per IP every 15 minutes. 0 disables the limit.
TRUST_PROXY false Set to true when PetHealth is behind a reverse proxy (e.g. for HTTPS on your LAN), so it uses the real client IP for rate limiting and marks cookies Secure over HTTPS. See Remote access & HTTPS.
Variable Default Description
SEED_DEMO true Create four demo pets on the very first start. Has no effect on an existing database.
BACKUP_INTERVAL_HOURS 24 Hours between automatic database snapshots. 0 disables them.
BACKUP_KEEP 7 How many snapshots to keep in data/backups/.
Variable Default Description
SMTP_HOST — SMTP server. Email is turned off when this is empty.
SMTP_PORT 587 SMTP port.
SMTP_SECURE false true for implicit TLS, usually port 465. With false, STARTTLS is used when the server offers it.
SMTP_USER — SMTP username.
SMTP_PASS — SMTP password (for Gmail, an app password).
SMTP_FROM SMTP_USER Sender, e.g. PetHealth <[email protected]>.
NOTIFY_HOUR 8 Local hour (0–23, in TZ) from which the daily digest is sent.
APP_URL — The address you use to open PetHealth (e.g. http://192.168.1.50:3000), used for the “Open PetHealth” button in emails and for links in calendar events. If empty, calendar links use the address the calendar app requested, and emails have no button.
JWT_SECRET=paste-the-output-of-openssl-rand-hex-32
TZ=America/New_York
ALLOW_REGISTRATION=false
APP_URL=http://192.168.1.50:3000
SMTP_HOST=smtp.gmail.com
SMTP_PORT=465
SMTP_SECURE=true
SMTP_PASS=your-app-password
SMTP_FROM=PetHealth <[email protected]>
NOTIFY_HOUR=8

Some things aren’t environment variables because each user sets them in the app, under My account: currency, language, the reminder email address, and the calendar link.