# imenzaalani/dentify architecture

> Architecture diagram of the GitHub repository imenzaalani/dentify, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/imenzaalani/dentify
- Repository: https://github.com/imenzaalani/dentify

## Overview

Dentify is a dental-clinic management application: patients can request appointments and use a portal, while staff manage scheduling, clinical records, billing, documents, and operations. The main workflow runs from public booking or staff scheduling through the FastAPI API into domain records stored in PostgreSQL, with email notifications as a side effect. The sampled source establishes API routing, appointment persistence, authentication, and a frontend patient-detail component; other product branches are represented from the repository tree, so their internal calls are not inferred.

Main entry points: [`backend/app/api/v1`](https://github.com/imenzaalani/dentify/tree/main/backend/app/api/v1) (Domain endpoints), [`backend/app/api/v1/appointments.py`](https://github.com/imenzaalani/dentify/blob/main/backend/app/api/v1/appointments.py) (Appointment operations), [`backend/app/api/v1/auth.py`](https://github.com/imenzaalani/dentify/blob/main/backend/app/api/v1/auth.py) (Authentication API), [`frontend/src/lib/api/client.ts`](https://github.com/imenzaalani/dentify/blob/main/frontend/src/lib/api/client.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public and portal"]
  node_publicbooking["Public booking<br/>[page.tsx]"]
  node_patientportal["Patient portal<br/>[page.tsx]"]
  node_frontendproxy["Backend proxy<br/>[route.ts]"]
  node_api_client["API client<br/>[client.ts]"]
end

subgraph group_staff["Staff operations"]
  node_staffui["Staff workspace<br/>[page.tsx]"]
  node_planning["Scheduling and waitlist"]
  node_clinical["Clinical care"]
  node_billing["Billing<br/>[data-table.tsx]"]
  node_documents["Documents"]
  node_leads["Lead intake"]
  node_analytics["Reports and statistics"]
  node_chat["Clinic messaging"]
end

subgraph group_api["Backend API"]
  node_api["REST API<br/>[main.py]"]
  node_appointments["Appointment operations<br/>[appointments.py]"]
  node_authapi["Authentication API<br/>[auth.py]"]
  node_domainroutes["Domain endpoints"]
end

subgraph group_data["Domain and persistence"]
  node_patients["Patient records<br/>[patient.py]"]
  node_appointmentrecords["Appointment records<br/>[appointment.py]"]
  node_users["User accounts<br/>[user.py]"]
  node_database[("PostgreSQL database<br/>[database.py]")]
end

subgraph group_platform["Identity and services"]
  node_security["Tokens and access<br/>[security.py]"]
  node_permissions["Role permissions<br/>[permissions.py]"]
  node_email["Email notifications<br/>[email.py]"]
end

node_visitor(("Patient or visitor"))
node_smtp(("SMTP provider"))

node_visitor -->|"requests booking"| node_publicbooking
node_visitor -.->|"uses portal"| node_patientportal
node_visitor -.->|"staff uses"| node_staffui
node_publicbooking -.->|"submits request"| node_api_client
node_patientportal -.->|"loads records"| node_api_client
node_staffui -.->|"loads patient data"| node_api_client
node_api_client -.->|"sends requests"| node_frontendproxy
node_frontendproxy -->|"forwards requests"| node_api
node_api -->|"mounts routes"| node_domainroutes
node_domainroutes -->|"registers router"| node_appointments
node_appointments -->|"reads and writes"| node_appointmentrecords
node_appointments -->|"validates patient"| node_patients
node_appointments -->|"validates dentist"| node_users
node_appointmentrecords -->|"maps through"| node_database
node_patients -->|"maps through"| node_database
node_users -->|"maps through"| node_database
node_authapi -->|"queries accounts"| node_users
node_authapi -->|"checks tokens"| node_security
node_authapi -.->|"sends invitations"| node_email
node_appointments -.->|"notifies patients"| node_email
node_email -.->|"sends mail"| node_smtp
node_domainroutes -.->|"supports scheduling"| node_planning
node_domainroutes -.->|"supports care records"| node_clinical
node_domainroutes -.->|"supports invoicing"| node_billing
node_domainroutes -.->|"supports documents"| node_documents
node_domainroutes -.->|"supports lead intake"| node_leads
node_domainroutes -.->|"supports statistics"| node_analytics
node_domainroutes -.->|"supports messaging"| node_chat
node_authapi -->|"enforces roles"| node_permissions

click node_publicbooking "https://github.com/imenzaalani/dentify/blob/main/frontend/src/app/(public)/booking/page.tsx"
click node_patientportal "https://github.com/imenzaalani/dentify/blob/main/frontend/src/app/patient/appointment/page.tsx"
click node_staffui "https://github.com/imenzaalani/dentify/blob/main/frontend/src/app/staff/(dashboard)/patients/%5Bid%5D/page.tsx"
click node_planning "https://github.com/imenzaalani/dentify/tree/main/frontend/src/app/staff/(dashboard)/planning"
click node_clinical "https://github.com/imenzaalani/dentify/tree/main/frontend/src/app/staff/(dashboard)/treatments"
click node_billing "https://github.com/imenzaalani/dentify/blob/main/frontend/src/app/staff/(dashboard)/billing/components/data-table.tsx"
click node_documents "https://github.com/imenzaalani/dentify/tree/main/frontend/src/app/staff/(dashboard)/documents"
click node_leads "https://github.com/imenzaalani/dentify/tree/main/frontend/src/app/staff/(dashboard)/leads"
click node_analytics "https://github.com/imenzaalani/dentify/tree/main/frontend/src/app/staff/(dashboard)/statistics"
click node_chat "https://github.com/imenzaalani/dentify/tree/main/frontend/src/app/staff/(dashboard)/chat"
click node_api "https://github.com/imenzaalani/dentify/blob/main/backend/app/main.py"
click node_appointments "https://github.com/imenzaalani/dentify/blob/main/backend/app/api/v1/appointments.py"
click node_authapi "https://github.com/imenzaalani/dentify/blob/main/backend/app/api/v1/auth.py"
click node_domainroutes "https://github.com/imenzaalani/dentify/tree/main/backend/app/api/v1"
click node_patients "https://github.com/imenzaalani/dentify/blob/main/backend/app/models/patient.py"
click node_appointmentrecords "https://github.com/imenzaalani/dentify/blob/main/backend/app/models/appointment.py"
click node_users "https://github.com/imenzaalani/dentify/blob/main/backend/app/models/user.py"
click node_database "https://github.com/imenzaalani/dentify/blob/main/backend/app/core/database.py"
click node_security "https://github.com/imenzaalani/dentify/blob/main/backend/app/core/security.py"
click node_permissions "https://github.com/imenzaalani/dentify/blob/main/backend/app/core/permissions.py"
click node_email "https://github.com/imenzaalani/dentify/blob/main/backend/app/services/email.py"
click node_frontendproxy "https://github.com/imenzaalani/dentify/blob/main/frontend/src/app/api/backend/%5B...path%5D/route.ts"
click node_api_client "https://github.com/imenzaalani/dentify/blob/main/frontend/src/lib/api/client.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_publicbooking,node_patientportal,node_frontendproxy,node_api_client toneBlue
class node_staffui,node_planning,node_clinical,node_billing,node_documents,node_leads,node_analytics,node_chat toneAmber
class node_api,node_appointments,node_authapi,node_domainroutes toneMint
class node_patients,node_appointmentrecords,node_users,node_database toneRose
class node_security,node_permissions,node_email,node_visitor,node_smtp toneIndigo
```

## Components

### Public and portal

- [Public booking](https://github.com/imenzaalani/dentify/blob/main/frontend/src/app/(public)/booking/page.tsx): `frontend/src/app/(public)/booking/page.tsx`
- [Patient portal](https://github.com/imenzaalani/dentify/blob/main/frontend/src/app/patient/appointment/page.tsx): `frontend/src/app/patient/appointment/page.tsx`
- [Backend proxy](https://github.com/imenzaalani/dentify/blob/main/frontend/src/app/api/backend/%5B...path%5D/route.ts): `frontend/src/app/api/backend/[...path]/route.ts`
- [API client](https://github.com/imenzaalani/dentify/blob/main/frontend/src/lib/api/client.ts): `frontend/src/lib/api/client.ts`

### Staff operations

- [Staff workspace](https://github.com/imenzaalani/dentify/blob/main/frontend/src/app/staff/(dashboard)/patients/%5Bid%5D/page.tsx): `frontend/src/app/staff/(dashboard)/patients/[id]/page.tsx`
- [Scheduling and waitlist](https://github.com/imenzaalani/dentify/tree/main/frontend/src/app/staff/(dashboard)/planning): `frontend/src/app/staff/(dashboard)/planning`
- [Clinical care](https://github.com/imenzaalani/dentify/tree/main/frontend/src/app/staff/(dashboard)/treatments): `frontend/src/app/staff/(dashboard)/treatments`
- [Billing](https://github.com/imenzaalani/dentify/blob/main/frontend/src/app/staff/(dashboard)/billing/components/data-table.tsx): `frontend/src/app/staff/(dashboard)/billing/components/data-table.tsx`
- [Documents](https://github.com/imenzaalani/dentify/tree/main/frontend/src/app/staff/(dashboard)/documents): `frontend/src/app/staff/(dashboard)/documents`
- [Lead intake](https://github.com/imenzaalani/dentify/tree/main/frontend/src/app/staff/(dashboard)/leads): `frontend/src/app/staff/(dashboard)/leads`
- [Reports and statistics](https://github.com/imenzaalani/dentify/tree/main/frontend/src/app/staff/(dashboard)/statistics): `frontend/src/app/staff/(dashboard)/statistics`
- [Clinic messaging](https://github.com/imenzaalani/dentify/tree/main/frontend/src/app/staff/(dashboard)/chat): `frontend/src/app/staff/(dashboard)/chat`

### Backend API

- [REST API](https://github.com/imenzaalani/dentify/blob/main/backend/app/main.py): `backend/app/main.py`
- [Appointment operations](https://github.com/imenzaalani/dentify/blob/main/backend/app/api/v1/appointments.py): `backend/app/api/v1/appointments.py`
- [Authentication API](https://github.com/imenzaalani/dentify/blob/main/backend/app/api/v1/auth.py): `backend/app/api/v1/auth.py`
- [Domain endpoints](https://github.com/imenzaalani/dentify/tree/main/backend/app/api/v1): `backend/app/api/v1`

### Domain and persistence

- [Patient records](https://github.com/imenzaalani/dentify/blob/main/backend/app/models/patient.py): `backend/app/models/patient.py`
- [Appointment records](https://github.com/imenzaalani/dentify/blob/main/backend/app/models/appointment.py): `backend/app/models/appointment.py`
- [User accounts](https://github.com/imenzaalani/dentify/blob/main/backend/app/models/user.py): `backend/app/models/user.py`
- [PostgreSQL database](https://github.com/imenzaalani/dentify/blob/main/backend/app/core/database.py): `backend/app/core/database.py`

### Identity and services

- [Tokens and access](https://github.com/imenzaalani/dentify/blob/main/backend/app/core/security.py): `backend/app/core/security.py`
- [Role permissions](https://github.com/imenzaalani/dentify/blob/main/backend/app/core/permissions.py): `backend/app/core/permissions.py`
- [Email notifications](https://github.com/imenzaalani/dentify/blob/main/backend/app/services/email.py): `backend/app/services/email.py`

### Other components

- **Patient or visitor**
- **SMTP provider**

## Connections

- Patient or visitor → Public booking: requests booking (evidence: `frontend/src/app/(public)/booking/page.tsx`)
- Patient or visitor → Patient portal: uses portal
- Patient or visitor → Staff workspace: staff uses
- Public booking → API client: submits request
- Patient portal → API client: loads records
- Staff workspace → API client: loads patient data
- API client → Backend proxy: sends requests
- Backend proxy → REST API: forwards requests (evidence: `frontend/src/app/api/backend/[...path]/route.ts`)
- REST API → Domain endpoints: mounts routes (evidence: `backend/app/main.py`)
- Domain endpoints → Appointment operations: registers router (evidence: `backend/app/api/v1/__init__.py`)
- Appointment operations → Appointment records: reads and writes (evidence: `backend/app/api/v1/appointments.py`)
- Appointment operations → Patient records: validates patient (evidence: `backend/app/api/v1/appointments.py`)
- Appointment operations → User accounts: validates dentist (evidence: `backend/app/api/v1/appointments.py`)
- Appointment records → PostgreSQL database: maps through (evidence: `backend/app/models/appointment.py`)
- Patient records → PostgreSQL database: maps through (evidence: `backend/app/models/patient.py`)
- User accounts → PostgreSQL database: maps through (evidence: `backend/app/models/user.py`)
- Authentication API → User accounts: queries accounts (evidence: `backend/app/api/v1/auth.py`)
- Authentication API → Tokens and access: checks tokens (evidence: `backend/app/api/v1/auth.py`)
- Authentication API → Email notifications: sends invitations (evidence: `backend/app/api/v1/auth.py`)
- Appointment operations → Email notifications: notifies patients (evidence: `backend/app/api/v1/appointments.py`)
- Email notifications → SMTP provider: sends mail
- Domain endpoints → Scheduling and waitlist: supports scheduling
- Domain endpoints → Clinical care: supports care records
- Domain endpoints → Billing: supports invoicing
- Domain endpoints → Documents: supports documents
- Domain endpoints → Lead intake: supports lead intake
- Domain endpoints → Reports and statistics: supports statistics
- Domain endpoints → Clinic messaging: supports messaging
- Authentication API → Role permissions: enforces roles (evidence: `backend/app/api/v1/auth.py`)
