Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/bentlyy/Clinica/llms.txt

Use this file to discover all available pages before exploring further.

Clinica reads all runtime configuration from environment variables. When running locally with Docker Compose, these values come from the .env file in the project root, which the api service loads automatically via its env_file directive. In production, set these variables in your deployment environment directly — never commit real secrets to source control.

Database connection

Clinica uses a single DATABASE_URL connection string. The pg library’s Pool reads this string directly; there are no individual host, port, or user variables.
VariableRequiredExampleDescription
DATABASE_URLYespostgresql://postgres:postgres@db:5432/clinicFull PostgreSQL connection string. In the Docker Compose setup, the hostname is db (the service name). For external databases, replace host, port, user, password, and database name as appropriate.
The default Docker Compose value connects to the bundled postgres:15 service using the postgres superuser and a database named clinic.

Authentication

Clinica signs JWT tokens with a secret you provide. Tokens are issued at login and expire after 24 hours. The auth service reads process.env.JWT_SECRET (uppercase). If that variable is not set, it falls back to the hard-coded string secret123.
VariableRequiredDefaultDescription
JWT_SECRETYessecret123 (insecure fallback)Secret used to sign and verify JWT tokens. Use a long, randomly generated string in any shared environment.
The default .env file uses the key jwt_secret (lowercase), but the auth service reads JWT_SECRET (uppercase). Environment variable names are case-sensitive on Linux. Set JWT_SECRET (uppercase) in your .env to ensure it is picked up correctly.
JWT tokens include the user’s id, email, and role as claims. Role is used by route middleware to enforce access control — for example, only users with role admin can call POST /api/doctors.

Email

Clinica sends appointment reminder emails through Gmail using Nodemailer. The EMAIL_USER and EMAIL_PASS variables configure the sending account. If either variable is missing or incorrect, the reminder job will fail silently — the API and bookings will still work, but patients won’t receive notifications.
VariableRequiredExampleDescription
EMAIL_USERYesclinic@gmail.comGmail address that sends appointment reminders. The from field in outgoing emails is set to "Clinic App" <EMAIL_USER>.
EMAIL_PASSYes(your app password)Password for the Gmail account. If you have 2-step verification enabled, generate a Gmail App Password instead of using your account password.

Server

VariableRequiredDefaultDescription
PORTNo3000Port the Express API listens on. The Docker Compose configuration maps this port to the host, so changing it here requires a matching update to the ports entry in docker-compose.yml.

Complete .env example

# Database
DATABASE_URL=postgresql://postgres:postgres@db:5432/clinic

# Server
PORT=3000

# Authentication — use uppercase JWT_SECRET
JWT_SECRET=change-this-to-a-long-random-string

# Email
EMAIL_USER=your_email@example.com
EMAIL_PASS=your_email_password
Never commit real credentials to source control. Add .env to your .gitignore and use a secrets manager or your deployment platform’s environment variable settings for production values.

Build docs developers (and LLMs) love