# nova-technologies-p-l-c/nova-hms architecture

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

- Interactive diagram: https://gitdiagram.com/nova-technologies-p-l-c/nova-hms
- Repository: https://github.com/nova-technologies-p-l-c/nova-hms

## Overview

Ethiora HMS is a multi-tenant hospital management system. Staff and patients use role-specific Next.js screens; requests reach the Express/tRPC API, which resolves session and tenant context, applies protected procedures, and exposes hospital workflows backed by Prisma. Documented capabilities span patient registration and EMR, OPD, triage, clinical care, labs, pharmacy, billing, referrals, wards, administration, and platform tenancy. The graph includes these major areas, but several web pages and API routers were not sampled, so their internal calls are left unspecified.

Main entry points: [`packages/db/src/index.ts`](https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/db/src/index.ts) (Prisma Database), [`apps/server/src/index.ts`](https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/apps/server/src/index.ts) (Express Server), [`apps/web/src/app/nova`](https://github.com/nova-technologies-p-l-c/nova-hms/tree/main/apps/web/src/app/nova) (Role-Based Web App), [`packages/api/src/context.ts`](https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/context.ts) (Request Context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User Experience"]
  node_web["Role-Based Web App"]
  node_authclient["Auth Client<br/>[auth-client.ts]"]
end

subgraph group_runtime["API Runtime"]
  node_server["Express Server<br/>[index.ts]"]
  node_context["Request Context<br/>[context.ts]"]
  node_trpc["tRPC Procedures<br/>[index.ts]"]
  node_routermount["Router Mount<br/>[index.ts]"]
end

subgraph group_care["Care Workflows"]
  node_patientapi["Patient Records<br/>[patient.ts]"]
  node_visitapi["Visits and OPD<br/>[visit.ts]"]
  node_clinical["Clinical Care"]
  node_labs["Laboratory"]
  node_referrals["Referrals"]
  node_wards["Ward Management"]
end

subgraph group_operations["Hospital Operations"]
  node_billing["Billing and CBHI<br/>[billing.ts]"]
  node_pharmacy["Pharmacy Inventory"]
  node_admin["Hospital Administration<br/>[tenant.ts]"]
end

subgraph group_platform["Platform Services"]
  node_tenancy["Nova Tenancy<br/>[tenant.ts]"]
  node_catalog["HMIS Catalog<br/>[hmis-catalog.ts]"]
  node_notifications["Notifications<br/>[notification.ts]"]
  node_email["Email Service<br/>[email.ts]"]
  node_database[("Prisma Database<br/>[index.ts]")]
  node_auth["Session Authentication<br/>[index.ts]"]
end

node_staff(("Hospital Staff"))
node_patients(("Patients"))
node_emailprovider["Brevo Email"]

node_staff -->|"use staff screens"| node_web
node_patients -->|"use patient portal"| node_web
node_web -.->|"call API"| node_server
node_web -->|"authenticate with"| node_authclient
node_server -->|"mounts tRPC"| node_routermount
node_server -->|"creates context"| node_context
node_server -->|"mounts auth handler"| node_auth
node_context -->|"resolves session"| node_auth
node_context -->|"looks up role"| node_database
node_routermount -.->|"uses procedures"| node_trpc
node_patientapi -->|"reads and writes"| node_database
node_visitapi -->|"reads and writes"| node_database
node_billing -->|"reads and writes"| node_database
node_billing -->|"creates alerts"| node_notifications
node_admin -->|"configures tenant"| node_database
node_admin -->|"matches diagnoses"| node_catalog
node_email -->|"sends email"| node_emailprovider

click node_web "https://github.com/nova-technologies-p-l-c/nova-hms/tree/main/apps/web/src/app/nova"
click node_authclient "https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/apps/web/src/lib/auth-client.ts"
click node_server "https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/apps/server/src/index.ts"
click node_context "https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/context.ts"
click node_trpc "https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/index.ts"
click node_routermount "https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/routers/index.ts"
click node_patientapi "https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/routers/patient.ts"
click node_visitapi "https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/routers/visit.ts"
click node_clinical "https://github.com/nova-technologies-p-l-c/nova-hms/tree/main/packages/api/src/routers"
click node_labs "https://github.com/nova-technologies-p-l-c/nova-hms/tree/main/packages/api/src/routers"
click node_referrals "https://github.com/nova-technologies-p-l-c/nova-hms/tree/main/packages/api/src/routers"
click node_wards "https://github.com/nova-technologies-p-l-c/nova-hms/tree/main/packages/api/src/routers"
click node_billing "https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/routers/billing.ts"
click node_pharmacy "https://github.com/nova-technologies-p-l-c/nova-hms/tree/main/packages/api/src/routers"
click node_admin "https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/routers/tenant.ts"
click node_tenancy "https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/routers/tenant.ts"
click node_catalog "https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/constants/hmis-catalog.ts"
click node_notifications "https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/routers/notification.ts"
click node_email "https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/services/email.ts"
click node_database "https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/db/src/index.ts"
click node_auth "https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/auth/src/index.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_web,node_authclient toneBlue
class node_server,node_context,node_trpc,node_routermount toneAmber
class node_patientapi,node_visitapi,node_clinical,node_labs,node_referrals,node_wards toneMint
class node_billing,node_pharmacy,node_admin toneRose
class node_tenancy,node_catalog,node_notifications,node_email,node_database,node_auth,node_staff,node_patients,node_emailprovider toneIndigo
```

## Components

### User Experience

- [Role-Based Web App](https://github.com/nova-technologies-p-l-c/nova-hms/tree/main/apps/web/src/app/nova): `apps/web/src/app/nova`
- [Auth Client](https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/apps/web/src/lib/auth-client.ts): `apps/web/src/lib/auth-client.ts`

### API Runtime

- [Express Server](https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/apps/server/src/index.ts): `apps/server/src/index.ts`
- [Request Context](https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/context.ts): `packages/api/src/context.ts`
- [tRPC Procedures](https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/index.ts): `packages/api/src/index.ts`
- [Router Mount](https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/routers/index.ts): `packages/api/src/routers/index.ts`

### Care Workflows

- [Patient Records](https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/routers/patient.ts): `packages/api/src/routers/patient.ts`
- [Visits and OPD](https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/routers/visit.ts): `packages/api/src/routers/visit.ts`
- [Clinical Care](https://github.com/nova-technologies-p-l-c/nova-hms/tree/main/packages/api/src/routers): `packages/api/src/routers`
- [Laboratory](https://github.com/nova-technologies-p-l-c/nova-hms/tree/main/packages/api/src/routers): `packages/api/src/routers`
- [Referrals](https://github.com/nova-technologies-p-l-c/nova-hms/tree/main/packages/api/src/routers): `packages/api/src/routers`
- [Ward Management](https://github.com/nova-technologies-p-l-c/nova-hms/tree/main/packages/api/src/routers): `packages/api/src/routers`

### Hospital Operations

- [Billing and CBHI](https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/routers/billing.ts): `packages/api/src/routers/billing.ts`
- [Pharmacy Inventory](https://github.com/nova-technologies-p-l-c/nova-hms/tree/main/packages/api/src/routers): `packages/api/src/routers`
- [Hospital Administration](https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/routers/tenant.ts): `packages/api/src/routers/tenant.ts`

### Platform Services

- [Nova Tenancy](https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/routers/tenant.ts): `packages/api/src/routers/tenant.ts`
- [HMIS Catalog](https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/constants/hmis-catalog.ts): `packages/api/src/constants/hmis-catalog.ts`
- [Notifications](https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/routers/notification.ts): `packages/api/src/routers/notification.ts`
- [Email Service](https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/api/src/services/email.ts): `packages/api/src/services/email.ts`
- [Prisma Database](https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/db/src/index.ts): `packages/db/src/index.ts`
- [Session Authentication](https://github.com/nova-technologies-p-l-c/nova-hms/blob/main/packages/auth/src/index.ts): `packages/auth/src/index.ts`

### Other components

- **Hospital Staff**
- **Patients**
- **Brevo Email**

## Connections

- Hospital Staff → Role-Based Web App: use staff screens (evidence: `README.md`)
- Patients → Role-Based Web App: use patient portal (evidence: `README.md`)
- Role-Based Web App → Express Server: call API
- Role-Based Web App → Auth Client: authenticate with (evidence: `apps/web/src/lib/auth-client.ts`)
- Express Server → Router Mount: mounts tRPC (evidence: `apps/server/src/index.ts`)
- Express Server → Request Context: creates context (evidence: `apps/server/src/index.ts`)
- Express Server → Session Authentication: mounts auth handler (evidence: `apps/server/src/index.ts`)
- Request Context → Session Authentication: resolves session (evidence: `packages/api/src/context.ts`)
- Request Context → Prisma Database: looks up role (evidence: `packages/api/src/context.ts`)
- Router Mount → tRPC Procedures: uses procedures
- Patient Records → Prisma Database: reads and writes (evidence: `packages/api/src/routers/patient.ts`)
- Visits and OPD → Prisma Database: reads and writes (evidence: `packages/api/src/routers/visit.ts`)
- Billing and CBHI → Prisma Database: reads and writes (evidence: `packages/api/src/routers/billing.ts`)
- Billing and CBHI → Notifications: creates alerts (evidence: `packages/api/src/routers/billing.ts`)
- Hospital Administration → Prisma Database: configures tenant (evidence: `packages/api/src/routers/tenant.ts`)
- Hospital Administration → HMIS Catalog: matches diagnoses (evidence: `packages/api/src/routers/tenant.ts`)
- Email Service → Brevo Email: sends email (evidence: `packages/api/src/services/email.ts`)
