# jayaliperera/patient-management-system architecture

> Architecture diagram of the GitHub repository jayaliperera/patient-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jayaliperera/patient-management-system
- Repository: https://github.com/jayaliperera/patient-management-system

## Overview

A full-stack clinic booking system: patients and doctors authenticate into role-specific workspaces. Patients search doctors, inspect availability, book and manage appointments; doctors maintain profiles and availability, manage schedules and appointments, and review patient summaries. The React dashboards call a FastAPI API, whose services enforce domain rules and persist records through SQLAlchemy. README capabilities are included where documented; unsampled frontend pages and API routes are represented by their existing feature or route paths, with only documented relationships shown.

Main entry points: [`patient_management_system_BE/app/services.py`](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/services.py) (Clinic domain services), [`patient_management_syetem_FE/src/api.js`](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_syetem_FE/src/api.js) (HTTP client), [`patient_management_system_BE/app/api/v1/dependencies.py`](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/api/v1/dependencies.py) (Token and role access), [`patient_management_syetem_FE/src/App.jsx`](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_syetem_FE/src/App.jsx) (Session and routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React application"]
  node_app["Session and routing<br/>[App.jsx]"]
  node_authui["Sign-in and registration<br/>[AuthScreen.jsx]"]
  node_patientui["Patient workspace"]
  node_doctorui["Doctor workspace"]
  node_receipt["Appointment receipts<br/>[receiptPdf.js]"]
  node_client["HTTP client<br/>[api.js]"]
end

subgraph group_api["API and access"]
  node_routes["API route handlers"]
  node_authroutes["Authentication routes<br/>[auth.py]"]
  node_doctorroutes["Doctor routes<br/>[doctors.py]"]
  node_patientroutes["Patient routes<br/>[patients.py]"]
  node_appointmentroutes["Appointment routes<br/>[appointments.py]"]
  node_access["Token and role access<br/>[dependencies.py]"]
end

subgraph group_domain["Clinic workflows"]
  node_services["Clinic domain services<br/>[services.py]"]
  node_contracts["Request and response schemas<br/>[schemas.py]"]
  node_time["Clinic time handling<br/>[timezone.py]"]
end

subgraph group_persistence["Persistence and security"]
  node_security["JWT and password security<br/>[security.py]"]
  node_config["Application configuration<br/>[config.py]"]
  node_dbsession["Database sessions<br/>[database.py]"]
  node_records[("Clinic records<br/>[models.py]")]
end

node_user(("Patient or doctor"))
node_database[("PostgreSQL or SQLite")]

node_user -->|"uses"| node_app
node_app -->|"shows"| node_authui
node_app -->|"routes patient"| node_patientui
node_app -->|"routes doctor"| node_doctorui
node_authui -->|"calls API"| node_client
node_patientui -->|"calls API"| node_client
node_doctorui -->|"calls API"| node_client
node_patientui -->|"downloads receipt"| node_receipt
node_client -.->|"HTTP requests"| node_authroutes
node_client -.->|"HTTP requests"| node_doctorroutes
node_client -.->|"HTTP requests"| node_patientroutes
node_client -.->|"HTTP requests"| node_appointmentroutes
node_authroutes -->|"delegates to"| node_services
node_doctorroutes -->|"delegates to"| node_services
node_appointmentroutes -->|"delegates to"| node_services
node_patientroutes -.->|"delegates to"| node_services
node_authroutes -->|"uses dependencies"| node_access
node_doctorroutes -->|"uses dependencies"| node_access
node_appointmentroutes -->|"uses dependencies"| node_access
node_patientroutes -.->|"role protection"| node_access
node_access -->|"decodes token"| node_security
node_access -->|"gets session"| node_dbsession
node_access -->|"loads user"| node_records
node_services -->|"hashes and verifies"| node_security
node_services -->|"uses time rules"| node_time
node_services -->|"queries and updates"| node_records
node_services -->|"returns domain data"| node_contracts
node_contracts -->|"maps ORM models"| node_records
node_dbsession -->|"reads settings"| node_config
node_dbsession -->|"initializes metadata"| node_records
node_dbsession -.->|"opens sessions"| node_database
node_security -->|"reads secret settings"| node_config

click node_app "https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_syetem_FE/src/App.jsx"
click node_authui "https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_syetem_FE/src/features/auth/AuthScreen.jsx"
click node_patientui "https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_syetem_FE/src/features/patient/PatientDashboard.jsx"
click node_doctorui "https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_syetem_FE/src/features/doctor/DoctorDashboard.jsx"
click node_receipt "https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_syetem_FE/src/lib/receiptPdf.js"
click node_client "https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_syetem_FE/src/api.js"
click node_routes "https://github.com/jayaliperera/patient-management-system/tree/main/patient_management_system_BE/app/api/v1"
click node_authroutes "https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/api/v1/auth.py"
click node_doctorroutes "https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/api/v1/doctors.py"
click node_patientroutes "https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/api/v1/patients.py"
click node_appointmentroutes "https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/api/v1/appointments.py"
click node_access "https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/api/v1/dependencies.py"
click node_services "https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/services.py"
click node_contracts "https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/schemas.py"
click node_time "https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/core/timezone.py"
click node_security "https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/core/security.py"
click node_config "https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/core/config.py"
click node_dbsession "https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/db/database.py"
click node_records "https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/db/models.py"

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_app,node_authui,node_patientui,node_doctorui,node_receipt,node_client toneBlue
class node_routes,node_authroutes,node_doctorroutes,node_patientroutes,node_appointmentroutes,node_access,node_database toneAmber
class node_services,node_contracts,node_time toneMint
class node_security,node_config,node_dbsession,node_records toneRose
class node_user toneIndigo
```

## Components

### React application

- [Session and routing](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_syetem_FE/src/App.jsx): `patient_management_syetem_FE/src/App.jsx`
- [Sign-in and registration](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_syetem_FE/src/features/auth/AuthScreen.jsx): `patient_management_syetem_FE/src/features/auth/AuthScreen.jsx`
- [Patient workspace](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_syetem_FE/src/features/patient/PatientDashboard.jsx): `patient_management_syetem_FE/src/features/patient/PatientDashboard.jsx`
- [Doctor workspace](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_syetem_FE/src/features/doctor/DoctorDashboard.jsx): `patient_management_syetem_FE/src/features/doctor/DoctorDashboard.jsx`
- [Appointment receipts](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_syetem_FE/src/lib/receiptPdf.js): `patient_management_syetem_FE/src/lib/receiptPdf.js`
- [HTTP client](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_syetem_FE/src/api.js): `patient_management_syetem_FE/src/api.js`

### API and access

- [API route handlers](https://github.com/jayaliperera/patient-management-system/tree/main/patient_management_system_BE/app/api/v1): `patient_management_system_BE/app/api/v1`
- [Authentication routes](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/api/v1/auth.py): `patient_management_system_BE/app/api/v1/auth.py`
- [Doctor routes](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/api/v1/doctors.py): `patient_management_system_BE/app/api/v1/doctors.py`
- [Patient routes](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/api/v1/patients.py): `patient_management_system_BE/app/api/v1/patients.py`
- [Appointment routes](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/api/v1/appointments.py): `patient_management_system_BE/app/api/v1/appointments.py`
- [Token and role access](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/api/v1/dependencies.py): `patient_management_system_BE/app/api/v1/dependencies.py`

### Clinic workflows

- [Clinic domain services](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/services.py): `patient_management_system_BE/app/services.py`
- [Request and response schemas](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/schemas.py): `patient_management_system_BE/app/schemas.py`
- [Clinic time handling](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/core/timezone.py): `patient_management_system_BE/app/core/timezone.py`

### Persistence and security

- [JWT and password security](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/core/security.py): `patient_management_system_BE/app/core/security.py`
- [Application configuration](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/core/config.py): `patient_management_system_BE/app/core/config.py`
- [Database sessions](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/db/database.py): `patient_management_system_BE/app/db/database.py`
- [Clinic records](https://github.com/jayaliperera/patient-management-system/blob/main/patient_management_system_BE/app/db/models.py): `patient_management_system_BE/app/db/models.py`

### Other components

- **Patient or doctor**
- **PostgreSQL or SQLite**

## Connections

- Patient or doctor → Session and routing: uses (evidence: `patient_management_syetem_FE/src/App.jsx`)
- Session and routing → Sign-in and registration: shows (evidence: `patient_management_syetem_FE/src/App.jsx`)
- Session and routing → Patient workspace: routes patient (evidence: `patient_management_syetem_FE/src/App.jsx`)
- Session and routing → Doctor workspace: routes doctor (evidence: `patient_management_syetem_FE/src/App.jsx`)
- Sign-in and registration → HTTP client: calls API (evidence: `patient_management_syetem_FE/src/features/auth/AuthScreen.jsx`)
- Patient workspace → HTTP client: calls API (evidence: `patient_management_syetem_FE/src/features/patient/PatientDashboard.jsx`)
- Doctor workspace → HTTP client: calls API (evidence: `patient_management_syetem_FE/src/features/doctor/DoctorDashboard.jsx`)
- Patient workspace → Appointment receipts: downloads receipt (evidence: `patient_management_syetem_FE/src/features/patient/PatientDashboard.jsx`)
- HTTP client → Authentication routes: HTTP requests (evidence: `README.md`)
- HTTP client → Doctor routes: HTTP requests (evidence: `README.md`)
- HTTP client → Patient routes: HTTP requests (evidence: `README.md`)
- HTTP client → Appointment routes: HTTP requests (evidence: `README.md`)
- Authentication routes → Clinic domain services: delegates to (evidence: `patient_management_system_BE/app/api/v1/auth.py`)
- Doctor routes → Clinic domain services: delegates to (evidence: `patient_management_system_BE/app/api/v1/doctors.py`)
- Appointment routes → Clinic domain services: delegates to (evidence: `patient_management_system_BE/app/api/v1/appointments.py`)
- Patient routes → Clinic domain services: delegates to (evidence: `patient_management_system_BE/app/api/v1/patients.py`)
- Authentication routes → Token and role access: uses dependencies (evidence: `patient_management_system_BE/app/api/v1/auth.py`)
- Doctor routes → Token and role access: uses dependencies (evidence: `patient_management_system_BE/app/api/v1/doctors.py`)
- Appointment routes → Token and role access: uses dependencies (evidence: `patient_management_system_BE/app/api/v1/appointments.py`)
- Patient routes → Token and role access: role protection (evidence: `patient_management_system_BE/app/api/v1/patients.py`)
- Token and role access → JWT and password security: decodes token (evidence: `patient_management_system_BE/app/api/v1/dependencies.py`)
- Token and role access → Database sessions: gets session (evidence: `patient_management_system_BE/app/api/v1/dependencies.py`)
- Token and role access → Clinic records: loads user (evidence: `patient_management_system_BE/app/api/v1/dependencies.py`)
- Clinic domain services → JWT and password security: hashes and verifies (evidence: `patient_management_system_BE/app/services.py`)
- Clinic domain services → Clinic time handling: uses time rules (evidence: `patient_management_system_BE/app/services.py`)
- Clinic domain services → Clinic records: queries and updates (evidence: `patient_management_system_BE/app/services.py`)
- Clinic domain services → Request and response schemas: returns domain data (evidence: `patient_management_system_BE/app/services.py`)
- Request and response schemas → Clinic records: maps ORM models (evidence: `patient_management_system_BE/app/schemas.py`)
- Database sessions → Application configuration: reads settings (evidence: `patient_management_system_BE/app/db/database.py`)
- Database sessions → Clinic records: initializes metadata (evidence: `patient_management_system_BE/app/db/database.py`)
- Database sessions → PostgreSQL or SQLite: opens sessions
- JWT and password security → Application configuration: reads secret settings (evidence: `patient_management_system_BE/app/core/security.py`)
