# bahmni/bahmni-apps-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/bahmni/bahmni-apps-frontend
- Repository: https://github.com/bahmni/bahmni-apps-frontend

## Overview

Bahmni Apps Frontend is a React/TypeScript healthcare monorepo: a browser-hosted suite of clinical, patient, scheduling, administrative, reporting, and document workflows backed by shared services and widgets. Users enter through the distro shell or an app, then use domain screens to search or manage patient and encounter data. The graph highlights registration and encounter-session behavior where source was sampled, while retaining major app areas visible in the tree. Unsampled app internals and shell-to-app wiring are not asserted; dashed edges indicate unverified integration.

Main entry points: [`distro/src/app/app.tsx`](https://github.com/bahmni/bahmni-apps-frontend/blob/main/distro/src/app/app.tsx) (Browser shell), [`packages/bahmni-services/src/api/api.ts`](https://github.com/bahmni/bahmni-apps-frontend/blob/main/packages/bahmni-services/src/api/api.ts) (Service API client), [`apps/registration/src/components/forms/patientRelationships/useRelationshipManager.ts`](https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/registration/src/components/forms/patientRelationships/useRelationshipManager.ts) (Relationship manager), [`apps/clinical/src/pages/ConsultationPage.tsx`](https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/clinical/src/pages/ConsultationPage.tsx) (Clinical consultation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["Application shell"]
  node_distro["Browser shell<br/>[app.tsx]"]
  node_admin["Administration<br/>[AuditLog.tsx]"]
  node_appointments["Appointments<br/>[index.tsx]"]
  node_reports["Reports<br/>[index.tsx]"]
  node_home["Home dashboard<br/>[HomePage.tsx]"]
end

subgraph group_patient["Patient workflows"]
  node_registration["Patient registration"]
  node_relationship_manager["Relationship manager"]
  node_patient_search["Patient search"]
  node_relationship_validation["Relationship validation"]
  node_documents["Patient documents<br/>[Index.tsx]"]
end

subgraph group_clinical["Clinical workflows"]
  node_clinical_consult["Clinical consultation"]
  node_clinical_forms["Clinical forms<br/>[renderer.tsx]"]
  node_encounter_service["Encounter sessions"]
end

subgraph group_shared["Shared platform"]
  node_services_api["Service API client<br/>[api.ts]"]
  node_auth["Session authentication<br/>[authService.ts]"]
  node_widgets["Reusable widgets"]
  node_design_system["Design system<br/>[index.tsx]"]
  node_command_palette["Command palette"]
end

node_user(("Healthcare user"))
node_external_emr[("OpenMRS FHIR service")]

node_user -.->|"opens app"| node_distro
node_distro -.->|"hosts app"| node_admin
node_distro -.->|"hosts app"| node_appointments
node_distro -.->|"hosts app"| node_clinical_consult
node_distro -.->|"hosts app"| node_registration
node_distro -.->|"hosts app"| node_documents
node_distro -.->|"hosts app"| node_reports
node_distro -.->|"hosts app"| node_home
node_registration -.->|"uses relationships"| node_relationship_manager
node_relationship_manager -->|"searches patients"| node_patient_search
node_relationship_manager -->|"validates rows"| node_relationship_validation
node_patient_search -.->|"searches records"| node_services_api
node_clinical_consult -.->|"renders forms"| node_clinical_forms
node_clinical_consult -.->|"checks session"| node_encounter_service
node_encounter_service -->|"requests data"| node_services_api
node_encounter_service -.->|"queries encounters"| node_external_emr
node_auth -->|"checks session"| node_services_api
node_services_api -.->|"transfers FHIR data"| node_external_emr
node_command_palette -.->|"uses search"| node_widgets
node_widgets -.->|"searches patients"| node_services_api
node_distro -.->|"applies theme"| node_design_system

click node_distro "https://github.com/bahmni/bahmni-apps-frontend/blob/main/distro/src/app/app.tsx"
click node_admin "https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/admin/src/pages/AuditLog.tsx"
click node_appointments "https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/appointments/src/routes/index.tsx"
click node_reports "https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/reports/src/routes/index.tsx"
click node_home "https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/home/src/components/HomePage/HomePage.tsx"
click node_registration "https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/registration/src/pages/PatientRegister/PatientRegister.tsx"
click node_relationship_manager "https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/registration/src/components/forms/patientRelationships/useRelationshipManager.ts"
click node_patient_search "https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/registration/src/hooks/usePatientSearch.ts"
click node_relationship_validation "https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/registration/src/hooks/useRelationshipValidation.ts"
click node_documents "https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/patient-documents/src/pages/Index.tsx"
click node_clinical_consult "https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/clinical/src/pages/ConsultationPage.tsx"
click node_clinical_forms "https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/clinical/src/components/forms/renderer.tsx"
click node_encounter_service "https://github.com/bahmni/bahmni-apps-frontend/blob/main/packages/bahmni-services/src/encounterSessionService/encounterSessionService.ts"
click node_services_api "https://github.com/bahmni/bahmni-apps-frontend/blob/main/packages/bahmni-services/src/api/api.ts"
click node_auth "https://github.com/bahmni/bahmni-apps-frontend/blob/main/packages/bahmni-services/src/authService/authService.ts"
click node_widgets "https://github.com/bahmni/bahmni-apps-frontend/blob/main/packages/bahmni-widgets/src/commandPalette/useCommandPaletteSearch.ts"
click node_design_system "https://github.com/bahmni/bahmni-apps-frontend/blob/main/packages/bahmni-design-system/src/atoms/button/index.tsx"
click node_command_palette "https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/command-palette/src/components/CommandPaletteProvider/CommandPaletteProvider.tsx"

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_distro,node_admin,node_appointments,node_reports,node_home,node_user toneBlue
class node_registration,node_relationship_manager,node_patient_search,node_relationship_validation,node_documents,node_external_emr toneAmber
class node_clinical_consult,node_clinical_forms,node_encounter_service toneMint
class node_services_api,node_auth,node_widgets,node_design_system,node_command_palette toneRose
```

## Components

### Application shell

- [Browser shell](https://github.com/bahmni/bahmni-apps-frontend/blob/main/distro/src/app/app.tsx): `distro/src/app/app.tsx`
- [Administration](https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/admin/src/pages/AuditLog.tsx): `apps/admin/src/pages/AuditLog.tsx`
- [Appointments](https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/appointments/src/routes/index.tsx): `apps/appointments/src/routes/index.tsx`
- [Reports](https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/reports/src/routes/index.tsx): `apps/reports/src/routes/index.tsx`
- [Home dashboard](https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/home/src/components/HomePage/HomePage.tsx): `apps/home/src/components/HomePage/HomePage.tsx`

### Patient workflows

- [Patient registration](https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/registration/src/pages/PatientRegister/PatientRegister.tsx): `apps/registration/src/pages/PatientRegister/PatientRegister.tsx`
- [Relationship manager](https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/registration/src/components/forms/patientRelationships/useRelationshipManager.ts): `apps/registration/src/components/forms/patientRelationships/useRelationshipManager.ts`
- [Patient search](https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/registration/src/hooks/usePatientSearch.ts): `apps/registration/src/hooks/usePatientSearch.ts`
- [Relationship validation](https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/registration/src/hooks/useRelationshipValidation.ts): `apps/registration/src/hooks/useRelationshipValidation.ts`
- [Patient documents](https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/patient-documents/src/pages/Index.tsx): `apps/patient-documents/src/pages/Index.tsx`

### Clinical workflows

- [Clinical consultation](https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/clinical/src/pages/ConsultationPage.tsx): `apps/clinical/src/pages/ConsultationPage.tsx`
- [Clinical forms](https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/clinical/src/components/forms/renderer.tsx): `apps/clinical/src/components/forms/renderer.tsx`
- [Encounter sessions](https://github.com/bahmni/bahmni-apps-frontend/blob/main/packages/bahmni-services/src/encounterSessionService/encounterSessionService.ts): `packages/bahmni-services/src/encounterSessionService/encounterSessionService.ts`

### Shared platform

- [Service API client](https://github.com/bahmni/bahmni-apps-frontend/blob/main/packages/bahmni-services/src/api/api.ts): `packages/bahmni-services/src/api/api.ts`
- [Session authentication](https://github.com/bahmni/bahmni-apps-frontend/blob/main/packages/bahmni-services/src/authService/authService.ts): `packages/bahmni-services/src/authService/authService.ts`
- [Reusable widgets](https://github.com/bahmni/bahmni-apps-frontend/blob/main/packages/bahmni-widgets/src/commandPalette/useCommandPaletteSearch.ts): `packages/bahmni-widgets/src/commandPalette/useCommandPaletteSearch.ts`
- [Design system](https://github.com/bahmni/bahmni-apps-frontend/blob/main/packages/bahmni-design-system/src/atoms/button/index.tsx): `packages/bahmni-design-system/src/atoms/button/index.tsx`
- [Command palette](https://github.com/bahmni/bahmni-apps-frontend/blob/main/apps/command-palette/src/components/CommandPaletteProvider/CommandPaletteProvider.tsx): `apps/command-palette/src/components/CommandPaletteProvider/CommandPaletteProvider.tsx`

### Other components

- **Healthcare user**
- **OpenMRS FHIR service**

## Connections

- Healthcare user → Browser shell: opens app
- Browser shell → Administration: hosts app
- Browser shell → Appointments: hosts app
- Browser shell → Clinical consultation: hosts app
- Browser shell → Patient registration: hosts app
- Browser shell → Patient documents: hosts app
- Browser shell → Reports: hosts app
- Browser shell → Home dashboard: hosts app
- Patient registration → Relationship manager: uses relationships
- Relationship manager → Patient search: searches patients (evidence: `apps/registration/src/components/forms/patientRelationships/useRelationshipManager.ts`)
- Relationship manager → Relationship validation: validates rows (evidence: `apps/registration/src/components/forms/patientRelationships/useRelationshipManager.ts`)
- Patient search → Service API client: searches records
- Clinical consultation → Clinical forms: renders forms
- Clinical consultation → Encounter sessions: checks session
- Encounter sessions → Service API client: requests data (evidence: `packages/bahmni-services/src/encounterSessionService/encounterSessionService.ts`)
- Encounter sessions → OpenMRS FHIR service: queries encounters
- Session authentication → Service API client: checks session (evidence: `packages/bahmni-services/src/authService/authService.ts`)
- Service API client → OpenMRS FHIR service: transfers FHIR data
- Command palette → Reusable widgets: uses search
- Reusable widgets → Service API client: searches patients
- Browser shell → Design system: applies theme
