# apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system architecture

> Architecture diagram of the GitHub repository apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system
- Repository: https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system

## Overview

This is a Next.js healthcare appointment platform for discovering doctors, booking consultations, and supporting patient, doctor, and administrator workflows. The visible booking path runs from doctor discovery to appointment booking and patient appointment views; server actions and service modules connect selected features to an external API. The tree also shows authentication, clinical management, dashboards, public health resources, and an AI chatbot/RAG capability. Several routes and integrations are unsampled, so their internal links are omitted rather than inferred.

Main entry points: [`src/components/modules/Consultation/DoctorsList.tsx`](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/components/modules/Consultation/DoctorsList.tsx) (Doctor discovery), [`src/lib/axios/httpClient.ts`](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/lib/axios/httpClient.ts) (HTTP client), [`src/services/doctor.services.ts`](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/services/doctor.services.ts) (Doctor service), [`src/app/(commonLayout)/consultation/doctor/[id]/page.tsx`](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/app/(commonLayout)/consultation/doctor/%5Bid%5D/page.tsx) (Doctor profile)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public discovery"]
  node_home["Home and resources<br/>[page.tsx]"]
  node_doctor_discovery["Doctor discovery<br/>[DoctorsList.tsx]"]
  node_doctor_profile["Doctor profile<br/>[page.tsx]"]
  node_auth["Authentication"]
end

subgraph group_care["Appointments and care"]
  node_booking["Appointment booking"]
  node_booking_confirmation["Booking confirmation"]
  node_patient_appointments["Patient appointments"]
  node_appointment_actions["Appointment actions"]
  node_rag_action["RAG actions<br/>[rag.actions.ts]"]
  node_chatbot["Floating chatbot"]
end

subgraph group_operations["Role dashboards"]
  node_doctor_operations["Doctor workspace"]
  node_admin_operations["Administrator workspace"]
  node_patient_dashboard["Patient workspace"]
  node_admin_doctors["Doctor administration"]
  node_admin_schedules["Schedule administration"]
end

subgraph group_platform["Application services"]
  node_rag_service["RAG service<br/>[rag.services.ts]"]
  node_doctor_service["Doctor service<br/>[doctor.services.ts]"]
  node_appointment_service["Appointment service"]
  node_http_client["HTTP client<br/>[httpClient.ts]"]
  node_auth_service["Authentication service<br/>[auth.services.ts]"]
  node_table_filters["Table filtering"]
  node_table_state["URL table state"]
  node_doctor_types["Doctor data types<br/>[doctor.types.ts]"]
  node_ui_primitives["UI primitives"]
end

node_visitor(("Visitor or patient"))
node_api{{"Healthcare API"}}

node_visitor -->|"browses"| node_home
node_visitor -->|"searches doctors"| node_doctor_discovery
node_doctor_discovery -->|"loads doctors"| node_doctor_service
node_doctor_service -->|"requests data"| node_http_client
node_http_client -->|"sends requests"| node_api
node_doctor_discovery -->|"opens booking"| node_booking
node_doctor_discovery -->|"links details"| node_doctor_profile
node_doctor_profile -->|"offers booking"| node_booking
node_booking_confirmation -->|"submits booking"| node_appointment_actions
node_patient_appointments -->|"loads appointments"| node_appointment_actions
node_appointment_service -->|"requests data"| node_http_client
node_rag_action -->|"invokes service"| node_rag_service
node_rag_service -->|"sends queries"| node_http_client
node_auth_service -->|"refreshes tokens"| node_http_client
node_http_client -->|"refreshes tokens"| node_auth_service
node_doctor_discovery -->|"renders filters"| node_table_filters
node_doctor_discovery -->|"manages query state"| node_table_state
node_doctor_service -->|"uses data types"| node_doctor_types
node_doctor_profile -->|"loads doctor"| node_doctor_service
node_home -->|"renders components"| node_ui_primitives
node_doctor_discovery -->|"renders controls"| node_ui_primitives

click node_home "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/app/(commonLayout)/page.tsx"
click node_doctor_discovery "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/components/modules/Consultation/DoctorsList.tsx"
click node_doctor_profile "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/app/(commonLayout)/consultation/doctor/%5Bid%5D/page.tsx"
click node_auth "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/tree/development/src/app/(commonLayout)/(authRouteGroup)/login"
click node_booking "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/components/modules/Patient/Appointments/BookAppointmentModal.tsx"
click node_booking_confirmation "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/components/modules/Patient/Appointments/AppointmentBookingConfirmation.tsx"
click node_patient_appointments "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/components/modules/Patient/Appointments/PatientAppointmentsList.tsx"
click node_appointment_actions "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/app/_actions/appointment.actions.ts"
click node_doctor_operations "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/tree/development/src/app/(dashboardLayout)/doctor/dashboard"
click node_admin_operations "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/tree/development/src/app/(dashboardLayout)/admin/dashboard"
click node_patient_dashboard "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/tree/development/src/app/(dashboardLayout)/dashboard"
click node_admin_doctors "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/tree/development/src/app/(dashboardLayout)/admin/dashboard/doctors-management"
click node_admin_schedules "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/tree/development/src/app/(dashboardLayout)/admin/dashboard/schedules-management"
click node_rag_action "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/app/_actions/rag.actions.ts"
click node_rag_service "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/services/rag.services.ts"
click node_doctor_service "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/services/doctor.services.ts"
click node_appointment_service "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/services/appointment.services.ts"
click node_http_client "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/lib/axios/httpClient.ts"
click node_auth_service "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/services/auth.services.ts"
click node_chatbot "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/components/modules/Chatbot/FloatingChatbot.tsx"
click node_table_filters "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/components/shared/table/DataTableFilters.tsx"
click node_table_state "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/hooks/useServerManagedDataTable.ts"
click node_doctor_types "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/types/doctor.types.ts"
click node_ui_primitives "https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/tree/development/src/components/ui"

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_home,node_doctor_discovery,node_doctor_profile,node_auth toneBlue
class node_booking,node_booking_confirmation,node_patient_appointments,node_appointment_actions,node_rag_action,node_chatbot toneAmber
class node_doctor_operations,node_admin_operations,node_patient_dashboard,node_admin_doctors,node_admin_schedules,node_api toneMint
class node_rag_service,node_doctor_service,node_appointment_service,node_http_client,node_auth_service,node_table_filters,node_table_state,node_doctor_types,node_ui_primitives toneRose
class node_visitor toneIndigo
```

## Components

### Public discovery

- [Home and resources](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/app/(commonLayout)/page.tsx): `src/app/(commonLayout)/page.tsx`
- [Doctor discovery](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/components/modules/Consultation/DoctorsList.tsx): `src/components/modules/Consultation/DoctorsList.tsx`
- [Doctor profile](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/app/(commonLayout)/consultation/doctor/%5Bid%5D/page.tsx): `src/app/(commonLayout)/consultation/doctor/[id]/page.tsx`
- [Authentication](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/tree/development/src/app/(commonLayout)/(authRouteGroup)/login): `src/app/(commonLayout)/(authRouteGroup)/login`

### Appointments and care

- [Appointment booking](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/components/modules/Patient/Appointments/BookAppointmentModal.tsx): `src/components/modules/Patient/Appointments/BookAppointmentModal.tsx`
- [Booking confirmation](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/components/modules/Patient/Appointments/AppointmentBookingConfirmation.tsx): `src/components/modules/Patient/Appointments/AppointmentBookingConfirmation.tsx`
- [Patient appointments](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/components/modules/Patient/Appointments/PatientAppointmentsList.tsx): `src/components/modules/Patient/Appointments/PatientAppointmentsList.tsx`
- [Appointment actions](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/app/_actions/appointment.actions.ts): `src/app/_actions/appointment.actions.ts`
- [RAG actions](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/app/_actions/rag.actions.ts): `src/app/_actions/rag.actions.ts`
- [Floating chatbot](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/components/modules/Chatbot/FloatingChatbot.tsx): `src/components/modules/Chatbot/FloatingChatbot.tsx`

### Role dashboards

- [Doctor workspace](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/tree/development/src/app/(dashboardLayout)/doctor/dashboard): `src/app/(dashboardLayout)/doctor/dashboard`
- [Administrator workspace](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/tree/development/src/app/(dashboardLayout)/admin/dashboard): `src/app/(dashboardLayout)/admin/dashboard`
- [Patient workspace](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/tree/development/src/app/(dashboardLayout)/dashboard): `src/app/(dashboardLayout)/dashboard`
- [Doctor administration](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/tree/development/src/app/(dashboardLayout)/admin/dashboard/doctors-management): `src/app/(dashboardLayout)/admin/dashboard/doctors-management`
- [Schedule administration](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/tree/development/src/app/(dashboardLayout)/admin/dashboard/schedules-management): `src/app/(dashboardLayout)/admin/dashboard/schedules-management`

### Application services

- [RAG service](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/services/rag.services.ts): `src/services/rag.services.ts`
- [Doctor service](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/services/doctor.services.ts): `src/services/doctor.services.ts`
- [Appointment service](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/services/appointment.services.ts): `src/services/appointment.services.ts`
- [HTTP client](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/lib/axios/httpClient.ts): `src/lib/axios/httpClient.ts`
- [Authentication service](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/services/auth.services.ts): `src/services/auth.services.ts`
- [Table filtering](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/components/shared/table/DataTableFilters.tsx): `src/components/shared/table/DataTableFilters.tsx`
- [URL table state](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/hooks/useServerManagedDataTable.ts): `src/hooks/useServerManagedDataTable.ts`
- [Doctor data types](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/blob/development/src/types/doctor.types.ts): `src/types/doctor.types.ts`
- [UI primitives](https://github.com/apollo-level2-web-dev/l2b6-frontend-ph-healthcare-management-system/tree/development/src/components/ui): `src/components/ui`

### Other components

- **Visitor or patient**
- **Healthcare API**

## Connections

- Visitor or patient → Home and resources: browses (evidence: `src/app/(commonLayout)/page.tsx`)
- Visitor or patient → Doctor discovery: searches doctors (evidence: `src/components/modules/Consultation/DoctorsList.tsx`)
- Doctor discovery → Doctor service: loads doctors (evidence: `src/components/modules/Consultation/DoctorsList.tsx`)
- Doctor service → HTTP client: requests data (evidence: `src/services/doctor.services.ts`)
- HTTP client → Healthcare API: sends requests (evidence: `src/lib/axios/httpClient.ts`)
- Doctor discovery → Appointment booking: opens booking (evidence: `src/components/modules/Consultation/DoctorsList.tsx`)
- Doctor discovery → Doctor profile: links details (evidence: `src/components/modules/Consultation/DoctorsList.tsx`)
- Doctor profile → Appointment booking: offers booking (evidence: `src/app/(commonLayout)/consultation/doctor/[id]/page.tsx`)
- Booking confirmation → Appointment actions: submits booking (evidence: `src/components/modules/Patient/Appointments/AppointmentBookingConfirmation.tsx`)
- Patient appointments → Appointment actions: loads appointments (evidence: `src/components/modules/Patient/Appointments/PatientAppointmentsList.tsx`)
- Appointment service → HTTP client: requests data (evidence: `src/services/appointment.services.ts`)
- RAG actions → RAG service: invokes service (evidence: `src/app/_actions/rag.actions.ts`)
- RAG service → HTTP client: sends queries (evidence: `src/services/rag.services.ts`)
- Authentication service → HTTP client: refreshes tokens (evidence: `src/lib/axios/httpClient.ts`)
- HTTP client → Authentication service: refreshes tokens (evidence: `src/lib/axios/httpClient.ts`)
- Doctor discovery → Table filtering: renders filters (evidence: `src/components/modules/Consultation/DoctorsList.tsx`)
- Doctor discovery → URL table state: manages query state (evidence: `src/components/modules/Consultation/DoctorsList.tsx`)
- Doctor service → Doctor data types: uses data types (evidence: `src/services/doctor.services.ts`)
- Doctor profile → Doctor service: loads doctor (evidence: `src/app/(commonLayout)/consultation/doctor/[id]/page.tsx`)
- Home and resources → UI primitives: renders components (evidence: `src/app/(commonLayout)/page.tsx`)
- Doctor discovery → UI primitives: renders controls (evidence: `src/components/modules/Consultation/DoctorsList.tsx`)
