Clinica uses a role-based access model to control what each type of user can see and do. Every account has aDocumentation 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.
role field stored in the users table. That role is embedded in the JWT issued at login, and the API enforces permissions on every protected route before a request reaches its handler.
The three roles
| Role | Value in DB | Who creates the account | Purpose |
|---|---|---|---|
| Admin | admin | Seeded automatically on startup | Manages doctors and clinic configuration |
| Doctor | doctor | Created by an admin via POST /api/doctors | Manages availability and views appointments |
| Patient | user | Self-registers via POST /api/auth/register | Books, views, and cancels appointments |
The patient role is stored as
user in the database, not patient. This is the default value assigned to all self-registered accounts.How role enforcement works
Every protected route runs two middlewares in sequence:authMiddleware— verifies the JWT and attaches the decoded user (including theirrole) toreq.user.authorizeRoles(...roles)— checks thatreq.user.roleis in the list of allowed roles.
401 Unauthorized. If the token is valid but the role is insufficient, the API returns 403 Forbidden.
Endpoint access by role
Admin
GET /api/doctors— list all doctorsPOST /api/doctors— create a doctor profile
Doctor
GET /api/doctors/me— own profilePOST /api/availability— set availabilityGET /api/availability/me— own scheduleDELETE /api/availability/:id— remove a slotGET /api/bookings/doctor— view appointments
Patient (`user`)
GET /api/doctors/public— browse doctors (no auth)GET /api/bookings/available-slots— check open slotsPOST /api/bookings— book an appointmentGET /api/bookings/me— view own bookingsDELETE /api/bookings/:id— cancel a booking
Next steps
Admin role
Seeding, credentials, and managing doctors
Doctor role
Availability management and appointment access
Patient role
Registration, booking, and cancellation workflow