# kent757/carepoint_kenjorn.dev architecture

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

- Interactive diagram: https://gitdiagram.com/kent757/carepoint_kenjorn.dev
- Repository: https://github.com/kent757/carepoint_kenjorn.dev

## Overview

CarePoint is a clinic operations web application with patient, staff, and administrator workflows. Users interact with browser dashboards backed by an Express API: patients register or sign in, request appointments and track queue status; staff manage daily clinic activity; administrators manage appointments, users, and notifications. The graph includes the sampled API, data models, queue-priority logic, and browser clients. README content is only a title, so broader capabilities are inferred cautiously from routes and client files; unsampled route details are not expanded.

Main entry points: [`src/server.js`](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/server.js) (HTTP server), [`src/routes/staffRoutes.js`](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/routes/staffRoutes.js) (Staff operations), [`src/routes/adminRoutes.js`](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/routes/adminRoutes.js) (Administration), [`src/models/Notification.js`](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/models/Notification.js) (Notifications)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser clients"]
  node_patient["Patient dashboard<br/>[patient.js]"]
  node_staff["Staff dashboard<br/>[staff.js]"]
  node_admin["Admin dashboard<br/>[admin.js]"]
  node_authui["Sign-in and registration<br/>[auth.js]"]
end

subgraph group_api["API and access"]
  node_server["HTTP server<br/>[server.js]"]
  node_auth["Authentication routes<br/>[authRoutes.js]"]
  node_authmw["Session authorization<br/>[authMiddleware.js]"]
  node_ratelimit["Login rate limiting"]
end

subgraph group_clinic["Clinic operations"]
  node_appointments["Patient appointments"]
  node_adminappointments["Appointment administration"]
  node_queue["Queue management<br/>[queueRoutes.js]"]
  node_priority["Priority ordering<br/>[PriorityQueue.js]"]
  node_staffapi["Staff operations<br/>[staffRoutes.js]"]
  node_adminapi["Administration<br/>[adminRoutes.js]"]
end

subgraph group_data["Persisted data"]
  node_users[("User accounts<br/>[User.js]")]
  node_appointmentdata[("Appointment records<br/>[Appointment.js]")]
  node_queuedata[("Queue entries<br/>[QueueEntry.js]")]
  node_notifications[("Notifications<br/>[Notification.js]")]
end

node_patientactor(("Patient"))
node_staffactor(("Clinic staff"))
node_adminactor(("Administrator"))
node_mongodb[("MongoDB")]

node_patientactor -->|"uses"| node_patient
node_staffactor -->|"uses"| node_staff
node_adminactor -->|"uses"| node_admin
node_patientactor -->|"signs in"| node_authui
node_authui -.->|"HTTP requests"| node_server
node_patient -.->|"HTTP requests"| node_server
node_staff -.->|"HTTP requests"| node_server
node_admin -.->|"HTTP requests"| node_server
node_server -->|"routes requests"| node_auth
node_server -->|"limits login"| node_ratelimit
node_server -->|"routes requests"| node_appointments
node_server -->|"routes requests"| node_adminappointments
node_server -->|"routes requests"| node_queue
node_server -->|"routes requests"| node_staffapi
node_server -->|"routes requests"| node_adminapi
node_auth -->|"reads and writes"| node_users
node_auth -->|"creates"| node_notifications
node_appointments -->|"requires login"| node_authmw
node_appointments -->|"reads and writes"| node_appointmentdata
node_appointments -->|"creates"| node_notifications
node_queue -->|"reads and writes"| node_queuedata
node_queue -->|"orders waiting"| node_priority
node_queue -->|"creates"| node_notifications
node_staffapi -->|"requires staff access"| node_authmw
node_staffapi -->|"searches patients"| node_users
node_staffapi -->|"reads statistics"| node_appointmentdata
node_staffapi -->|"reads queue"| node_queuedata
node_adminapi -->|"manages accounts"| node_users
node_adminapi -->|"manages appointments"| node_appointmentdata
node_adminapi -->|"reads queue"| node_queuedata
node_adminapi -->|"manages notifications"| node_notifications
node_adminappointments -->|"manages appointments"| node_appointmentdata
node_adminappointments -->|"creates"| node_notifications
node_server -->|"connects"| node_mongodb

click node_patient "https://github.com/kent757/carepoint_kenjorn.dev/blob/main/public/js/patient.js"
click node_staff "https://github.com/kent757/carepoint_kenjorn.dev/blob/main/public/js/staff.js"
click node_admin "https://github.com/kent757/carepoint_kenjorn.dev/blob/main/public/js/admin.js"
click node_authui "https://github.com/kent757/carepoint_kenjorn.dev/blob/main/public/js/auth.js"
click node_server "https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/server.js"
click node_auth "https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/routes/authRoutes.js"
click node_authmw "https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/middleware/authMiddleware.js"
click node_ratelimit "https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/middleware/rateLimitMiddleware.js"
click node_appointments "https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/routes/appointmentRoutes.js"
click node_adminappointments "https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/routes/adminAppointmentRoutes.js"
click node_queue "https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/routes/queueRoutes.js"
click node_priority "https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/algorithms/PriorityQueue.js"
click node_staffapi "https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/routes/staffRoutes.js"
click node_adminapi "https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/routes/adminRoutes.js"
click node_users "https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/models/User.js"
click node_appointmentdata "https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/models/Appointment.js"
click node_queuedata "https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/models/QueueEntry.js"
click node_notifications "https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/models/Notification.js"

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_patient,node_staff,node_admin,node_authui toneBlue
class node_server,node_auth,node_authmw,node_ratelimit,node_mongodb toneAmber
class node_appointments,node_adminappointments,node_queue,node_priority,node_staffapi,node_adminapi toneMint
class node_users,node_appointmentdata,node_queuedata,node_notifications toneRose
class node_patientactor,node_staffactor,node_adminactor toneIndigo
```

## Components

### Browser clients

- [Patient dashboard](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/public/js/patient.js): `public/js/patient.js`
- [Staff dashboard](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/public/js/staff.js): `public/js/staff.js`
- [Admin dashboard](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/public/js/admin.js): `public/js/admin.js`
- [Sign-in and registration](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/public/js/auth.js): `public/js/auth.js`

### API and access

- [HTTP server](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/server.js): `src/server.js`
- [Authentication routes](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/routes/authRoutes.js): `src/routes/authRoutes.js`
- [Session authorization](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/middleware/authMiddleware.js): `src/middleware/authMiddleware.js`
- [Login rate limiting](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/middleware/rateLimitMiddleware.js): `src/middleware/rateLimitMiddleware.js`

### Clinic operations

- [Patient appointments](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/routes/appointmentRoutes.js): `src/routes/appointmentRoutes.js`
- [Appointment administration](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/routes/adminAppointmentRoutes.js): `src/routes/adminAppointmentRoutes.js`
- [Queue management](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/routes/queueRoutes.js): `src/routes/queueRoutes.js`
- [Priority ordering](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/algorithms/PriorityQueue.js): `src/algorithms/PriorityQueue.js`
- [Staff operations](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/routes/staffRoutes.js): `src/routes/staffRoutes.js`
- [Administration](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/routes/adminRoutes.js): `src/routes/adminRoutes.js`

### Persisted data

- [User accounts](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/models/User.js): `src/models/User.js`
- [Appointment records](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/models/Appointment.js): `src/models/Appointment.js`
- [Queue entries](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/models/QueueEntry.js): `src/models/QueueEntry.js`
- [Notifications](https://github.com/kent757/carepoint_kenjorn.dev/blob/main/src/models/Notification.js): `src/models/Notification.js`

### Other components

- **Patient**
- **Clinic staff**
- **Administrator**
- **MongoDB**

## Connections

- Patient → Patient dashboard: uses
- Clinic staff → Staff dashboard: uses
- Administrator → Admin dashboard: uses
- Patient → Sign-in and registration: signs in
- Sign-in and registration → HTTP server: HTTP requests
- Patient dashboard → HTTP server: HTTP requests
- Staff dashboard → HTTP server: HTTP requests
- Admin dashboard → HTTP server: HTTP requests
- HTTP server → Authentication routes: routes requests (evidence: `src/server.js`)
- HTTP server → Login rate limiting: limits login (evidence: `src/server.js`)
- HTTP server → Patient appointments: routes requests (evidence: `src/server.js`)
- HTTP server → Appointment administration: routes requests (evidence: `src/server.js`)
- HTTP server → Queue management: routes requests (evidence: `src/server.js`)
- HTTP server → Staff operations: routes requests (evidence: `src/server.js`)
- HTTP server → Administration: routes requests (evidence: `src/server.js`)
- Authentication routes → User accounts: reads and writes (evidence: `src/routes/authRoutes.js`)
- Authentication routes → Notifications: creates (evidence: `src/routes/authRoutes.js`)
- Patient appointments → Session authorization: requires login (evidence: `src/routes/appointmentRoutes.js`)
- Patient appointments → Appointment records: reads and writes (evidence: `src/routes/appointmentRoutes.js`)
- Patient appointments → Notifications: creates (evidence: `src/routes/appointmentRoutes.js`)
- Queue management → Queue entries: reads and writes (evidence: `src/routes/queueRoutes.js`)
- Queue management → Priority ordering: orders waiting (evidence: `src/routes/queueRoutes.js`)
- Queue management → Notifications: creates (evidence: `src/routes/queueRoutes.js`)
- Staff operations → Session authorization: requires staff access (evidence: `src/routes/staffRoutes.js`)
- Staff operations → User accounts: searches patients (evidence: `src/routes/staffRoutes.js`)
- Staff operations → Appointment records: reads statistics (evidence: `src/routes/staffRoutes.js`)
- Staff operations → Queue entries: reads queue (evidence: `src/routes/staffRoutes.js`)
- Administration → User accounts: manages accounts (evidence: `src/routes/adminRoutes.js`)
- Administration → Appointment records: manages appointments (evidence: `src/routes/adminRoutes.js`)
- Administration → Queue entries: reads queue (evidence: `src/routes/adminRoutes.js`)
- Administration → Notifications: manages notifications (evidence: `src/routes/adminRoutes.js`)
- Appointment administration → Appointment records: manages appointments (evidence: `src/routes/adminAppointmentRoutes.js`)
- Appointment administration → Notifications: creates (evidence: `src/routes/adminAppointmentRoutes.js`)
- HTTP server → MongoDB: connects (evidence: `src/server.js`)
