# jstmejosh/new-clincare architecture

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

- Interactive diagram: https://gitdiagram.com/jstmejosh/new-clincare
- Repository: https://github.com/jstmejosh/new-clincare

## Overview

Clinicare is a clinic-management application for patients and care-team staff. Patients register, verify and onboard, book appointments, and view their appointments and payments; staff manage patients, doctors, rooms, inpatients, appointments, payments, users, and dashboard summaries. The client routes users through authentication and role-aware pages, while its API modules communicate with an Express server that dispatches requests through route, controller, and service layers to MongoDB-backed models. The tree documents the wider domain, but sampled service code is limited; links for unsampled domain wiring are therefore kept at the established server entry and route boundaries.

Main entry points: [`client/src/routes/AppRoutes.jsx`](https://github.com/jstmejosh/new-clincare/blob/master/client/src/routes/AppRoutes.jsx) (Access and routes), [`server/src/services/user.service.js`](https://github.com/jstmejosh/new-clincare/blob/master/server/src/services/user.service.js) (Account service), [`client/src/pages/patientsOnboard/index.jsx`](https://github.com/jstmejosh/new-clincare/blob/master/client/src/pages/patientsOnboard/index.jsx) (Patient journeys), [`server/src/routes`](https://github.com/jstmejosh/new-clincare/tree/master/server/src/routes) (API route dispatch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_app["Client application<br/>[App.jsx]"]
  node_routes["Access and routes<br/>[AppRoutes.jsx]"]
  node_authguard["Route guards"]
  node_authstate["Authentication state<br/>[AuthProvider.jsx]"]
  node_patientpages["Patient journeys<br/>[index.jsx]"]
  node_staffpages["Staff dashboard<br/>[index.jsx]"]
end

subgraph group_api["API boundary"]
  node_apiutils["HTTP client<br/>[axiosInstance.js]"]
  node_clientapi["Domain API modules"]
end

subgraph group_server["Server runtime"]
  node_server["Express application<br/>[index.js]"]
  node_routesapi["API route dispatch"]
  node_middleware["Request middleware"]
  node_controllers["Request controllers"]
end

subgraph group_domain["Clinic operations"]
  node_services["Domain services"]
  node_userservice["Account service<br/>[user.service.js]"]
  node_models["Clinic data models"]
  node_mongodb[("MongoDB")]
end

subgraph group_integrations["External services"]
  node_email["Email delivery<br/>[email.service.js]"]
  node_cloudinary["Cloudinary media<br/>[cloudinary.js]"]
  node_paystack["Payment checkout<br/>[Paystack.jsx]"]
end

node_patients(("Patients and public"))
node_staff(("Clinic staff"))

node_patients -->|"use"| node_app
node_staff -->|"use"| node_app
node_app -->|"renders"| node_routes
node_routes -->|"applies access"| node_authguard
node_routes -->|"routes patients"| node_patientpages
node_routes -->|"routes staff"| node_staffpages
node_authguard -->|"checks session"| node_authstate
node_patientpages -->|"requests clinic data"| node_clientapi
node_staffpages -->|"requests clinic data"| node_clientapi
node_clientapi -->|"uses HTTP client"| node_apiutils
node_apiutils -->|"sends requests"| node_server
node_server -->|"mounts routes"| node_routesapi
node_routesapi -->|"applies guards"| node_middleware
node_routesapi -->|"dispatches"| node_controllers
node_controllers -->|"calls domain logic"| node_services
node_controllers -->|"calls account operations"| node_userservice
node_userservice -->|"reads and writes"| node_models
node_services -->|"accesses domain data"| node_models
node_models -->|"persists records"| node_mongodb
node_userservice -.->|"sends verification"| node_email
node_userservice -.->|"manages avatars"| node_cloudinary
node_patientpages -.->|"payment flow"| node_paystack

click node_app "https://github.com/jstmejosh/new-clincare/blob/master/client/src/App.jsx"
click node_routes "https://github.com/jstmejosh/new-clincare/blob/master/client/src/routes/AppRoutes.jsx"
click node_authguard "https://github.com/jstmejosh/new-clincare/blob/master/client/src/routes/ProtectedRoutes.jsx"
click node_authstate "https://github.com/jstmejosh/new-clincare/blob/master/client/src/store/AuthProvider.jsx"
click node_patientpages "https://github.com/jstmejosh/new-clincare/blob/master/client/src/pages/patientsOnboard/index.jsx"
click node_staffpages "https://github.com/jstmejosh/new-clincare/blob/master/client/src/pages/dashboard/index.jsx"
click node_apiutils "https://github.com/jstmejosh/new-clincare/blob/master/client/src/utils/axiosInstance.js"
click node_clientapi "https://github.com/jstmejosh/new-clincare/tree/master/client/src/api"
click node_server "https://github.com/jstmejosh/new-clincare/blob/master/server/index.js"
click node_routesapi "https://github.com/jstmejosh/new-clincare/tree/master/server/src/routes"
click node_middleware "https://github.com/jstmejosh/new-clincare/tree/master/server/src/middlewares"
click node_controllers "https://github.com/jstmejosh/new-clincare/tree/master/server/src/controllers"
click node_services "https://github.com/jstmejosh/new-clincare/tree/master/server/src/services"
click node_userservice "https://github.com/jstmejosh/new-clincare/blob/master/server/src/services/user.service.js"
click node_models "https://github.com/jstmejosh/new-clincare/tree/master/server/src/models"
click node_email "https://github.com/jstmejosh/new-clincare/blob/master/server/src/services/email.service.js"
click node_cloudinary "https://github.com/jstmejosh/new-clincare/blob/master/server/src/utils/cloudinary.js"
click node_paystack "https://github.com/jstmejosh/new-clincare/blob/master/client/src/components/Paystack.jsx"

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_routes,node_authguard,node_authstate,node_patientpages,node_staffpages toneBlue
class node_apiutils,node_clientapi toneAmber
class node_server,node_routesapi,node_middleware,node_controllers toneMint
class node_services,node_userservice,node_models,node_mongodb toneRose
class node_email,node_cloudinary,node_paystack,node_patients,node_staff toneIndigo
```

## Components

### Client experience

- [Client application](https://github.com/jstmejosh/new-clincare/blob/master/client/src/App.jsx): `client/src/App.jsx`
- [Access and routes](https://github.com/jstmejosh/new-clincare/blob/master/client/src/routes/AppRoutes.jsx): `client/src/routes/AppRoutes.jsx`
- [Route guards](https://github.com/jstmejosh/new-clincare/blob/master/client/src/routes/ProtectedRoutes.jsx): `client/src/routes/ProtectedRoutes.jsx`
- [Authentication state](https://github.com/jstmejosh/new-clincare/blob/master/client/src/store/AuthProvider.jsx): `client/src/store/AuthProvider.jsx`
- [Patient journeys](https://github.com/jstmejosh/new-clincare/blob/master/client/src/pages/patientsOnboard/index.jsx): `client/src/pages/patientsOnboard/index.jsx`
- [Staff dashboard](https://github.com/jstmejosh/new-clincare/blob/master/client/src/pages/dashboard/index.jsx): `client/src/pages/dashboard/index.jsx`

### API boundary

- [HTTP client](https://github.com/jstmejosh/new-clincare/blob/master/client/src/utils/axiosInstance.js): `client/src/utils/axiosInstance.js`
- [Domain API modules](https://github.com/jstmejosh/new-clincare/tree/master/client/src/api): `client/src/api`

### Server runtime

- [Express application](https://github.com/jstmejosh/new-clincare/blob/master/server/index.js): `server/index.js`
- [API route dispatch](https://github.com/jstmejosh/new-clincare/tree/master/server/src/routes): `server/src/routes`
- [Request middleware](https://github.com/jstmejosh/new-clincare/tree/master/server/src/middlewares): `server/src/middlewares`
- [Request controllers](https://github.com/jstmejosh/new-clincare/tree/master/server/src/controllers): `server/src/controllers`

### Clinic operations

- [Domain services](https://github.com/jstmejosh/new-clincare/tree/master/server/src/services): `server/src/services`
- [Account service](https://github.com/jstmejosh/new-clincare/blob/master/server/src/services/user.service.js): `server/src/services/user.service.js`
- [Clinic data models](https://github.com/jstmejosh/new-clincare/tree/master/server/src/models): `server/src/models`
- **MongoDB**

### External services

- [Email delivery](https://github.com/jstmejosh/new-clincare/blob/master/server/src/services/email.service.js): `server/src/services/email.service.js`
- [Cloudinary media](https://github.com/jstmejosh/new-clincare/blob/master/server/src/utils/cloudinary.js): `server/src/utils/cloudinary.js`
- [Payment checkout](https://github.com/jstmejosh/new-clincare/blob/master/client/src/components/Paystack.jsx): `client/src/components/Paystack.jsx`

### Other components

- **Patients and public**
- **Clinic staff**

## Connections

- Patients and public → Client application: use
- Clinic staff → Client application: use
- Client application → Access and routes: renders
- Access and routes → Route guards: applies access
- Access and routes → Patient journeys: routes patients
- Access and routes → Staff dashboard: routes staff
- Route guards → Authentication state: checks session
- Patient journeys → Domain API modules: requests clinic data
- Staff dashboard → Domain API modules: requests clinic data
- Domain API modules → HTTP client: uses HTTP client
- HTTP client → Express application: sends requests
- Express application → API route dispatch: mounts routes
- API route dispatch → Request middleware: applies guards
- API route dispatch → Request controllers: dispatches
- Request controllers → Domain services: calls domain logic
- Request controllers → Account service: calls account operations
- Account service → Clinic data models: reads and writes
- Domain services → Clinic data models: accesses domain data
- Clinic data models → MongoDB: persists records
- Account service → Email delivery: sends verification
- Account service → Cloudinary media: manages avatars
- Patient journeys → Payment checkout: payment flow
