# dudd203204/pj-01-clinic-management-fe architecture

> Architecture diagram of the GitHub repository dudd203204/pj-01-clinic-management-fe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dudd203204/pj-01-clinic-management-fe
- Repository: https://github.com/dudd203204/pj-01-clinic-management-fe

## Overview

This is a React frontend for managing a private medical clinic. Staff sign in, then use role-protected screens to register patients, manage examination queues, record consultations and prescriptions, handle billing, and review reports; administrators maintain accounts, permissions, and clinic rules. The README also identifies medicine-lot inventory and stock warnings as product capabilities. The graph follows documented routes and sampled calls; unsampled feature internals and backend persistence are not inferred.

Main entry points: [`src/redux/action/fetchDataAction`](https://github.com/dudd203204/pj-01-clinic-management-fe/tree/master/src/redux/action/fetchDataAction) (Data fetch actions), [`src/helpers/authHelper.js`](https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/helpers/authHelper.js) (Route protection), [`src/App.js`](https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/App.js) (App router), [`src/pages/KhamBenh/index.js`](https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/pages/KhamBenh/index.js) (Examination queue)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and navigation"]
  node_app["App router<br/>[App.js]"]
  node_auth["Authentication<br/>[index.js]"]
  node_accesscontrol["Route protection<br/>[authHelper.js]"]
end

subgraph group_clinic["Clinic operations"]
  node_registration["Patient registration"]
  node_examqueue["Examination queue<br/>[index.js]"]
  node_consult["Consultation records<br/>[index.js]"]
  node_prescription["Prescriptions<br/>[index.js]"]
  node_clinicaltests["Clinical services<br/>[index.js]"]
  node_patientlookup["Patient lookup<br/>[index.js]"]
  node_billing["Billing<br/>[index.js]"]
  node_inventory["Medicine inventory<br/>[index.js]"]
  node_reports["Clinic reports"]
end

subgraph group_admin["Administration"]
  node_accounts["Account management<br/>[index.js]"]
  node_permissions["Role permissions<br/>[index.js]"]
  node_clinicrules["Clinic rules"]
end

subgraph group_state["Application data"]
  node_clientstate["Redux state<br/>[store.js]"]
  node_fetchactions["Data fetch actions"]
  node_authstate["Authentication state<br/>[authSlices.js]"]
  node_httpclient["HTTP client<br/>[axios.js]"]
end

node_staff(("Clinic staff"))
node_backend["Clinic backend"]
node_realtime["Socket service"]

node_staff -->|"uses"| node_app
node_app -->|"routes publicly"| node_auth
node_app -->|"protects private routes"| node_accesscontrol
node_accesscontrol -->|"permits access"| node_registration
node_accesscontrol -->|"permits access"| node_examqueue
node_accesscontrol -->|"permits access"| node_patientlookup
node_accesscontrol -->|"permits access"| node_inventory
node_accesscontrol -->|"permits access"| node_reports
node_accesscontrol -->|"permits access"| node_accounts
node_accesscontrol -->|"permits access"| node_permissions
node_accesscontrol -->|"permits access"| node_clinicrules
node_auth -->|"updates identity"| node_clientstate
node_auth -->|"submits credentials"| node_httpclient
node_app -->|"loads account"| node_authstate
node_app -->|"subscribes events"| node_realtime
node_registration -.->|"requests registration data"| node_fetchactions
node_examqueue -->|"loads queue"| node_fetchactions
node_examqueue -->|"opens selected record"| node_consult
node_examqueue -->|"opens selected record"| node_prescription
node_examqueue -.->|"opens selected record"| node_clinicaltests
node_patientlookup -.->|"loads patient records"| node_fetchactions
node_billing -.->|"loads invoices"| node_fetchactions
node_inventory -->|"loads stock data"| node_fetchactions
node_reports -.->|"loads statistics"| node_fetchactions
node_accounts -->|"loads accounts"| node_fetchactions
node_permissions -->|"loads roles"| node_fetchactions
node_clinicrules -.->|"loads clinic settings"| node_fetchactions
node_fetchactions -->|"sends requests"| node_httpclient
node_httpclient -->|"calls API"| node_backend
node_fetchactions -->|"fills Redux state"| node_clientstate
node_realtime -->|"notifies changes"| node_app
node_app -->|"dispatches refresh"| node_fetchactions
node_fetchactions -.->|"retrieves clinic data"| node_backend

click node_app "https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/App.js"
click node_auth "https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/pages/Login/index.js"
click node_accesscontrol "https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/helpers/authHelper.js"
click node_registration "https://github.com/dudd203204/pj-01-clinic-management-fe/tree/master/src/pages/TiepDon"
click node_examqueue "https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/pages/KhamBenh/index.js"
click node_consult "https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/popups/CTKhamBenh/subTabs/TTK/index.js"
click node_prescription "https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/popups/CTKhamBenh/subTabs/DT/index.js"
click node_clinicaltests "https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/pages/KhamBenh/CanLamSang/index.js"
click node_patientlookup "https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/pages/KhachHang/index.js"
click node_billing "https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/popups/ThanhToan/index.js"
click node_inventory "https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/pages/Thuoc/index.js"
click node_reports "https://github.com/dudd203204/pj-01-clinic-management-fe/tree/master/src/pages/Dashboard"
click node_accounts "https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/pages/Admin/tabpages/DSTaiKhoan/index.js"
click node_permissions "https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/pages/Admin/tabpages/PhanQuyen/index.js"
click node_clinicrules "https://github.com/dudd203204/pj-01-clinic-management-fe/tree/master/src/pages/Admin/tabpages/QuyDinh"
click node_clientstate "https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/redux/store.js"
click node_fetchactions "https://github.com/dudd203204/pj-01-clinic-management-fe/tree/master/src/redux/action/fetchDataAction"
click node_authstate "https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/redux/slice/other/authSlices.js"
click node_httpclient "https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/setup/axios.js"

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_auth,node_accesscontrol toneBlue
class node_registration,node_examqueue,node_consult,node_prescription,node_clinicaltests,node_patientlookup,node_billing,node_inventory,node_reports toneAmber
class node_accounts,node_permissions,node_clinicrules toneMint
class node_clientstate,node_fetchactions,node_authstate,node_httpclient toneRose
class node_staff,node_backend,node_realtime toneIndigo
```

## Components

### Access and navigation

- [App router](https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/App.js): `src/App.js`
- [Authentication](https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/pages/Login/index.js): `src/pages/Login/index.js`
- [Route protection](https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/helpers/authHelper.js): `src/helpers/authHelper.js`

### Clinic operations

- [Patient registration](https://github.com/dudd203204/pj-01-clinic-management-fe/tree/master/src/pages/TiepDon): `src/pages/TiepDon`
- [Examination queue](https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/pages/KhamBenh/index.js): `src/pages/KhamBenh/index.js`
- [Consultation records](https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/popups/CTKhamBenh/subTabs/TTK/index.js): `src/popups/CTKhamBenh/subTabs/TTK/index.js`
- [Prescriptions](https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/popups/CTKhamBenh/subTabs/DT/index.js): `src/popups/CTKhamBenh/subTabs/DT/index.js`
- [Clinical services](https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/pages/KhamBenh/CanLamSang/index.js): `src/pages/KhamBenh/CanLamSang/index.js`
- [Patient lookup](https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/pages/KhachHang/index.js): `src/pages/KhachHang/index.js`
- [Billing](https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/popups/ThanhToan/index.js): `src/popups/ThanhToan/index.js`
- [Medicine inventory](https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/pages/Thuoc/index.js): `src/pages/Thuoc/index.js`
- [Clinic reports](https://github.com/dudd203204/pj-01-clinic-management-fe/tree/master/src/pages/Dashboard): `src/pages/Dashboard`

### Administration

- [Account management](https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/pages/Admin/tabpages/DSTaiKhoan/index.js): `src/pages/Admin/tabpages/DSTaiKhoan/index.js`
- [Role permissions](https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/pages/Admin/tabpages/PhanQuyen/index.js): `src/pages/Admin/tabpages/PhanQuyen/index.js`
- [Clinic rules](https://github.com/dudd203204/pj-01-clinic-management-fe/tree/master/src/pages/Admin/tabpages/QuyDinh): `src/pages/Admin/tabpages/QuyDinh`

### Application data

- [Redux state](https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/redux/store.js): `src/redux/store.js`
- [Data fetch actions](https://github.com/dudd203204/pj-01-clinic-management-fe/tree/master/src/redux/action/fetchDataAction): `src/redux/action/fetchDataAction`
- [Authentication state](https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/redux/slice/other/authSlices.js): `src/redux/slice/other/authSlices.js`
- [HTTP client](https://github.com/dudd203204/pj-01-clinic-management-fe/blob/master/src/setup/axios.js): `src/setup/axios.js`

### Other components

- **Clinic staff**
- **Clinic backend**
- **Socket service**

## Connections

- Clinic staff → App router: uses (evidence: `src/App.js`)
- App router → Authentication: routes publicly
- App router → Route protection: protects private routes (evidence: `src/App.js`)
- Route protection → Patient registration: permits access
- Route protection → Examination queue: permits access
- Route protection → Patient lookup: permits access
- Route protection → Medicine inventory: permits access
- Route protection → Clinic reports: permits access
- Route protection → Account management: permits access
- Route protection → Role permissions: permits access
- Route protection → Clinic rules: permits access
- Authentication → Redux state: updates identity
- Authentication → HTTP client: submits credentials
- App router → Authentication state: loads account (evidence: `src/App.js`)
- App router → Socket service: subscribes events (evidence: `src/App.js`)
- Patient registration → Data fetch actions: requests registration data
- Examination queue → Data fetch actions: loads queue (evidence: `src/pages/KhamBenh/index.js`)
- Examination queue → Consultation records: opens selected record
- Examination queue → Prescriptions: opens selected record
- Examination queue → Clinical services: opens selected record
- Patient lookup → Data fetch actions: loads patient records
- Billing → Data fetch actions: loads invoices
- Medicine inventory → Data fetch actions: loads stock data (evidence: `src/pages/Thuoc/index.js`)
- Clinic reports → Data fetch actions: loads statistics (evidence: `src/pages/Dashboard/DichVu/index.js`)
- Account management → Data fetch actions: loads accounts
- Role permissions → Data fetch actions: loads roles
- Clinic rules → Data fetch actions: loads clinic settings
- Data fetch actions → HTTP client: sends requests (evidence: `src/redux/action/fetchDataAction/fetchDSDKAction.js`)
- HTTP client → Clinic backend: calls API (evidence: `src/setup/axios.js`)
- Data fetch actions → Redux state: fills Redux state (evidence: `src/redux/store.js`)
- Socket service → App router: notifies changes (evidence: `src/App.js`)
- App router → Data fetch actions: dispatches refresh (evidence: `src/App.js`)
- Data fetch actions → Clinic backend: retrieves clinic data
