# chuduc2k5/oop architecture

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

- Interactive diagram: https://gitdiagram.com/chuduc2k5/oop
- Repository: https://github.com/chuduc2k5/oop

## Overview

This is a pharmacy commerce and back-office system: customers browse medicines, manage a cart, submit prescriptions when needed, place orders and pay by manual QR transfer; staff and administrators manage dispensing, payments, stock, sales and reporting. The documented runtime is Next.js → ASP.NET Core → SQLite. The graph preserves the documented capabilities, while edges for unsampled modules are limited to documented system boundaries or marked unverified; source-index references support the sampled service and controller relationships.

Main entry points: [`backend/Pharmacy.Core/Services/OrderService.cs`](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/OrderService.cs) (Order and checkout), [`backend/Pharmacy.Core/Data/PharmacyDbContext.cs`](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Data/PharmacyDbContext.cs) (EF Core context), [`backend/Pharmacy.Core/Services/InventoryService.cs`](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/InventoryService.cs) (FEFO inventory), [`frontend/src/components/backoffice`](https://github.com/chuduc2k5/oop/tree/main/frontend/src/components/backoffice) (Back-office pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_frontend["Next.js application"]
  node_cartui["Cart and checkout<br/>[page.tsx]"]
  node_rxui["Prescription pages"]
  node_backofficeui["Back-office pages"]
end

subgraph group_api["API boundary"]
  node_apiapp["ASP.NET API<br/>[Program.cs]"]
  node_authapi["Accounts and auth<br/>[AuthController.cs]"]
  node_catalogapi["Drug catalog API<br/>[DrugsController.cs]"]
  node_rxapi["Prescription API"]
  node_staffordersapi["Staff order API"]
  node_otherapi["Other API routes<br/>[Controllers]"]
end

subgraph group_commerce["Commerce workflows"]
  node_accounts["Account service<br/>[AccountService.cs]"]
  node_catalog["Product catalog<br/>[ProductService.cs]"]
  node_cart["Cart service<br/>[CartService.cs]"]
  node_orders["Order and checkout<br/>[OrderService.cs]"]
  node_payments["Manual QR payments"]
  node_prescriptions["Prescription workflow"]
end

subgraph group_operations["Pharmacy operations"]
  node_inventory["FEFO inventory"]
  node_inventoryread["Inventory reader<br/>[InventoryReader.cs]"]
  node_sales["Counter sales<br/>[SaleService.cs]"]
  node_invoices["Invoices<br/>[InvoiceService.cs]"]
  node_reports["Inventory reports"]
  node_dashboard["Dashboard"]
end

subgraph group_persistence["Domain and persistence"]
  node_domain["Pharmacy domain<br/>[Domain]"]
  node_dbcontext[("EF Core context")]
  node_database[("Relational database")]
end

node_customer(("Customer"))
node_staff(("Staff / admin"))

node_customer -->|"uses"| node_frontend
node_staff -->|"uses"| node_frontend
node_frontend -->|"rewrites API calls"| node_apiapp
node_customer -->|"shops"| node_cartui
node_customer -->|"submits prescriptions"| node_rxui
node_staff -->|"operates pharmacy"| node_backofficeui
node_authapi -->|"calls"| node_accounts
node_catalogapi -->|"calls"| node_catalog
node_catalogapi -->|"calls"| node_inventory
node_rxapi -->|"calls"| node_prescriptions
node_staffordersapi -->|"calls"| node_orders
node_staffordersapi -.->|"calls"| node_cart
node_cart -->|"reads availability"| node_inventoryread
node_cart -->|"checks stock"| node_inventory
node_orders -->|"uses cart data"| node_cart
node_orders -->|"checks quota"| node_prescriptions
node_orders -->|"reads stock"| node_inventoryread
node_orders -->|"reserves stock"| node_inventory
node_rxapi -->|"manages review"| node_prescriptions
node_apiapp -->|"registers service"| node_accounts
node_apiapp -->|"registers service"| node_inventory
node_apiapp -->|"registers service"| node_prescriptions
node_apiapp -->|"registers service"| node_orders
node_cartui -.->|"places orders"| node_orders
node_orders -.->|"payment workflow"| node_payments
node_backofficeui -.->|"records counter sales"| node_sales
node_backofficeui -.->|"manages batches"| node_inventory
node_backofficeui -.->|"views invoices"| node_invoices
node_backofficeui -.->|"views reports"| node_reports
node_backofficeui -.->|"views summary"| node_dashboard
node_orders -.->|"invoice workflow"| node_invoices
node_inventory -->|"uses reader"| node_inventoryread
node_catalog -.->|"queries catalog"| node_dbcontext
node_inventoryread -->|"reads stock"| node_dbcontext
node_inventory -->|"writes stock"| node_dbcontext
node_orders -->|"persists orders"| node_dbcontext
node_prescriptions -->|"persists prescriptions"| node_dbcontext
node_accounts -->|"persists accounts"| node_dbcontext
node_dbcontext -->|"maps entities"| node_domain
node_dbcontext -->|"reads and writes"| node_database

click node_frontend "https://github.com/chuduc2k5/oop/tree/main/frontend/src/app"
click node_cartui "https://github.com/chuduc2k5/oop/blob/main/frontend/src/app/checkout/page.tsx"
click node_rxui "https://github.com/chuduc2k5/oop/tree/main/frontend/src/app/prescriptions"
click node_backofficeui "https://github.com/chuduc2k5/oop/tree/main/frontend/src/components/backoffice"
click node_apiapp "https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Api/Program.cs"
click node_authapi "https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Api/Controllers/AuthController.cs"
click node_catalogapi "https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Api/Controllers/DrugsController.cs"
click node_rxapi "https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Api/Controllers/PrescriptionsController.cs"
click node_staffordersapi "https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Api/Controllers/StaffOrdersController.cs"
click node_otherapi "https://github.com/chuduc2k5/oop/tree/main/backend/Pharmacy.Api/Controllers"
click node_accounts "https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/AccountService.cs"
click node_catalog "https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/ProductService.cs"
click node_cart "https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/CartService.cs"
click node_orders "https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/OrderService.cs"
click node_payments "https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/ManualPaymentService.cs"
click node_prescriptions "https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/PrescriptionService.cs"
click node_inventory "https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/InventoryService.cs"
click node_inventoryread "https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/InventoryReader.cs"
click node_sales "https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/SaleService.cs"
click node_invoices "https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/InvoiceService.cs"
click node_reports "https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/InventoryReportService.cs"
click node_dashboard "https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/DashboardService.cs"
click node_domain "https://github.com/chuduc2k5/oop/tree/main/backend/Pharmacy.Core/Domain"
click node_dbcontext "https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Data/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_frontend,node_cartui,node_rxui,node_backofficeui toneBlue
class node_apiapp,node_authapi,node_catalogapi,node_rxapi,node_staffordersapi,node_otherapi toneAmber
class node_accounts,node_catalog,node_cart,node_orders,node_payments,node_prescriptions toneMint
class node_inventory,node_inventoryread,node_sales,node_invoices,node_reports,node_dashboard toneRose
class node_domain,node_dbcontext,node_database,node_customer,node_staff toneIndigo
```

## Components

### Web experience

- [Next.js application](https://github.com/chuduc2k5/oop/tree/main/frontend/src/app): `frontend/src/app`
- [Cart and checkout](https://github.com/chuduc2k5/oop/blob/main/frontend/src/app/checkout/page.tsx): `frontend/src/app/checkout/page.tsx`
- [Prescription pages](https://github.com/chuduc2k5/oop/tree/main/frontend/src/app/prescriptions): `frontend/src/app/prescriptions`
- [Back-office pages](https://github.com/chuduc2k5/oop/tree/main/frontend/src/components/backoffice): `frontend/src/components/backoffice`

### API boundary

- [ASP.NET API](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Api/Program.cs): `backend/Pharmacy.Api/Program.cs`
- [Accounts and auth](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Api/Controllers/AuthController.cs): `backend/Pharmacy.Api/Controllers/AuthController.cs`
- [Drug catalog API](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Api/Controllers/DrugsController.cs): `backend/Pharmacy.Api/Controllers/DrugsController.cs`
- [Prescription API](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Api/Controllers/PrescriptionsController.cs): `backend/Pharmacy.Api/Controllers/PrescriptionsController.cs`
- [Staff order API](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Api/Controllers/StaffOrdersController.cs): `backend/Pharmacy.Api/Controllers/StaffOrdersController.cs`
- [Other API routes](https://github.com/chuduc2k5/oop/tree/main/backend/Pharmacy.Api/Controllers): `backend/Pharmacy.Api/Controllers`

### Commerce workflows

- [Account service](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/AccountService.cs): `backend/Pharmacy.Core/Services/AccountService.cs`
- [Product catalog](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/ProductService.cs): `backend/Pharmacy.Core/Services/ProductService.cs`
- [Cart service](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/CartService.cs): `backend/Pharmacy.Core/Services/CartService.cs`
- [Order and checkout](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/OrderService.cs): `backend/Pharmacy.Core/Services/OrderService.cs`
- [Manual QR payments](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/ManualPaymentService.cs): `backend/Pharmacy.Core/Services/ManualPaymentService.cs`
- [Prescription workflow](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/PrescriptionService.cs): `backend/Pharmacy.Core/Services/PrescriptionService.cs`

### Pharmacy operations

- [FEFO inventory](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/InventoryService.cs): `backend/Pharmacy.Core/Services/InventoryService.cs`
- [Inventory reader](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/InventoryReader.cs): `backend/Pharmacy.Core/Services/InventoryReader.cs`
- [Counter sales](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/SaleService.cs): `backend/Pharmacy.Core/Services/SaleService.cs`
- [Invoices](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/InvoiceService.cs): `backend/Pharmacy.Core/Services/InvoiceService.cs`
- [Inventory reports](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/InventoryReportService.cs): `backend/Pharmacy.Core/Services/InventoryReportService.cs`
- [Dashboard](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Services/DashboardService.cs): `backend/Pharmacy.Core/Services/DashboardService.cs`

### Domain and persistence

- [Pharmacy domain](https://github.com/chuduc2k5/oop/tree/main/backend/Pharmacy.Core/Domain): `backend/Pharmacy.Core/Domain`
- [EF Core context](https://github.com/chuduc2k5/oop/blob/main/backend/Pharmacy.Core/Data/PharmacyDbContext.cs): `backend/Pharmacy.Core/Data/PharmacyDbContext.cs`
- **Relational database**

### Other components

- **Customer**
- **Staff / admin**

## Connections

- Customer → Next.js application: uses (evidence: `README.md`)
- Staff / admin → Next.js application: uses (evidence: `README.md`)
- Next.js application → ASP.NET API: rewrites API calls (evidence: `README.md`)
- Customer → Cart and checkout: shops
- Customer → Prescription pages: submits prescriptions (evidence: `README.md`)
- Staff / admin → Back-office pages: operates pharmacy (evidence: `README.md`)
- Accounts and auth → Account service: calls (evidence: `backend/Pharmacy.Api/Controllers/AuthController.cs`)
- Drug catalog API → Product catalog: calls (evidence: `backend/Pharmacy.Api/Controllers/DrugsController.cs`)
- Drug catalog API → FEFO inventory: calls (evidence: `backend/Pharmacy.Api/Controllers/DrugsController.cs`)
- Prescription API → Prescription workflow: calls (evidence: `backend/Pharmacy.Api/Controllers/PrescriptionsController.cs`)
- Staff order API → Order and checkout: calls (evidence: `backend/Pharmacy.Api/Controllers/StaffOrdersController.cs`)
- Staff order API → Cart service: calls (evidence: `backend/Pharmacy.Api/Controllers/StaffOrdersController.cs`)
- Cart service → Inventory reader: reads availability (evidence: `backend/Pharmacy.Core/Services/CartService.cs`)
- Cart service → FEFO inventory: checks stock (evidence: `backend/Pharmacy.Core/Services/CartService.cs`)
- Order and checkout → Cart service: uses cart data (evidence: `backend/Pharmacy.Core/Services/OrderService.cs`)
- Order and checkout → Prescription workflow: checks quota (evidence: `backend/Pharmacy.Core/Services/OrderService.cs`)
- Order and checkout → Inventory reader: reads stock (evidence: `backend/Pharmacy.Core/Services/OrderService.cs`)
- Order and checkout → FEFO inventory: reserves stock (evidence: `backend/Pharmacy.Core/Services/OrderService.cs`)
- Prescription API → Prescription workflow: manages review (evidence: `backend/Pharmacy.Core/Services/PrescriptionService.cs`)
- ASP.NET API → Account service: registers service (evidence: `backend/Pharmacy.Api/Program.cs`)
- ASP.NET API → FEFO inventory: registers service (evidence: `backend/Pharmacy.Api/Program.cs`)
- ASP.NET API → Prescription workflow: registers service (evidence: `backend/Pharmacy.Api/Program.cs`)
- ASP.NET API → Order and checkout: registers service (evidence: `backend/Pharmacy.Api/Program.cs`)
- Cart and checkout → Order and checkout: places orders
- Order and checkout → Manual QR payments: payment workflow
- Back-office pages → Counter sales: records counter sales
- Back-office pages → FEFO inventory: manages batches
- Back-office pages → Invoices: views invoices
- Back-office pages → Inventory reports: views reports
- Back-office pages → Dashboard: views summary
- Order and checkout → Invoices: invoice workflow
- FEFO inventory → Inventory reader: uses reader (evidence: `backend/Pharmacy.Core/Services/InventoryService.cs`)
- Product catalog → EF Core context: queries catalog
- Inventory reader → EF Core context: reads stock (evidence: `backend/Pharmacy.Core/Services/InventoryReader.cs`)
- FEFO inventory → EF Core context: writes stock (evidence: `backend/Pharmacy.Core/Services/InventoryService.cs`)
- Order and checkout → EF Core context: persists orders (evidence: `backend/Pharmacy.Core/Services/OrderService.cs`)
- Prescription workflow → EF Core context: persists prescriptions (evidence: `backend/Pharmacy.Core/Services/PrescriptionService.cs`)
- Account service → EF Core context: persists accounts (evidence: `backend/Pharmacy.Core/Services/AccountService.cs`)
- EF Core context → Pharmacy domain: maps entities (evidence: `backend/Pharmacy.Core/Data/PharmacyDbContext.cs`)
- EF Core context → Relational database: reads and writes (evidence: `README.md`)
