# medicore-project/medicore-backend architecture

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

- Interactive diagram: https://gitdiagram.com/medicore-project/medicore-backend
- Repository: https://github.com/medicore-project/medicore-backend

## Overview

MediCore is a healthcare-services backend, with a gateway in front of identity, patient, appointment, and billing capabilities. The clearest sampled flow is staff or patient API requests into appointment handling, including waitlist operations and appointment queries backed by repositories; other listed modules provide scheduling, clinical records, billing, and reporting. The README is empty, and source excerpts are selective, so several product branches are represented from the file tree without speculative call edges.

Main entry points: [`src/gateway/MediCore.Gateway/Program.cs`](https://github.com/medicore-project/medicore-backend/blob/main/src/gateway/MediCore.Gateway/Program.cs) (Gateway Proxy), [`src/services/patient/MediCore.Patient.Api/Controllers/AllergiesController.cs`](https://github.com/medicore-project/medicore-backend/blob/main/src/services/patient/MediCore.Patient.Api/Controllers/AllergiesController.cs) (Patient API), [`src/services/appointment/MediCore.Appointment.Api/Controllers/AppointmentsController.cs`](https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Api/Controllers/AppointmentsController.cs) (Appointment API), [`src/services/billing/MediCore.Billing.Api/Controllers/InvoicesController.cs`](https://github.com/medicore-project/medicore-backend/blob/main/src/services/billing/MediCore.Billing.Api/Controllers/InvoicesController.cs) (Billing API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gateway["Gateway"]
  node_gateway_app["Gateway Proxy<br/>[Program.cs]"]
end

subgraph group_identity["Identity"]
  node_identity_api["Identity API<br/>[StaffController.cs]"]
  node_staff_store[("Staff Repository<br/>[StaffRepository.cs]")]
end

subgraph group_patient["Patient Records"]
  node_patient_api["Patient API"]
  node_patient_search["Patient Search"]
  node_patient_store[("Patient Repository")]
  node_medical_records["Medical Records"]
end

subgraph group_appointment["Appointments"]
  node_appointment_api["Appointment API"]
  node_booking["Booking Lifecycle"]
  node_appointment_queries["Appointment Queries"]
  node_appointment_store[("Appointment Store")]
  node_waitlist_api["Waitlist API"]
  node_waitlist_service["Waitlist Services<br/>[WaitlistService.cs]"]
  node_waitlist_changes["Waitlist Changes"]
  node_scheduling["Slot Scheduling<br/>[SlotGenerator.cs]"]
  node_appointment_messaging["Event Messaging<br/>[OutboxProcessor.cs]"]
  node_appointment_reports["Utilisation Reports"]
end

subgraph group_billing["Billing"]
  node_billing_api["Billing API"]
  node_invoice_queries["Invoice Queries"]
  node_billing_reports["Billing Reports"]
  node_tariffs["Service Tariffs"]
end

node_client(("API Client"))

node_client -->|"sends requests"| node_gateway_app
node_gateway_app -.->|"proxies requests"| node_identity_api
node_gateway_app -.->|"proxies requests"| node_patient_api
node_gateway_app -.->|"proxies requests"| node_appointment_api
node_gateway_app -.->|"proxies requests"| node_billing_api
node_identity_api -->|"reads and writes"| node_staff_store
node_patient_api -.->|"searches patients"| node_patient_search
node_patient_api -.->|"serves records"| node_medical_records
node_patient_search -->|"queries repository"| node_patient_store
node_appointment_api -.->|"handles bookings"| node_booking
node_appointment_api -.->|"queries appointments"| node_appointment_queries
node_appointment_queries -->|"queries repository"| node_appointment_store
node_waitlist_api -->|"gets waitlists"| node_waitlist_service
node_waitlist_api -->|"changes entries"| node_waitlist_changes
node_billing_api -.->|"queries invoices"| node_invoice_queries
node_invoice_queries -.->|"supports reporting"| node_billing_reports
node_billing_api -.->|"manages tariffs"| node_tariffs

click node_gateway_app "https://github.com/medicore-project/medicore-backend/blob/main/src/gateway/MediCore.Gateway/Program.cs"
click node_identity_api "https://github.com/medicore-project/medicore-backend/blob/main/src/services/identity/MediCore.Identity.Api/Controllers/StaffController.cs"
click node_staff_store "https://github.com/medicore-project/medicore-backend/blob/main/src/services/identity/MediCore.Identity.Infrastructure/Persistence/Repositories/StaffRepository.cs"
click node_patient_api "https://github.com/medicore-project/medicore-backend/blob/main/src/services/patient/MediCore.Patient.Api/Controllers/AllergiesController.cs"
click node_patient_search "https://github.com/medicore-project/medicore-backend/blob/main/src/services/patient/MediCore.Patient.Application/Services/PatientSearchService.cs"
click node_patient_store "https://github.com/medicore-project/medicore-backend/blob/main/src/services/patient/MediCore.Patient.Infrastructure/Persistence/Repositories/PatientRepository.cs"
click node_medical_records "https://github.com/medicore-project/medicore-backend/blob/main/src/services/patient/MediCore.Patient.Api/Controllers/MedicalRecordsController.cs"
click node_appointment_api "https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Api/Controllers/AppointmentsController.cs"
click node_booking "https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Application/Services/AppointmentBookingService.cs"
click node_appointment_queries "https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Application/Services/AppointmentQueryService.cs"
click node_appointment_store "https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Infrastructure/Persistence/Repositories/AppointmentRepository.cs"
click node_waitlist_api "https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Api/Controllers/WaitlistController.cs"
click node_waitlist_service "https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Application/Services/WaitlistService.cs"
click node_waitlist_changes "https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Application/Services/WaitlistChangeService.cs"
click node_scheduling "https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Application/Scheduling/SlotGenerator.cs"
click node_appointment_messaging "https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Infrastructure/Messaging/OutboxProcessor.cs"
click node_appointment_reports "https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Application/Services/UtilisationReportService.cs"
click node_billing_api "https://github.com/medicore-project/medicore-backend/blob/main/src/services/billing/MediCore.Billing.Api/Controllers/InvoicesController.cs"
click node_invoice_queries "https://github.com/medicore-project/medicore-backend/blob/main/src/services/billing/MediCore.Billing.Application/Services/InvoiceQueryService.cs"
click node_billing_reports "https://github.com/medicore-project/medicore-backend/blob/main/src/services/billing/MediCore.Billing.Infrastructure/Reporting/RevenueReportQuery.cs"
click node_tariffs "https://github.com/medicore-project/medicore-backend/blob/main/src/services/billing/MediCore.Billing.Api/Controllers/ServiceTariffsController.cs"

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_gateway_app,node_client toneBlue
class node_identity_api,node_staff_store toneAmber
class node_patient_api,node_patient_search,node_patient_store,node_medical_records toneMint
class node_appointment_api,node_booking,node_appointment_queries,node_appointment_store,node_waitlist_api,node_waitlist_service,node_waitlist_changes,node_scheduling,node_appointment_messaging,node_appointment_reports toneRose
class node_billing_api,node_invoice_queries,node_billing_reports,node_tariffs toneIndigo
```

## Components

### Gateway

- [Gateway Proxy](https://github.com/medicore-project/medicore-backend/blob/main/src/gateway/MediCore.Gateway/Program.cs): `src/gateway/MediCore.Gateway/Program.cs`

### Identity

- [Identity API](https://github.com/medicore-project/medicore-backend/blob/main/src/services/identity/MediCore.Identity.Api/Controllers/StaffController.cs): `src/services/identity/MediCore.Identity.Api/Controllers/StaffController.cs`
- [Staff Repository](https://github.com/medicore-project/medicore-backend/blob/main/src/services/identity/MediCore.Identity.Infrastructure/Persistence/Repositories/StaffRepository.cs): `src/services/identity/MediCore.Identity.Infrastructure/Persistence/Repositories/StaffRepository.cs`

### Patient Records

- [Patient API](https://github.com/medicore-project/medicore-backend/blob/main/src/services/patient/MediCore.Patient.Api/Controllers/AllergiesController.cs): `src/services/patient/MediCore.Patient.Api/Controllers/AllergiesController.cs`
- [Patient Search](https://github.com/medicore-project/medicore-backend/blob/main/src/services/patient/MediCore.Patient.Application/Services/PatientSearchService.cs): `src/services/patient/MediCore.Patient.Application/Services/PatientSearchService.cs`
- [Patient Repository](https://github.com/medicore-project/medicore-backend/blob/main/src/services/patient/MediCore.Patient.Infrastructure/Persistence/Repositories/PatientRepository.cs): `src/services/patient/MediCore.Patient.Infrastructure/Persistence/Repositories/PatientRepository.cs`
- [Medical Records](https://github.com/medicore-project/medicore-backend/blob/main/src/services/patient/MediCore.Patient.Api/Controllers/MedicalRecordsController.cs): `src/services/patient/MediCore.Patient.Api/Controllers/MedicalRecordsController.cs`

### Appointments

- [Appointment API](https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Api/Controllers/AppointmentsController.cs): `src/services/appointment/MediCore.Appointment.Api/Controllers/AppointmentsController.cs`
- [Booking Lifecycle](https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Application/Services/AppointmentBookingService.cs): `src/services/appointment/MediCore.Appointment.Application/Services/AppointmentBookingService.cs`
- [Appointment Queries](https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Application/Services/AppointmentQueryService.cs): `src/services/appointment/MediCore.Appointment.Application/Services/AppointmentQueryService.cs`
- [Appointment Store](https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Infrastructure/Persistence/Repositories/AppointmentRepository.cs): `src/services/appointment/MediCore.Appointment.Infrastructure/Persistence/Repositories/AppointmentRepository.cs`
- [Waitlist API](https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Api/Controllers/WaitlistController.cs): `src/services/appointment/MediCore.Appointment.Api/Controllers/WaitlistController.cs`
- [Waitlist Services](https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Application/Services/WaitlistService.cs): `src/services/appointment/MediCore.Appointment.Application/Services/WaitlistService.cs`
- [Waitlist Changes](https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Application/Services/WaitlistChangeService.cs): `src/services/appointment/MediCore.Appointment.Application/Services/WaitlistChangeService.cs`
- [Slot Scheduling](https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Application/Scheduling/SlotGenerator.cs): `src/services/appointment/MediCore.Appointment.Application/Scheduling/SlotGenerator.cs`
- [Event Messaging](https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Infrastructure/Messaging/OutboxProcessor.cs): `src/services/appointment/MediCore.Appointment.Infrastructure/Messaging/OutboxProcessor.cs`
- [Utilisation Reports](https://github.com/medicore-project/medicore-backend/blob/main/src/services/appointment/MediCore.Appointment.Application/Services/UtilisationReportService.cs): `src/services/appointment/MediCore.Appointment.Application/Services/UtilisationReportService.cs`

### Billing

- [Billing API](https://github.com/medicore-project/medicore-backend/blob/main/src/services/billing/MediCore.Billing.Api/Controllers/InvoicesController.cs): `src/services/billing/MediCore.Billing.Api/Controllers/InvoicesController.cs`
- [Invoice Queries](https://github.com/medicore-project/medicore-backend/blob/main/src/services/billing/MediCore.Billing.Application/Services/InvoiceQueryService.cs): `src/services/billing/MediCore.Billing.Application/Services/InvoiceQueryService.cs`
- [Billing Reports](https://github.com/medicore-project/medicore-backend/blob/main/src/services/billing/MediCore.Billing.Infrastructure/Reporting/RevenueReportQuery.cs): `src/services/billing/MediCore.Billing.Infrastructure/Reporting/RevenueReportQuery.cs`
- [Service Tariffs](https://github.com/medicore-project/medicore-backend/blob/main/src/services/billing/MediCore.Billing.Api/Controllers/ServiceTariffsController.cs): `src/services/billing/MediCore.Billing.Api/Controllers/ServiceTariffsController.cs`

### Other components

- **API Client**

## Connections

- API Client → Gateway Proxy: sends requests (evidence: `src/gateway/MediCore.Gateway/Program.cs`)
- Gateway Proxy → Identity API: proxies requests
- Gateway Proxy → Patient API: proxies requests
- Gateway Proxy → Appointment API: proxies requests
- Gateway Proxy → Billing API: proxies requests
- Identity API → Staff Repository: reads and writes (evidence: `src/services/identity/MediCore.Identity.Api/Controllers/StaffController.cs`)
- Patient API → Patient Search: searches patients
- Patient API → Medical Records: serves records
- Patient Search → Patient Repository: queries repository (evidence: `src/services/patient/MediCore.Patient.Application/Services/PatientSearchService.cs`)
- Appointment API → Booking Lifecycle: handles bookings
- Appointment API → Appointment Queries: queries appointments
- Appointment Queries → Appointment Store: queries repository (evidence: `src/services/appointment/MediCore.Appointment.Application/Services/AppointmentQueryService.cs`)
- Waitlist API → Waitlist Services: gets waitlists (evidence: `src/services/appointment/MediCore.Appointment.Api/Controllers/WaitlistController.cs`)
- Waitlist API → Waitlist Changes: changes entries (evidence: `src/services/appointment/MediCore.Appointment.Api/Controllers/WaitlistController.cs`)
- Billing API → Invoice Queries: queries invoices
- Invoice Queries → Billing Reports: supports reporting
- Billing API → Service Tariffs: manages tariffs
