# whiteblizzard9248/pharmacyerp architecture

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

- Interactive diagram: https://gitdiagram.com/whiteblizzard9248/pharmacyerp
- Repository: https://github.com/whiteblizzard9248/pharmacyerp

## Overview

Shsmg Pharma is a pharmacy ERP for managing customers, sales invoices, purchasing, inventory, payments and receipts, with authentication, licensing and PDF output. The principal workflow is recording a purchase invoice and updating stock, then creating a customer sales invoice and tracking its audit and balances. The tree and sampled services show application logic over a shared EF Core context, with infrastructure providing persistence and identity. README content is empty; some capabilities are represented by unsampled service paths, so their links are left unverified rather than inferred.

Main entry points: [`Shsmg.Pharma.WebUI/Program.cs`](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.WebUI/Program.cs) (Web application), [`Shsmg.Pharma.Application/Services/InvoiceService.cs`](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/InvoiceService.cs) (Sales invoicing), [`Shsmg.Pharma.Infra/Persistence/PharmacyDbContext.cs`](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Infra/Persistence/PharmacyDbContext.cs) (Pharmacy database), [`Shsmg.Pharma.Application/Services/PurchaseInvoiceService.cs`](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/PurchaseInvoiceService.cs) (Purchase invoicing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Application access"]
  node_web["Web application<br/>[Program.cs]"]
end

subgraph group_workflows["Business workflows"]
  node_auth["Authentication<br/>[AuthService.cs]"]
  node_customers["Customer management<br/>[CustomerService.cs]"]
  node_sales["Sales invoicing<br/>[InvoiceService.cs]"]
  node_purchasing["Purchase invoicing"]
  node_inventory["Inventory management"]
  node_suppliers["Supplier management<br/>[SupplierService.cs]"]
  node_payments["Payments<br/>[PaymentService.cs]"]
  node_receipts["Receipts<br/>[ReceiptService.cs]"]
  node_companies["Company management<br/>[CompanyService.cs]"]
end

subgraph group_domain["Pharmacy domain"]
  node_entities["Business entities<br/>[Models]"]
  node_customerentity["Customer aggregate<br/>[Customer.cs]"]
  node_patient["Patient information<br/>[PatientInfo.cs]"]
end

subgraph group_infra["Infrastructure"]
  node_identity["Identity service<br/>[IdentityService.cs]"]
  node_customerrepo["Customer repository"]
  node_license["License validation<br/>[LicenseService.cs]"]
  node_pdf["PDF generation"]
  node_db[("Pharmacy database")]
end

node_user(("Pharmacy user"))

node_user -->|"uses"| node_web
node_web -.->|"dispatches to"| node_auth
node_web -.->|"dispatches to"| node_customers
node_web -.->|"dispatches to"| node_sales
node_web -.->|"dispatches to"| node_purchasing
node_web -->|"checks license"| node_license
node_auth -->|"delegates login"| node_identity
node_customers -->|"queries and saves"| node_customerrepo
node_customerrepo -->|"reads and writes"| node_db
node_sales -->|"reads and writes"| node_db
node_purchasing -->|"reads and writes"| node_db
node_purchasing -.->|"updates stock"| node_inventory
node_sales -->|"checks customer"| node_customers
node_sales -.->|"generates document"| node_pdf
node_sales -.->|"tracks payments"| node_payments
node_payments -.->|"records receipts"| node_receipts
node_companies -.->|"license association"| node_license
node_identity -.->|"uses identity store"| node_db
node_db -->|"persists entities"| node_entities
node_customerentity -->|"holds details"| node_patient
node_entities -.->|"includes customer"| node_customerentity

click node_web "https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.WebUI/Program.cs"
click node_auth "https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/AuthService.cs"
click node_identity "https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Infra/Auth/IdentityService.cs"
click node_customers "https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/CustomerService.cs"
click node_customerrepo "https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Infra/Persistence/CustomerRepository.cs"
click node_sales "https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/InvoiceService.cs"
click node_purchasing "https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/PurchaseInvoiceService.cs"
click node_inventory "https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/InventoryService.cs"
click node_suppliers "https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/SupplierService.cs"
click node_payments "https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/PaymentService.cs"
click node_receipts "https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/ReceiptService.cs"
click node_companies "https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/CompanyService.cs"
click node_license "https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Infra/Services/LicenseService.cs"
click node_pdf "https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Infra/Services/PdfGeneratorService.cs"
click node_entities "https://github.com/whiteblizzard9248/pharmacyerp/tree/main/Shsmg.Pharma.Domain/Models"
click node_customerentity "https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Domain/Models/Customer.cs"
click node_patient "https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Domain/Models/PatientInfo.cs"
click node_db "https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Infra/Persistence/PharmacyDbContext.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_web,node_user toneBlue
class node_auth,node_customers,node_sales,node_purchasing,node_inventory,node_suppliers,node_payments,node_receipts,node_companies toneAmber
class node_entities,node_customerentity,node_patient toneMint
class node_identity,node_customerrepo,node_license,node_pdf,node_db toneRose
```

## Components

### Application access

- [Web application](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.WebUI/Program.cs): `Shsmg.Pharma.WebUI/Program.cs`

### Business workflows

- [Authentication](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/AuthService.cs): `Shsmg.Pharma.Application/Services/AuthService.cs`
- [Customer management](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/CustomerService.cs): `Shsmg.Pharma.Application/Services/CustomerService.cs`
- [Sales invoicing](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/InvoiceService.cs): `Shsmg.Pharma.Application/Services/InvoiceService.cs`
- [Purchase invoicing](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/PurchaseInvoiceService.cs): `Shsmg.Pharma.Application/Services/PurchaseInvoiceService.cs`
- [Inventory management](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/InventoryService.cs): `Shsmg.Pharma.Application/Services/InventoryService.cs`
- [Supplier management](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/SupplierService.cs): `Shsmg.Pharma.Application/Services/SupplierService.cs`
- [Payments](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/PaymentService.cs): `Shsmg.Pharma.Application/Services/PaymentService.cs`
- [Receipts](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/ReceiptService.cs): `Shsmg.Pharma.Application/Services/ReceiptService.cs`
- [Company management](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Application/Services/CompanyService.cs): `Shsmg.Pharma.Application/Services/CompanyService.cs`

### Pharmacy domain

- [Business entities](https://github.com/whiteblizzard9248/pharmacyerp/tree/main/Shsmg.Pharma.Domain/Models): `Shsmg.Pharma.Domain/Models`
- [Customer aggregate](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Domain/Models/Customer.cs): `Shsmg.Pharma.Domain/Models/Customer.cs`
- [Patient information](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Domain/Models/PatientInfo.cs): `Shsmg.Pharma.Domain/Models/PatientInfo.cs`

### Infrastructure

- [Identity service](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Infra/Auth/IdentityService.cs): `Shsmg.Pharma.Infra/Auth/IdentityService.cs`
- [Customer repository](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Infra/Persistence/CustomerRepository.cs): `Shsmg.Pharma.Infra/Persistence/CustomerRepository.cs`
- [License validation](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Infra/Services/LicenseService.cs): `Shsmg.Pharma.Infra/Services/LicenseService.cs`
- [PDF generation](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Infra/Services/PdfGeneratorService.cs): `Shsmg.Pharma.Infra/Services/PdfGeneratorService.cs`
- [Pharmacy database](https://github.com/whiteblizzard9248/pharmacyerp/blob/main/Shsmg.Pharma.Infra/Persistence/PharmacyDbContext.cs): `Shsmg.Pharma.Infra/Persistence/PharmacyDbContext.cs`

### Other components

- **Pharmacy user**

## Connections

- Pharmacy user → Web application: uses
- Web application → Authentication: dispatches to
- Web application → Customer management: dispatches to
- Web application → Sales invoicing: dispatches to
- Web application → Purchase invoicing: dispatches to
- Web application → License validation: checks license (evidence: `Shsmg.Pharma.WebUI/Program.cs`)
- Authentication → Identity service: delegates login (evidence: `Shsmg.Pharma.Application/Services/AuthService.cs`)
- Customer management → Customer repository: queries and saves (evidence: `Shsmg.Pharma.Application/Services/CustomerService.cs`)
- Customer repository → Pharmacy database: reads and writes (evidence: `Shsmg.Pharma.Infra/Persistence/CustomerRepository.cs`)
- Sales invoicing → Pharmacy database: reads and writes (evidence: `Shsmg.Pharma.Application/Services/InvoiceService.cs`)
- Purchase invoicing → Pharmacy database: reads and writes (evidence: `Shsmg.Pharma.Application/Services/PurchaseInvoiceService.cs`)
- Purchase invoicing → Inventory management: updates stock
- Sales invoicing → Customer management: checks customer (evidence: `Shsmg.Pharma.Application/Services/InvoiceService.cs`)
- Sales invoicing → PDF generation: generates document
- Sales invoicing → Payments: tracks payments
- Payments → Receipts: records receipts
- Company management → License validation: license association
- Identity service → Pharmacy database: uses identity store
- Pharmacy database → Business entities: persists entities (evidence: `Shsmg.Pharma.Infra/Persistence/PharmacyDbContext.cs`)
- Customer aggregate → Patient information: holds details (evidence: `Shsmg.Pharma.Domain/Models/Customer.cs`)
- Business entities → Customer aggregate: includes customer (evidence: `Shsmg.Pharma.Domain/Models/Customer.cs`)
