# ibeneme/medbrainers architecture

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

- Interactive diagram: https://gitdiagram.com/ibeneme/medbrainers
- Repository: https://github.com/ibeneme/medbrainers

## Overview

Medbrainers is a hospital operations and electronic medical-record web application. A staff member enters the dashboard, selects a clinical or administrative workflow, and uses its screens to manage facility, patient, and operational records; the frontend exposes these domains through Redux API slices. The graph preserves major workflows evident from the route tree, including emergency, maternal care, blood bank, pharmacy, radiology, and telemedicine. Source excerpts verify selected API, access-control, and component relationships; links for unsampled domain implementations are omitted rather than inferred.

Main entry points: [`src/app/dashboard`](https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard) (Dashboard routes), [`src/api/hooks.ts`](https://github.com/ibeneme/medbrainers/blob/main/src/api/hooks.ts) (Redux hooks), [`src/api/slices.ts`](https://github.com/ibeneme/medbrainers/blob/main/src/api/slices.ts) (Domain reducers), [`src/hooks/useAccess.ts`](https://github.com/ibeneme/medbrainers/blob/main/src/hooks/useAccess.ts) (Access decisions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Dashboard and entry"]
  node_dashboard["Dashboard routes"]
end

subgraph group_clinical["Clinical operations"]
  node_patient["Patient records"]
  node_consult["Consultations"]
  node_emergency["Emergency care"]
  node_maternity["Maternal care"]
  node_blood["Blood bank"]
  node_labs["Laboratory"]
  node_radiology["Radiology"]
  node_telemedicine["Telemedicine"]
  node_theater["Theater"]
  node_wards["Wards"]
  node_tele_session["Session browser<br/>[SessionBrowser.tsx]"]
end

subgraph group_operations["Facility operations"]
  node_pharmacy["Pharmacy"]
  node_appointments["Appointments"]
  node_workspace["Facility workspace<br/>[page.tsx]"]
  node_notifications["Notifications<br/>[page.tsx]"]
end

subgraph group_platform["Frontend platform"]
  node_access["Access decisions<br/>[useAccess.ts]"]
  node_guarded["Guarded links<br/>[guarded-link.tsx]"]
  node_permission_rules["Permission rules<br/>[permissions.ts]"]
  node_module_shell["Module shell<br/>[ModuleShell.tsx]"]
end

subgraph group_api["API and state"]
  node_redux_hooks["Redux hooks<br/>[hooks.ts]"]
  node_reducers["Domain reducers<br/>[slices.ts]"]
  node_auth["Authentication API<br/>[authSlice.ts]"]
  node_task_api["Task API<br/>[tasksSlice.ts]"]
  node_api_service["HTTP service<br/>[services.ts]"]
  node_api_config["API configuration<br/>[config.ts]"]
  node_dashboard_hook["Dashboard data hook<br/>[useDashboard.ts]"]
end

node_staff(("Staff user"))

node_staff -.->|"uses"| node_dashboard
node_dashboard -.->|"opens"| node_patient
node_dashboard -.->|"opens"| node_consult
node_dashboard -.->|"opens"| node_emergency
node_dashboard -.->|"opens"| node_maternity
node_dashboard -.->|"opens"| node_blood
node_dashboard -.->|"opens"| node_labs
node_dashboard -.->|"opens"| node_radiology
node_dashboard -.->|"opens"| node_pharmacy
node_dashboard -.->|"opens"| node_appointments
node_dashboard -.->|"opens"| node_telemedicine
node_dashboard -.->|"opens"| node_theater
node_dashboard -.->|"opens"| node_wards
node_dashboard -.->|"opens"| node_workspace
node_dashboard -.->|"opens"| node_notifications
node_patient -->|"uses"| node_redux_hooks
node_consult -->|"uses"| node_redux_hooks
node_notifications -->|"uses"| node_redux_hooks
node_notifications -->|"uses"| node_reducers
node_workspace -->|"dispatches"| node_reducers
node_redux_hooks -.->|"selects"| node_reducers
node_reducers -->|"registers"| node_auth
node_reducers -->|"registers"| node_task_api
node_auth -->|"uses"| node_api_service
node_task_api -->|"uses"| node_api_service
node_api_service -->|"configures"| node_api_config
node_access -->|"reads"| node_redux_hooks
node_access -->|"checks"| node_permission_rules
node_guarded -->|"checks"| node_access
node_tele_session -->|"uses"| node_module_shell
node_tele_session -->|"gates with"| node_access
node_tele_session -->|"uses"| node_dashboard_hook
node_dashboard_hook -->|"uses"| node_redux_hooks

click node_dashboard "https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard"
click node_patient "https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/patients"
click node_consult "https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/consultations"
click node_emergency "https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/emergency"
click node_maternity "https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/maternal"
click node_blood "https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/blood-bank"
click node_labs "https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/labs"
click node_radiology "https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/radiology"
click node_pharmacy "https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/pharmacy"
click node_appointments "https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/appointments"
click node_telemedicine "https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/telemedicine"
click node_theater "https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/theater"
click node_wards "https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/wards"
click node_workspace "https://github.com/ibeneme/medbrainers/blob/main/src/app/dashboard/workspace/page.tsx"
click node_notifications "https://github.com/ibeneme/medbrainers/blob/main/src/app/dashboard/notifications/page.tsx"
click node_access "https://github.com/ibeneme/medbrainers/blob/main/src/hooks/useAccess.ts"
click node_guarded "https://github.com/ibeneme/medbrainers/blob/main/src/components/access/guarded-link.tsx"
click node_permission_rules "https://github.com/ibeneme/medbrainers/blob/main/src/lib/access/permissions.ts"
click node_redux_hooks "https://github.com/ibeneme/medbrainers/blob/main/src/api/hooks.ts"
click node_reducers "https://github.com/ibeneme/medbrainers/blob/main/src/api/slices.ts"
click node_auth "https://github.com/ibeneme/medbrainers/blob/main/src/api/slices/authSlice.ts"
click node_task_api "https://github.com/ibeneme/medbrainers/blob/main/src/api/slices/tasksSlice.ts"
click node_api_service "https://github.com/ibeneme/medbrainers/blob/main/src/api/services.ts"
click node_api_config "https://github.com/ibeneme/medbrainers/blob/main/src/api/config.ts"
click node_tele_session "https://github.com/ibeneme/medbrainers/blob/main/src/components/telemedicine/SessionBrowser.tsx"
click node_module_shell "https://github.com/ibeneme/medbrainers/blob/main/src/components/dashboard/ModuleShell.tsx"
click node_dashboard_hook "https://github.com/ibeneme/medbrainers/blob/main/src/hooks/useDashboard.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_dashboard,node_staff toneBlue
class node_patient,node_consult,node_emergency,node_maternity,node_blood,node_labs,node_radiology,node_telemedicine,node_theater,node_wards,node_tele_session toneAmber
class node_pharmacy,node_appointments,node_workspace,node_notifications toneMint
class node_access,node_guarded,node_permission_rules,node_module_shell toneRose
class node_redux_hooks,node_reducers,node_auth,node_task_api,node_api_service,node_api_config,node_dashboard_hook toneIndigo
```

## Components

### Dashboard and entry

- [Dashboard routes](https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard): `src/app/dashboard`

### Clinical operations

- [Patient records](https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/patients): `src/app/dashboard/patients`
- [Consultations](https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/consultations): `src/app/dashboard/consultations`
- [Emergency care](https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/emergency): `src/app/dashboard/emergency`
- [Maternal care](https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/maternal): `src/app/dashboard/maternal`
- [Blood bank](https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/blood-bank): `src/app/dashboard/blood-bank`
- [Laboratory](https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/labs): `src/app/dashboard/labs`
- [Radiology](https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/radiology): `src/app/dashboard/radiology`
- [Telemedicine](https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/telemedicine): `src/app/dashboard/telemedicine`
- [Theater](https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/theater): `src/app/dashboard/theater`
- [Wards](https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/wards): `src/app/dashboard/wards`
- [Session browser](https://github.com/ibeneme/medbrainers/blob/main/src/components/telemedicine/SessionBrowser.tsx): `src/components/telemedicine/SessionBrowser.tsx`

### Facility operations

- [Pharmacy](https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/pharmacy): `src/app/dashboard/pharmacy`
- [Appointments](https://github.com/ibeneme/medbrainers/tree/main/src/app/dashboard/appointments): `src/app/dashboard/appointments`
- [Facility workspace](https://github.com/ibeneme/medbrainers/blob/main/src/app/dashboard/workspace/page.tsx): `src/app/dashboard/workspace/page.tsx`
- [Notifications](https://github.com/ibeneme/medbrainers/blob/main/src/app/dashboard/notifications/page.tsx): `src/app/dashboard/notifications/page.tsx`

### Frontend platform

- [Access decisions](https://github.com/ibeneme/medbrainers/blob/main/src/hooks/useAccess.ts): `src/hooks/useAccess.ts`
- [Guarded links](https://github.com/ibeneme/medbrainers/blob/main/src/components/access/guarded-link.tsx): `src/components/access/guarded-link.tsx`
- [Permission rules](https://github.com/ibeneme/medbrainers/blob/main/src/lib/access/permissions.ts): `src/lib/access/permissions.ts`
- [Module shell](https://github.com/ibeneme/medbrainers/blob/main/src/components/dashboard/ModuleShell.tsx): `src/components/dashboard/ModuleShell.tsx`

### API and state

- [Redux hooks](https://github.com/ibeneme/medbrainers/blob/main/src/api/hooks.ts): `src/api/hooks.ts`
- [Domain reducers](https://github.com/ibeneme/medbrainers/blob/main/src/api/slices.ts): `src/api/slices.ts`
- [Authentication API](https://github.com/ibeneme/medbrainers/blob/main/src/api/slices/authSlice.ts): `src/api/slices/authSlice.ts`
- [Task API](https://github.com/ibeneme/medbrainers/blob/main/src/api/slices/tasksSlice.ts): `src/api/slices/tasksSlice.ts`
- [HTTP service](https://github.com/ibeneme/medbrainers/blob/main/src/api/services.ts): `src/api/services.ts`
- [API configuration](https://github.com/ibeneme/medbrainers/blob/main/src/api/config.ts): `src/api/config.ts`
- [Dashboard data hook](https://github.com/ibeneme/medbrainers/blob/main/src/hooks/useDashboard.ts): `src/hooks/useDashboard.ts`

### Other components

- **Staff user**

## Connections

- Staff user → Dashboard routes: uses
- Dashboard routes → Patient records: opens
- Dashboard routes → Consultations: opens
- Dashboard routes → Emergency care: opens
- Dashboard routes → Maternal care: opens
- Dashboard routes → Blood bank: opens
- Dashboard routes → Laboratory: opens
- Dashboard routes → Radiology: opens
- Dashboard routes → Pharmacy: opens
- Dashboard routes → Appointments: opens
- Dashboard routes → Telemedicine: opens
- Dashboard routes → Theater: opens
- Dashboard routes → Wards: opens
- Dashboard routes → Facility workspace: opens
- Dashboard routes → Notifications: opens
- Patient records → Redux hooks: uses (evidence: `src/app/dashboard/patients/[patientId]/page.tsx`)
- Consultations → Redux hooks: uses (evidence: `src/app/dashboard/consultations/page.tsx`)
- Notifications → Redux hooks: uses (evidence: `src/app/dashboard/notifications/page.tsx`)
- Notifications → Domain reducers: uses (evidence: `src/app/dashboard/notifications/page.tsx`)
- Facility workspace → Domain reducers: dispatches (evidence: `src/app/dashboard/workspace/page.tsx`)
- Redux hooks → Domain reducers: selects
- Domain reducers → Authentication API: registers (evidence: `src/api/slices.ts`)
- Domain reducers → Task API: registers (evidence: `src/api/slices.ts`)
- Authentication API → HTTP service: uses (evidence: `src/api/slices/authSlice.ts`)
- Task API → HTTP service: uses (evidence: `src/api/slices/tasksSlice.ts`)
- HTTP service → API configuration: configures (evidence: `src/api/services.ts`)
- Access decisions → Redux hooks: reads (evidence: `src/hooks/useAccess.ts`)
- Access decisions → Permission rules: checks (evidence: `src/hooks/useAccess.ts`)
- Guarded links → Access decisions: checks (evidence: `src/components/access/guarded-link.tsx`)
- Session browser → Module shell: uses (evidence: `src/components/telemedicine/SessionBrowser.tsx`)
- Session browser → Access decisions: gates with (evidence: `src/components/telemedicine/SessionBrowser.tsx`)
- Session browser → Dashboard data hook: uses (evidence: `src/components/telemedicine/SessionBrowser.tsx`)
- Dashboard data hook → Redux hooks: uses (evidence: `src/hooks/useDashboard.ts`)
