# dushansenura/carenest-senior-resident-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/dushansenura/carenest-senior-resident-management-system
- Repository: https://github.com/dushansenura/carenest-senior-resident-management-system

## Overview

CareNest is a web-first senior-residence management platform, with a NestJS API and PostgreSQL-backed workflows alongside browser-local operational screens. Staff use the portal to sign in, manage residents and care, and view operational information; the API controllers dispatch supported requests to domain services and Prisma. The README also documents browser-side reporting and local-only modules. The mobile app is described as an incomplete prototype. Some frontend-to-API details and unsampled modules are not shown in the excerpts, so those relationships are documented at the product level rather than inferred from module names.

Main entry points: [`apps/api/src/app.module.ts`](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/app.module.ts) (NestJS API), [`apps/api/src/prisma.service.ts`](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/prisma.service.ts) (PostgreSQL data), [`apps/web/src/app/layout.tsx`](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/web/src/app/layout.tsx) (Staff portal), [`apps/web/src/components/login-form.tsx`](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/web/src/components/login-form.tsx) (Login screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portal["Staff portal"]
  node_web["Staff portal<br/>[layout.tsx]"]
  node_localops["Local operations"]
  node_reports["Reports and exports<br/>[reports-page.tsx]"]
  node_loginui["Login screen<br/>[login-form.tsx]"]
  node_mobile["Flutter shift prototype"]
end

subgraph group_identity["Identity and accounts"]
  node_authcontroller["Authentication routes<br/>[auth.controller.ts]"]
  node_authservice["Login and sessions<br/>[auth.service.ts]"]
  node_jwt["JWT verification<br/>[jwt-auth.guard.ts]"]
  node_settings["Account preferences"]
  node_staffmgmt["Staff and guests<br/>[staff.service.ts]"]
end

subgraph group_care["Resident and clinical care"]
  node_residents["Residents and admissions"]
  node_careplans["Care plans"]
  node_dailyhealth["Daily health reports"]
  node_medications["Medication and stock"]
end

subgraph group_operations["Operations and reporting"]
  node_tasksshifts["Tasks and shifts"]
  node_oprecords["Operational records"]
  node_dashboard["Dashboard summary"]
end

subgraph group_platform["API and persistence"]
  node_api["NestJS API<br/>[app.module.ts]"]
  node_db[("PostgreSQL data<br/>[prisma.service.ts]")]
end

node_staff(("Care staff"))

node_staff -->|"uses"| node_web
node_web -->|"presents login"| node_loginui
node_loginui -.->|"submits credentials"| node_authcontroller
node_web -->|"uses REST API"| node_api
node_authcontroller -->|"dispatches login"| node_authservice
node_authservice -->|"reads account, writes session"| node_db
node_api -->|"registers routes"| node_residents
node_api -->|"registers routes"| node_careplans
node_api -->|"registers routes"| node_dailyhealth
node_api -->|"registers routes"| node_medications
node_residents -->|"reads and writes"| node_db
node_careplans -->|"reads and writes"| node_db
node_dailyhealth -->|"reads and writes"| node_db
node_medications -->|"reads and writes"| node_db
node_api -->|"registers routes"| node_staffmgmt
node_staffmgmt -->|"reads and writes"| node_db
node_api -->|"registers routes"| node_settings
node_settings -->|"reads and writes"| node_db
node_api -->|"registers routes"| node_tasksshifts
node_tasksshifts -->|"reads and writes"| node_db
node_api -->|"registers routes"| node_oprecords
node_oprecords -->|"reads and writes"| node_db
node_api -->|"registers route"| node_dashboard
node_dashboard -->|"queries summary"| node_db
node_web -->|"offers local screens"| node_localops
node_web -->|"offers exports"| node_reports
node_mobile -.->|"fetches residents"| node_api

click node_web "https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/web/src/app/layout.tsx"
click node_localops "https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/web/src/components/announcements-page.tsx"
click node_reports "https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/web/src/components/reports-page.tsx"
click node_loginui "https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/web/src/components/login-form.tsx"
click node_authcontroller "https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/auth/auth.controller.ts"
click node_authservice "https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/auth/auth.service.ts"
click node_jwt "https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/auth/jwt-auth.guard.ts"
click node_settings "https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/settings/settings.service.ts"
click node_residents "https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/residents/residents.service.ts"
click node_careplans "https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/care-plans/care-plans.service.ts"
click node_dailyhealth "https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/daily-health/daily-health.service.ts"
click node_medications "https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/medications/medications.service.ts"
click node_staffmgmt "https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/staff/staff.service.ts"
click node_tasksshifts "https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/tasks-shifts/tasks-shifts.service.ts"
click node_oprecords "https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/operations/operations.service.ts"
click node_dashboard "https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/dashboard/dashboard.controller.ts"
click node_api "https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/app.module.ts"
click node_db "https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/prisma.service.ts"
click node_mobile "https://github.com/dushansenura/carenest-senior-resident-management-system/tree/main/apps/mobile"

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_web,node_localops,node_reports,node_loginui,node_mobile toneBlue
class node_authcontroller,node_authservice,node_jwt,node_settings,node_staffmgmt toneAmber
class node_residents,node_careplans,node_dailyhealth,node_medications toneMint
class node_tasksshifts,node_oprecords,node_dashboard toneRose
class node_api,node_db,node_staff toneIndigo
```

## Components

### Staff portal

- [Staff portal](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/web/src/app/layout.tsx): `apps/web/src/app/layout.tsx`
- [Local operations](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/web/src/components/announcements-page.tsx): `apps/web/src/components/announcements-page.tsx`
- [Reports and exports](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/web/src/components/reports-page.tsx): `apps/web/src/components/reports-page.tsx`
- [Login screen](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/web/src/components/login-form.tsx): `apps/web/src/components/login-form.tsx`
- [Flutter shift prototype](https://github.com/dushansenura/carenest-senior-resident-management-system/tree/main/apps/mobile): `apps/mobile`

### Identity and accounts

- [Authentication routes](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/auth/auth.controller.ts): `apps/api/src/auth/auth.controller.ts`
- [Login and sessions](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/auth/auth.service.ts): `apps/api/src/auth/auth.service.ts`
- [JWT verification](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/auth/jwt-auth.guard.ts): `apps/api/src/auth/jwt-auth.guard.ts`
- [Account preferences](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/settings/settings.service.ts): `apps/api/src/settings/settings.service.ts`
- [Staff and guests](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/staff/staff.service.ts): `apps/api/src/staff/staff.service.ts`

### Resident and clinical care

- [Residents and admissions](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/residents/residents.service.ts): `apps/api/src/residents/residents.service.ts`
- [Care plans](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/care-plans/care-plans.service.ts): `apps/api/src/care-plans/care-plans.service.ts`
- [Daily health reports](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/daily-health/daily-health.service.ts): `apps/api/src/daily-health/daily-health.service.ts`
- [Medication and stock](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/medications/medications.service.ts): `apps/api/src/medications/medications.service.ts`

### Operations and reporting

- [Tasks and shifts](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/tasks-shifts/tasks-shifts.service.ts): `apps/api/src/tasks-shifts/tasks-shifts.service.ts`
- [Operational records](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/operations/operations.service.ts): `apps/api/src/operations/operations.service.ts`
- [Dashboard summary](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/dashboard/dashboard.controller.ts): `apps/api/src/dashboard/dashboard.controller.ts`

### API and persistence

- [NestJS API](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/app.module.ts): `apps/api/src/app.module.ts`
- [PostgreSQL data](https://github.com/dushansenura/carenest-senior-resident-management-system/blob/main/apps/api/src/prisma.service.ts): `apps/api/src/prisma.service.ts`

### Other components

- **Care staff**

## Connections

- Care staff → Staff portal: uses (evidence: `README.md`)
- Staff portal → Login screen: presents login
- Login screen → Authentication routes: submits credentials (evidence: `README.md`)
- Staff portal → NestJS API: uses REST API (evidence: `README.md`)
- Authentication routes → Login and sessions: dispatches login (evidence: `apps/api/src/auth/auth.controller.ts`)
- Login and sessions → PostgreSQL data: reads account, writes session (evidence: `apps/api/src/auth/auth.service.ts`)
- NestJS API → Residents and admissions: registers routes (evidence: `apps/api/src/app.module.ts`)
- NestJS API → Care plans: registers routes (evidence: `apps/api/src/app.module.ts`)
- NestJS API → Daily health reports: registers routes (evidence: `apps/api/src/app.module.ts`)
- NestJS API → Medication and stock: registers routes (evidence: `apps/api/src/app.module.ts`)
- Residents and admissions → PostgreSQL data: reads and writes (evidence: `apps/api/src/residents/residents.service.ts`)
- Care plans → PostgreSQL data: reads and writes (evidence: `apps/api/src/care-plans/care-plans.service.ts`)
- Daily health reports → PostgreSQL data: reads and writes (evidence: `apps/api/src/daily-health/daily-health.service.ts`)
- Medication and stock → PostgreSQL data: reads and writes (evidence: `apps/api/src/medications/medications.service.ts`)
- NestJS API → Staff and guests: registers routes (evidence: `apps/api/src/app.module.ts`)
- Staff and guests → PostgreSQL data: reads and writes (evidence: `apps/api/src/staff/staff.service.ts`)
- NestJS API → Account preferences: registers routes (evidence: `apps/api/src/app.module.ts`)
- Account preferences → PostgreSQL data: reads and writes (evidence: `apps/api/src/settings/settings.service.ts`)
- NestJS API → Tasks and shifts: registers routes (evidence: `apps/api/src/app.module.ts`)
- Tasks and shifts → PostgreSQL data: reads and writes (evidence: `apps/api/src/tasks-shifts/tasks-shifts.service.ts`)
- NestJS API → Operational records: registers routes (evidence: `apps/api/src/app.module.ts`)
- Operational records → PostgreSQL data: reads and writes (evidence: `apps/api/src/operations/operations.service.ts`)
- NestJS API → Dashboard summary: registers route (evidence: `apps/api/src/app.module.ts`)
- Dashboard summary → PostgreSQL data: queries summary (evidence: `apps/api/src/dashboard/dashboard.controller.ts`)
- Staff portal → Local operations: offers local screens (evidence: `README.md`)
- Staff portal → Reports and exports: offers exports (evidence: `README.md`)
- Flutter shift prototype → NestJS API: fetches residents (evidence: `README.md`)
