# mahmoud8276/pharmacore architecture

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

- Interactive diagram: https://gitdiagram.com/mahmoud8276/pharmacore
- Repository: https://github.com/mahmoud8276/pharmacore

## Overview

This repository implements a pharmacy-management REST API. A client sends versioned requests to API controllers, which delegate catalog and supply operations to application services and return standardized responses; services use repositories and a unit of work to persist pharmacy data. The tree also documents inventory, account/user, supplier, product-batch, and reference-catalog capabilities. Source excerpts verify product and supply controller delegation and installment-payment persistence; most other feature links are documented only by the source index, so their internal call paths are not asserted.

Main entry points: [`src/Pharmacy.System.Api/Controllers/V1/ProductsController.cs`](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Api/Controllers/V1/ProductsController.cs) (Product endpoints), [`src/Pharmacy.System.Api/Controllers/V1/SuppliesController.cs`](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Api/Controllers/V1/SuppliesController.cs) (Supply endpoints), [`src/Pharmacy.System.Infrastructure/DbContexts/AppDbContext.cs`](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Infrastructure/DbContexts/AppDbContext.cs) (Application database), [`src/Pharmacy.System.Services/Services/SupplyInstallmentService.cs`](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Services/Services/SupplyInstallmentService.cs) (Installment service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_basecontroller["Controller base<br/>[BaseController.cs]"]
  node_productapi["Product endpoints"]
  node_supplyapi["Supply endpoints"]
  node_otherapi["Other endpoints<br/>[V1]"]
end

subgraph group_application["Application services"]
  node_productservice["Product service<br/>[IProductService.cs]"]
  node_packagingservice["Product packaging"]
  node_supplyservice["Supply service<br/>[ISupplyService.cs]"]
  node_paymentservice["Supply payments"]
  node_installmentservice["Installment service"]
  node_response["Service responses<br/>[Response.cs]"]
end

subgraph group_domain["Pharmacy domain"]
  node_productdomain["Product catalog"]
  node_supplydomain["Supply and installments<br/>[Supply.cs]"]
  node_repositorydomain["Repository model<br/>[Repository.cs]"]
  node_productdto["Product ingredient DTO"]
  node_basedomain["Shared entity base<br/>[BaseModel.cs]"]
end

subgraph group_persistence["Persistence"]
  node_unitofwork["Unit of work<br/>[UnitOfWork.cs]"]
  node_supplyrepo["Installment repository"]
  node_database[("Application database<br/>[AppDbContext.cs]")]
  node_wiring["Repository registration<br/>[Repositories.cs]"]
end

node_client(("API client"))

node_client -->|"requests"| node_productapi
node_client -->|"requests"| node_supplyapi
node_productapi -->|"delegates to"| node_productservice
node_productapi -->|"delegates to"| node_packagingservice
node_supplyapi -->|"delegates to"| node_supplyservice
node_supplyapi -->|"delegates to"| node_paymentservice
node_supplyapi -->|"delegates to"| node_installmentservice
node_basecontroller -->|"formats status"| node_response
node_productapi -->|"accepts and returns"| node_productdto
node_installmentservice -->|"loads and saves"| node_supplyrepo
node_supplyrepo -->|"queries"| node_database
node_wiring -->|"registers"| node_unitofwork
node_database -->|"stores"| node_supplydomain
node_database -->|"stores"| node_repositorydomain
node_supplydomain -->|"inherits"| node_basedomain
node_repositorydomain -->|"inherits"| node_basedomain
node_otherapi -.->|"serves requests"| node_client

click node_basecontroller "https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Api/Controllers/BaseController.cs"
click node_productapi "https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Api/Controllers/V1/ProductsController.cs"
click node_supplyapi "https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Api/Controllers/V1/SuppliesController.cs"
click node_otherapi "https://github.com/mahmoud8276/pharmacore/tree/main/src/Pharmacy.System.Api/Controllers/V1"
click node_productservice "https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Services/IServices/IProductService.cs"
click node_packagingservice "https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Services/IServices/IProductPackagingService.cs"
click node_supplyservice "https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Services/IServices/ISupplyService.cs"
click node_paymentservice "https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Services/IServices/ISupplyPaymentService.cs"
click node_installmentservice "https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Services/Services/SupplyInstallmentService.cs"
click node_response "https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Services/Responses/Response.cs"
click node_productdomain "https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Core/Models/ProductActiveIngredient.cs"
click node_supplydomain "https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Core/Models/Supply.cs"
click node_repositorydomain "https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Core/Models/Repository.cs"
click node_productdto "https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Core/Dtos/ProductActiveIngredientDtos/ProductActiveIngredientDto.cs"
click node_basedomain "https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Core/Models/BaseModel.cs"
click node_unitofwork "https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Infrastructure/Repositories/UnitOfWork.cs"
click node_supplyrepo "https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Infrastructure/Repositories/SupplyInstallmentRepository.cs"
click node_database "https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Infrastructure/DbContexts/AppDbContext.cs"
click node_wiring "https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Services/ApplicatoinServicesConfig/Repositories.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_basecontroller,node_productapi,node_supplyapi,node_otherapi,node_client toneBlue
class node_productservice,node_packagingservice,node_supplyservice,node_paymentservice,node_installmentservice,node_response toneAmber
class node_productdomain,node_supplydomain,node_repositorydomain,node_productdto,node_basedomain toneMint
class node_unitofwork,node_supplyrepo,node_database,node_wiring toneRose
```

## Components

### HTTP API

- [Controller base](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Api/Controllers/BaseController.cs): `src/Pharmacy.System.Api/Controllers/BaseController.cs`
- [Product endpoints](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Api/Controllers/V1/ProductsController.cs): `src/Pharmacy.System.Api/Controllers/V1/ProductsController.cs`
- [Supply endpoints](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Api/Controllers/V1/SuppliesController.cs): `src/Pharmacy.System.Api/Controllers/V1/SuppliesController.cs`
- [Other endpoints](https://github.com/mahmoud8276/pharmacore/tree/main/src/Pharmacy.System.Api/Controllers/V1): `src/Pharmacy.System.Api/Controllers/V1`

### Application services

- [Product service](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Services/IServices/IProductService.cs): `src/Pharmacy.System.Services/IServices/IProductService.cs`
- [Product packaging](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Services/IServices/IProductPackagingService.cs): `src/Pharmacy.System.Services/IServices/IProductPackagingService.cs`
- [Supply service](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Services/IServices/ISupplyService.cs): `src/Pharmacy.System.Services/IServices/ISupplyService.cs`
- [Supply payments](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Services/IServices/ISupplyPaymentService.cs): `src/Pharmacy.System.Services/IServices/ISupplyPaymentService.cs`
- [Installment service](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Services/Services/SupplyInstallmentService.cs): `src/Pharmacy.System.Services/Services/SupplyInstallmentService.cs`
- [Service responses](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Services/Responses/Response.cs): `src/Pharmacy.System.Services/Responses/Response.cs`

### Pharmacy domain

- [Product catalog](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Core/Models/ProductActiveIngredient.cs): `src/Pharmacy.System.Core/Models/ProductActiveIngredient.cs`
- [Supply and installments](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Core/Models/Supply.cs): `src/Pharmacy.System.Core/Models/Supply.cs`
- [Repository model](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Core/Models/Repository.cs): `src/Pharmacy.System.Core/Models/Repository.cs`
- [Product ingredient DTO](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Core/Dtos/ProductActiveIngredientDtos/ProductActiveIngredientDto.cs): `src/Pharmacy.System.Core/Dtos/ProductActiveIngredientDtos/ProductActiveIngredientDto.cs`
- [Shared entity base](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Core/Models/BaseModel.cs): `src/Pharmacy.System.Core/Models/BaseModel.cs`

### Persistence

- [Unit of work](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Infrastructure/Repositories/UnitOfWork.cs): `src/Pharmacy.System.Infrastructure/Repositories/UnitOfWork.cs`
- [Installment repository](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Infrastructure/Repositories/SupplyInstallmentRepository.cs): `src/Pharmacy.System.Infrastructure/Repositories/SupplyInstallmentRepository.cs`
- [Application database](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Infrastructure/DbContexts/AppDbContext.cs): `src/Pharmacy.System.Infrastructure/DbContexts/AppDbContext.cs`
- [Repository registration](https://github.com/mahmoud8276/pharmacore/blob/main/src/Pharmacy.System.Services/ApplicatoinServicesConfig/Repositories.cs): `src/Pharmacy.System.Services/ApplicatoinServicesConfig/Repositories.cs`

### Other components

- **API client**

## Connections

- API client → Product endpoints: requests (evidence: `src/Pharmacy.System.Api/Controllers/V1/ProductsController.cs`)
- API client → Supply endpoints: requests (evidence: `src/Pharmacy.System.Api/Controllers/V1/SuppliesController.cs`)
- Product endpoints → Product service: delegates to (evidence: `src/Pharmacy.System.Api/Controllers/V1/ProductsController.cs`)
- Product endpoints → Product packaging: delegates to (evidence: `src/Pharmacy.System.Api/Controllers/V1/ProductsController.cs`)
- Supply endpoints → Supply service: delegates to (evidence: `src/Pharmacy.System.Api/Controllers/V1/SuppliesController.cs`)
- Supply endpoints → Supply payments: delegates to (evidence: `src/Pharmacy.System.Api/Controllers/V1/SuppliesController.cs`)
- Supply endpoints → Installment service: delegates to (evidence: `src/Pharmacy.System.Api/Controllers/V1/SuppliesController.cs`)
- Controller base → Service responses: formats status (evidence: `src/Pharmacy.System.Api/Controllers/BaseController.cs`)
- Product endpoints → Product ingredient DTO: accepts and returns (evidence: `src/Pharmacy.System.Api/Controllers/V1/ProductsController.cs`)
- Installment service → Installment repository: loads and saves (evidence: `src/Pharmacy.System.Services/Services/SupplyInstallmentService.cs`)
- Installment repository → Application database: queries (evidence: `src/Pharmacy.System.Infrastructure/Repositories/SupplyInstallmentRepository.cs`)
- Repository registration → Unit of work: registers (evidence: `src/Pharmacy.System.Services/ApplicatoinServicesConfig/Repositories.cs`)
- Application database → Supply and installments: stores (evidence: `src/Pharmacy.System.Infrastructure/DbContexts/AppDbContext.cs`)
- Application database → Repository model: stores (evidence: `src/Pharmacy.System.Infrastructure/DbContexts/AppDbContext.cs`)
- Supply and installments → Shared entity base: inherits (evidence: `src/Pharmacy.System.Core/Models/Supply.cs`)
- Repository model → Shared entity base: inherits (evidence: `src/Pharmacy.System.Core/Models/Repository.cs`)
- Other endpoints → API client: serves requests
