# dev-mehedi-github/apw_fall26-27_project architecture

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

- Interactive diagram: https://gitdiagram.com/dev-mehedi-github/apw_fall26-27_project
- Repository: https://github.com/dev-mehedi-github/apw_fall26-27_project

## Overview

This backend is a NestJS clinical-management API. Users authenticate, then role-aware endpoints manage appointments and clinician availability, laboratory orders and reports, and invoices; administration also maintains users, doctors, departments, and related information. The graph retains major domains visible in the source tree and core-module index. The README is empty, and several services were only partially sampled, so unsampled integrations are not inferred; edges cite controller/service references or service entity references in the source index.

Main entry points: [`backend/src/modules/laboratory/laboratory.service.ts`](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/laboratory/laboratory.service.ts) (Lab orders & tests), [`backend/src/modules/billing/billing.service.ts`](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/billing/billing.service.ts) (Invoice management), [`backend/src/modules/appointments/appointment.service.ts`](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/appointments/appointment.service.ts) (Appointment booking), [`backend/src/modules/user/entities/user.entity.ts`](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/user/entities/user.entity.ts) (User records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity &amp; Access"]
  node_auth_api["Authentication API<br/>[auth.controller.ts]"]
  node_auth_logic["Authentication<br/>[auth.service.ts]"]
  node_users["User accounts<br/>[user.service.ts]"]
  node_user_model[("User records<br/>[user.entity.ts]")]
end

subgraph group_care["Care Scheduling"]
  node_appointments_api["Appointment API"]
  node_appointments["Appointment booking"]
  node_appointment_model[("Appointments")]
  node_slots["Doctor availability<br/>[slot.service.ts]"]
  node_slot_model[("Slots<br/>[slot.entity.ts]")]
end

subgraph group_clinical["Laboratory Services"]
  node_lab_api["Laboratory API"]
  node_lab_service["Lab orders &amp; tests"]
  node_lab_order[("Lab orders")]
  node_lab_order_items[("Order items")]
  node_lab_tests[("Test catalogue<br/>[lab-test.entity.ts]")]
  node_reports_api["Lab report API"]
end

subgraph group_admin["Billing &amp; Administration"]
  node_billing_api["Billing API"]
  node_billing["Invoice management<br/>[billing.service.ts]"]
  node_invoice_model[("Invoices<br/>[invoice.entity.ts]")]
  node_departments["Departments"]
  node_doctor_links["Doctor departments"]
  node_doctor_info["Doctor information"]
  node_doctors["Doctor directory"]
  node_payments["Payment records"]
  node_notifications["Notifications"]
end

node_client(("API client"))

node_client -->|"requests"| node_auth_api
node_auth_api -->|"delegates to"| node_auth_logic
node_auth_logic -->|"uses accounts"| node_users
node_users -.->|"manages"| node_user_model
node_client -->|"requests"| node_appointments_api
node_appointments_api -->|"delegates to"| node_appointments
node_appointments -->|"reads &amp; writes"| node_appointment_model
node_appointments -->|"checks patient"| node_user_model
node_appointments -->|"books slot"| node_slot_model
node_client -->|"requests"| node_lab_api
node_lab_api -->|"delegates to"| node_lab_service
node_lab_service -->|"manages orders"| node_lab_order
node_lab_service -->|"uses items"| node_lab_order_items
node_lab_service -->|"manages tests"| node_lab_tests
node_lab_service -->|"checks patient"| node_user_model
node_lab_service -->|"checks appointment"| node_appointment_model
node_client -->|"requests"| node_reports_api
node_client -->|"requests"| node_billing_api
node_billing_api -->|"delegates to"| node_billing
node_billing -->|"creates invoices"| node_invoice_model
node_billing -->|"reads appointment"| node_appointment_model
node_billing -->|"reads lab order"| node_lab_order
node_billing -->|"checks requester"| node_user_model
node_client -->|"requests"| node_departments
node_client -->|"requests"| node_doctor_links
node_client -->|"requests"| node_doctor_info
node_client -->|"requests"| node_doctors
node_client -->|"requests"| node_payments
node_client -->|"requests"| node_notifications

click node_auth_api "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/auth/auth.controller.ts"
click node_auth_logic "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/auth/auth.service.ts"
click node_users "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/user/user.service.ts"
click node_user_model "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/user/entities/user.entity.ts"
click node_appointments_api "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/appointments/appointment.controller.ts"
click node_appointments "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/appointments/appointment.service.ts"
click node_appointment_model "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/appointments/entities/appointment.entity.ts"
click node_slots "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/slot/slot.service.ts"
click node_slot_model "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/slot/entities/slot.entity.ts"
click node_lab_api "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/laboratory/laboratory.controller.ts"
click node_lab_service "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/laboratory/laboratory.service.ts"
click node_lab_order "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/laboratory/entities/lab-order.entity.ts"
click node_lab_order_items "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/laboratory/entities/lab-order-item.entity.ts"
click node_lab_tests "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/laboratory/entities/lab-test.entity.ts"
click node_reports_api "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/lab-report/lab-report.controller.ts"
click node_billing_api "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/billing/billing.controller.ts"
click node_billing "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/billing/billing.service.ts"
click node_invoice_model "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/billing/entities/invoice.entity.ts"
click node_departments "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/department/department.controller.ts"
click node_doctor_links "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/doctor-department/doctor-department.service.ts"
click node_doctor_info "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/doctor-information/doctor-information.controller.ts"
click node_doctors "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/doctor/doctor.controller.ts"
click node_payments "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/payment/payment.controller.ts"
click node_notifications "https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/notification/notification.controller.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_auth_api,node_auth_logic,node_users,node_user_model,node_client toneBlue
class node_appointments_api,node_appointments,node_appointment_model,node_slots,node_slot_model toneAmber
class node_lab_api,node_lab_service,node_lab_order,node_lab_order_items,node_lab_tests,node_reports_api toneMint
class node_billing_api,node_billing,node_invoice_model,node_departments,node_doctor_links,node_doctor_info,node_doctors,node_payments,node_notifications toneRose
```

## Components

### Identity & Access

- [Authentication API](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/auth/auth.controller.ts): `backend/src/modules/auth/auth.controller.ts`
- [Authentication](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/auth/auth.service.ts): `backend/src/modules/auth/auth.service.ts`
- [User accounts](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/user/user.service.ts): `backend/src/modules/user/user.service.ts`
- [User records](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/user/entities/user.entity.ts): `backend/src/modules/user/entities/user.entity.ts`

### Care Scheduling

- [Appointment API](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/appointments/appointment.controller.ts): `backend/src/modules/appointments/appointment.controller.ts`
- [Appointment booking](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/appointments/appointment.service.ts): `backend/src/modules/appointments/appointment.service.ts`
- [Appointments](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/appointments/entities/appointment.entity.ts): `backend/src/modules/appointments/entities/appointment.entity.ts`
- [Doctor availability](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/slot/slot.service.ts): `backend/src/modules/slot/slot.service.ts`
- [Slots](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/slot/entities/slot.entity.ts): `backend/src/modules/slot/entities/slot.entity.ts`

### Laboratory Services

- [Laboratory API](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/laboratory/laboratory.controller.ts): `backend/src/modules/laboratory/laboratory.controller.ts`
- [Lab orders & tests](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/laboratory/laboratory.service.ts): `backend/src/modules/laboratory/laboratory.service.ts`
- [Lab orders](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/laboratory/entities/lab-order.entity.ts): `backend/src/modules/laboratory/entities/lab-order.entity.ts`
- [Order items](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/laboratory/entities/lab-order-item.entity.ts): `backend/src/modules/laboratory/entities/lab-order-item.entity.ts`
- [Test catalogue](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/laboratory/entities/lab-test.entity.ts): `backend/src/modules/laboratory/entities/lab-test.entity.ts`
- [Lab report API](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/lab-report/lab-report.controller.ts): `backend/src/modules/lab-report/lab-report.controller.ts`

### Billing & Administration

- [Billing API](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/billing/billing.controller.ts): `backend/src/modules/billing/billing.controller.ts`
- [Invoice management](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/billing/billing.service.ts): `backend/src/modules/billing/billing.service.ts`
- [Invoices](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/billing/entities/invoice.entity.ts): `backend/src/modules/billing/entities/invoice.entity.ts`
- [Departments](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/department/department.controller.ts): `backend/src/modules/department/department.controller.ts`
- [Doctor departments](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/doctor-department/doctor-department.service.ts): `backend/src/modules/doctor-department/doctor-department.service.ts`
- [Doctor information](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/doctor-information/doctor-information.controller.ts): `backend/src/modules/doctor-information/doctor-information.controller.ts`
- [Doctor directory](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/doctor/doctor.controller.ts): `backend/src/modules/doctor/doctor.controller.ts`
- [Payment records](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/payment/payment.controller.ts): `backend/src/modules/payment/payment.controller.ts`
- [Notifications](https://github.com/dev-mehedi-github/apw_fall26-27_project/blob/main/backend/src/modules/notification/notification.controller.ts): `backend/src/modules/notification/notification.controller.ts`

### Other components

- **API client**

## Connections

- API client → Authentication API: requests (evidence: `backend/src/modules/auth/auth.controller.ts`)
- Authentication API → Authentication: delegates to (evidence: `backend/src/modules/auth/auth.controller.ts`)
- Authentication → User accounts: uses accounts (evidence: `backend/src/modules/auth/auth.service.ts`)
- User accounts → User records: manages
- API client → Appointment API: requests (evidence: `backend/src/modules/appointments/appointment.controller.ts`)
- Appointment API → Appointment booking: delegates to (evidence: `backend/src/modules/appointments/appointment.controller.ts`)
- Appointment booking → Appointments: reads & writes (evidence: `backend/src/modules/appointments/appointment.service.ts`)
- Appointment booking → User records: checks patient (evidence: `backend/src/modules/appointments/appointment.service.ts`)
- Appointment booking → Slots: books slot (evidence: `backend/src/modules/appointments/appointment.service.ts`)
- API client → Laboratory API: requests (evidence: `backend/src/modules/laboratory/laboratory.controller.ts`)
- Laboratory API → Lab orders & tests: delegates to (evidence: `backend/src/modules/laboratory/laboratory.controller.ts`)
- Lab orders & tests → Lab orders: manages orders (evidence: `backend/src/modules/laboratory/laboratory.service.ts`)
- Lab orders & tests → Order items: uses items (evidence: `backend/src/modules/laboratory/laboratory.service.ts`)
- Lab orders & tests → Test catalogue: manages tests (evidence: `backend/src/modules/laboratory/laboratory.service.ts`)
- Lab orders & tests → User records: checks patient (evidence: `backend/src/modules/laboratory/laboratory.service.ts`)
- Lab orders & tests → Appointments: checks appointment (evidence: `backend/src/modules/laboratory/laboratory.service.ts`)
- API client → Lab report API: requests (evidence: `backend/src/modules/lab-report/lab-report.controller.ts`)
- API client → Billing API: requests (evidence: `backend/src/modules/billing/billing.controller.ts`)
- Billing API → Invoice management: delegates to (evidence: `backend/src/modules/billing/billing.controller.ts`)
- Invoice management → Invoices: creates invoices (evidence: `backend/src/modules/billing/billing.service.ts`)
- Invoice management → Appointments: reads appointment (evidence: `backend/src/modules/billing/billing.service.ts`)
- Invoice management → Lab orders: reads lab order (evidence: `backend/src/modules/billing/billing.service.ts`)
- Invoice management → User records: checks requester (evidence: `backend/src/modules/billing/billing.service.ts`)
- API client → Departments: requests (evidence: `backend/src/modules/department/department.controller.ts`)
- API client → Doctor departments: requests
- API client → Doctor information: requests (evidence: `backend/src/modules/doctor-information/doctor-information.controller.ts`)
- API client → Doctor directory: requests (evidence: `backend/src/modules/doctor/doctor.controller.ts`)
- API client → Payment records: requests (evidence: `backend/src/modules/payment/payment.controller.ts`)
- API client → Notifications: requests (evidence: `backend/src/modules/notification/notification.controller.ts`)
