# lunalily-17/familyhardwarestore architecture

> Architecture diagram of the GitHub repository lunalily-17/familyhardwarestore, 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/lunalily-17/familyhardwarestore
- Repository: https://github.com/lunalily-17/familyhardwarestore

## Overview

Family Hardware Store is a local-first store-management application with a Razor Pages web app and a WPF desktop variant sharing application, domain, and infrastructure layers. The main shop workflow is catalog and supplier setup, purchase receipt and stock increase, point-of-sale sales and receipt handling, then inventory and sales reporting. Backup/restore, role-based login, audit, export, settings, and printing are supporting capabilities. The legacy MVC API is present but treated as a separate, older implementation. Relationships are limited to source-index references, sampled calls, and README statements; unsampled page-to-service wiring is not asserted.

Main entry points: [`src/HardwareStore.Infrastructure/Persistence/AppDbContext.cs`](https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Infrastructure/Persistence/AppDbContext.cs) (EF data context), [`src/HardwareStore.Web/Program.cs`](https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Web/Program.cs) (Razor Pages app), [`src/HardwareStore.Application/Services/PurchaseService.cs`](https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Application/Services/PurchaseService.cs) (Purchase service), [`src/HardwareStore.Application/Services/AuthService.cs`](https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Application/Services/AuthService.cs) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web Experience"]
  node_webapp["Razor Pages app<br/>[Program.cs]"]
  node_catalog["Catalog management<br/>[Products]"]
  node_categoryui["Category management<br/>[Categories]"]
  node_supplierui["Supplier management<br/>[Suppliers]"]
  node_purchaseui["Purchase workflow<br/>[Purchases]"]
  node_salesui["Sales and receipts<br/>[Sales]"]
  node_reportui["Reporting pages<br/>[Reports]"]
  node_settingsui["Settings pages<br/>[Settings]"]
  node_backupui["Backup pages<br/>[Backup]"]
  node_printing["Receipt printing<br/>[Printing]"]
end

subgraph group_business["Business Operations"]
  node_auth["Authentication<br/>[AuthService.cs]"]
  node_catalogsvc["Catalog services<br/>[ProductService.cs]"]
  node_purchasesvc["Purchase service<br/>[PurchaseService.cs]"]
  node_salessvc["Sales service<br/>[SalesService.cs]"]
  node_inventorysvc["Inventory service"]
  node_reportingsvc["Reporting service"]
  node_settingssvc["Settings service<br/>[SettingsService.cs]"]
  node_audit["Audit service<br/>[AuditService.cs]"]
end

subgraph group_platform["Shared Platform"]
  node_dbcontext[("EF data context<br/>[AppDbContext.cs]")]
  node_domain["Store domain model<br/>[Entities]"]
  node_backup["Backup and restore<br/>[BackupService.cs]"]
  node_export["CSV export"]
end

subgraph group_desktop["Desktop Variant"]
  node_desktopapp["WPF desktop shell<br/>[App.xaml.cs]"]
end

subgraph group_legacy["Legacy MVC API"]
  node_legacyapi["Legacy MVC API<br/>[Program.cs]"]
  node_legacyproducts["Legacy product workflow<br/>[ProductService.cs]"]
  node_legacysales["Legacy sales workflow<br/>[SalesService.cs]"]
  node_legacydb[("Legacy EF context")]
end

node_operator(("Shop operator"))

node_operator -->|"uses"| node_webapp
node_webapp -->|"registers services"| node_auth
node_webapp -->|"registers printer"| node_printing
node_webapp -->|"initializes data"| node_dbcontext
node_purchaseui -.->|"submits purchases"| node_purchasesvc
node_salesui -.->|"submits sales"| node_salessvc
node_catalog -.->|"manages catalog"| node_catalogsvc
node_reportui -.->|"requests reports"| node_reportingsvc
node_backupui -.->|"requests backup"| node_backup
node_settingsui -.->|"updates settings"| node_settingssvc
node_purchasesvc -->|"reads and writes"| node_dbcontext
node_purchasesvc -->|"records action"| node_audit
node_purchasesvc -->|"creates purchase records"| node_domain
node_auth -->|"checks user"| node_dbcontext
node_auth -->|"records login"| node_audit
node_salessvc -->|"reads and writes"| node_dbcontext
node_salessvc -->|"records action"| node_audit
node_dbcontext -->|"persists entities"| node_domain
node_operator -->|"uses"| node_desktopapp
node_legacyapi -->|"routes requests"| node_legacyproducts
node_legacyapi -->|"routes requests"| node_legacysales
node_legacyproducts -->|"reads and writes"| node_legacydb
node_legacysales -->|"reads and writes"| node_legacydb

click node_webapp "https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Web/Program.cs"
click node_catalog "https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Web/Pages/Products"
click node_categoryui "https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Web/Pages/Categories"
click node_supplierui "https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Web/Pages/Suppliers"
click node_purchaseui "https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Web/Pages/Purchases"
click node_salesui "https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Web/Pages/Sales"
click node_reportui "https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Web/Pages/Reports"
click node_settingsui "https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Web/Pages/Settings"
click node_backupui "https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Web/Pages/Backup"
click node_printing "https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Web/Printing"
click node_auth "https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Application/Services/AuthService.cs"
click node_catalogsvc "https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Application/Services/ProductService.cs"
click node_purchasesvc "https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Application/Services/PurchaseService.cs"
click node_salessvc "https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Application/Services/SalesService.cs"
click node_inventorysvc "https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Application/Services/InventoryService.cs"
click node_reportingsvc "https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Application/Services/ReportingService.cs"
click node_settingssvc "https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Application/Services/SettingsService.cs"
click node_audit "https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Application/Services/AuditService.cs"
click node_dbcontext "https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Infrastructure/Persistence/AppDbContext.cs"
click node_domain "https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Domain/Entities"
click node_backup "https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Infrastructure/Services/BackupService.cs"
click node_export "https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Infrastructure/Services/CsvExportService.cs"
click node_desktopapp "https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Desktop/App.xaml.cs"
click node_legacyapi "https://github.com/lunalily-17/familyhardwarestore/blob/main/legacy/FamilyHardwareStore.Api.mvc/Program.cs"
click node_legacyproducts "https://github.com/lunalily-17/familyhardwarestore/blob/main/legacy/FamilyHardwareStore.Api.mvc/Services/ProductService.cs"
click node_legacysales "https://github.com/lunalily-17/familyhardwarestore/blob/main/legacy/FamilyHardwareStore.Api.mvc/Services/SalesService.cs"
click node_legacydb "https://github.com/lunalily-17/familyhardwarestore/blob/main/legacy/FamilyHardwareStore.Api.mvc/Data/HardwareStoreDbContext.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_webapp,node_catalog,node_categoryui,node_supplierui,node_purchaseui,node_salesui,node_reportui,node_settingsui,node_backupui,node_printing toneBlue
class node_auth,node_catalogsvc,node_purchasesvc,node_salessvc,node_inventorysvc,node_reportingsvc,node_settingssvc,node_audit toneAmber
class node_dbcontext,node_domain,node_backup,node_export toneMint
class node_desktopapp toneRose
class node_legacyapi,node_legacyproducts,node_legacysales,node_legacydb,node_operator toneIndigo
```

## Components

### Web Experience

- [Razor Pages app](https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Web/Program.cs): `src/HardwareStore.Web/Program.cs`
- [Catalog management](https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Web/Pages/Products): `src/HardwareStore.Web/Pages/Products`
- [Category management](https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Web/Pages/Categories): `src/HardwareStore.Web/Pages/Categories`
- [Supplier management](https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Web/Pages/Suppliers): `src/HardwareStore.Web/Pages/Suppliers`
- [Purchase workflow](https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Web/Pages/Purchases): `src/HardwareStore.Web/Pages/Purchases`
- [Sales and receipts](https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Web/Pages/Sales): `src/HardwareStore.Web/Pages/Sales`
- [Reporting pages](https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Web/Pages/Reports): `src/HardwareStore.Web/Pages/Reports`
- [Settings pages](https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Web/Pages/Settings): `src/HardwareStore.Web/Pages/Settings`
- [Backup pages](https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Web/Pages/Backup): `src/HardwareStore.Web/Pages/Backup`
- [Receipt printing](https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Web/Printing): `src/HardwareStore.Web/Printing`

### Business Operations

- [Authentication](https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Application/Services/AuthService.cs): `src/HardwareStore.Application/Services/AuthService.cs`
- [Catalog services](https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Application/Services/ProductService.cs): `src/HardwareStore.Application/Services/ProductService.cs`
- [Purchase service](https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Application/Services/PurchaseService.cs): `src/HardwareStore.Application/Services/PurchaseService.cs`
- [Sales service](https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Application/Services/SalesService.cs): `src/HardwareStore.Application/Services/SalesService.cs`
- [Inventory service](https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Application/Services/InventoryService.cs): `src/HardwareStore.Application/Services/InventoryService.cs`
- [Reporting service](https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Application/Services/ReportingService.cs): `src/HardwareStore.Application/Services/ReportingService.cs`
- [Settings service](https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Application/Services/SettingsService.cs): `src/HardwareStore.Application/Services/SettingsService.cs`
- [Audit service](https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Application/Services/AuditService.cs): `src/HardwareStore.Application/Services/AuditService.cs`

### Shared Platform

- [EF data context](https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Infrastructure/Persistence/AppDbContext.cs): `src/HardwareStore.Infrastructure/Persistence/AppDbContext.cs`
- [Store domain model](https://github.com/lunalily-17/familyhardwarestore/tree/main/src/HardwareStore.Domain/Entities): `src/HardwareStore.Domain/Entities`
- [Backup and restore](https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Infrastructure/Services/BackupService.cs): `src/HardwareStore.Infrastructure/Services/BackupService.cs`
- [CSV export](https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Infrastructure/Services/CsvExportService.cs): `src/HardwareStore.Infrastructure/Services/CsvExportService.cs`

### Desktop Variant

- [WPF desktop shell](https://github.com/lunalily-17/familyhardwarestore/blob/main/src/HardwareStore.Desktop/App.xaml.cs): `src/HardwareStore.Desktop/App.xaml.cs`

### Legacy MVC API

- [Legacy MVC API](https://github.com/lunalily-17/familyhardwarestore/blob/main/legacy/FamilyHardwareStore.Api.mvc/Program.cs): `legacy/FamilyHardwareStore.Api.mvc/Program.cs`
- [Legacy product workflow](https://github.com/lunalily-17/familyhardwarestore/blob/main/legacy/FamilyHardwareStore.Api.mvc/Services/ProductService.cs): `legacy/FamilyHardwareStore.Api.mvc/Services/ProductService.cs`
- [Legacy sales workflow](https://github.com/lunalily-17/familyhardwarestore/blob/main/legacy/FamilyHardwareStore.Api.mvc/Services/SalesService.cs): `legacy/FamilyHardwareStore.Api.mvc/Services/SalesService.cs`
- [Legacy EF context](https://github.com/lunalily-17/familyhardwarestore/blob/main/legacy/FamilyHardwareStore.Api.mvc/Data/HardwareStoreDbContext.cs): `legacy/FamilyHardwareStore.Api.mvc/Data/HardwareStoreDbContext.cs`

### Other components

- **Shop operator**

## Connections

- Shop operator → Razor Pages app: uses (evidence: `README.md`)
- Razor Pages app → Authentication: registers services (evidence: `src/HardwareStore.Web/Program.cs`)
- Razor Pages app → Receipt printing: registers printer (evidence: `src/HardwareStore.Web/Program.cs`)
- Razor Pages app → EF data context: initializes data (evidence: `src/HardwareStore.Web/Program.cs`)
- Purchase workflow → Purchase service: submits purchases
- Sales and receipts → Sales service: submits sales
- Catalog management → Catalog services: manages catalog
- Reporting pages → Reporting service: requests reports
- Backup pages → Backup and restore: requests backup
- Settings pages → Settings service: updates settings
- Purchase service → EF data context: reads and writes (evidence: `src/HardwareStore.Application/Services/PurchaseService.cs`)
- Purchase service → Audit service: records action (evidence: `src/HardwareStore.Application/Services/PurchaseService.cs`)
- Purchase service → Store domain model: creates purchase records (evidence: `src/HardwareStore.Application/Services/PurchaseService.cs`)
- Authentication → EF data context: checks user (evidence: `src/HardwareStore.Application/Services/AuthService.cs`)
- Authentication → Audit service: records login (evidence: `src/HardwareStore.Application/Services/AuthService.cs`)
- Sales service → EF data context: reads and writes (evidence: `src/HardwareStore.Application/Services/SalesService.cs`)
- Sales service → Audit service: records action (evidence: `src/HardwareStore.Application/Services/SalesService.cs`)
- EF data context → Store domain model: persists entities (evidence: `src/HardwareStore.Infrastructure/Persistence/AppDbContext.cs`)
- Shop operator → WPF desktop shell: uses (evidence: `README.md`)
- Legacy MVC API → Legacy product workflow: routes requests
- Legacy MVC API → Legacy sales workflow: routes requests
- Legacy product workflow → Legacy EF context: reads and writes (evidence: `legacy/FamilyHardwareStore.Api.mvc/Services/ProductService.cs`)
- Legacy sales workflow → Legacy EF context: reads and writes (evidence: `legacy/FamilyHardwareStore.Api.mvc/Services/SalesService.cs`)
