# maxusfr0st/yarne architecture

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

- Interactive diagram: https://gitdiagram.com/maxusfr0st/yarne
- Repository: https://github.com/maxusfr0st/yarne

## Overview

Yarné is a vertically integrated textile-business platform: a localized storefront and an admin ERP share a .NET API and business database. The shopper path runs from catalog browsing through checkout and order handling; operators manage catalog, orders, and accounting workflows, including procurement, production, sales, returns, expenses, and reports. The README documents shipping, email, image storage, authentication, and limited offline expense entry. Backend excerpts are partial, so some subsystem connections follow explicit README descriptions rather than inspected call sites.

Main entry points: [`YarneFront/src/app/api/orders.ts`](https://github.com/maxusfr0st/yarne/blob/main/YarneFront/src/app/api/orders.ts) (API clients), [`YarneBack/YarneAPIBack/YarneAPIBack/Data/YarneDbContext.cs`](https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Data/YarneDbContext.cs) (Business database), [`YarneBack/YarneAPIBack/YarneAPIBack/Controllers/OrdersController.cs`](https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Controllers/OrdersController.cs) (API controllers), [`YarneFront/src/app/routes.tsx`](https://github.com/maxusfr0st/yarne/blob/main/YarneFront/src/app/routes.tsx) (Storefront routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_store["Storefront"]
  node_routes["Storefront routes<br/>[routes.tsx]"]
  node_checkout["Checkout UI<br/>[CheckoutPage.tsx]"]
  node_frontendapi["API clients<br/>[orders.ts]"]
end

subgraph group_admin["Admin ERP"]
  node_adminui["Admin UI<br/>[AdminPage.tsx]"]
  node_expensequeue["Offline expenses<br/>[expenseQueue.ts]"]
end

subgraph group_backend["API and domain"]
  node_controllers["API controllers"]
  node_catalog["Catalog service<br/>[ProductService.cs]"]
  node_auth["Auth services<br/>[AuthService.cs]"]
  node_accounting["Accounting services"]
  node_sales["Sales accounting"]
  node_procurement["Procurement"]
  node_production["Production"]
  node_returns["Returns<br/>[ReturnService.cs]"]
  node_reports["Accounting reports"]
  node_images["Image handling"]
  node_normalizer["Image normalization"]
end

subgraph group_state["Persistence and media"]
  node_db[("Business database<br/>[YarneDbContext.cs]")]
end

subgraph group_integrations["External services"]
  node_r2["R2 storage"]
  node_shipping["Nova Poshta"]
  node_email["Email delivery"]
  node_carrier{{"Carrier API"}}
  node_emailprovider{{"Email provider"}}
end

node_shopper(("Shopper"))
node_operator(("Admin operator"))

node_shopper -->|"browses"| node_routes
node_routes -->|"opens checkout"| node_checkout
node_checkout -->|"submits order"| node_frontendapi
node_frontendapi -->|"HTTP requests"| node_controllers
node_controllers -->|"reads/writes"| node_db
node_controllers -.->|"builds confirmation"| node_email
node_controllers -.->|"requests shipment"| node_shipping
node_shipping -.->|"tracking / waybill"| node_carrier
node_email -.->|"delivers email"| node_emailprovider
node_routes -->|"loads catalog"| node_frontendapi
node_frontendapi -->|"catalog requests"| node_catalog
node_catalog -->|"reads/writes"| node_db
node_operator -->|"operates ERP"| node_adminui
node_adminui -->|"admin requests"| node_frontendapi
node_adminui -->|"queues offline"| node_expensequeue
node_expensequeue -->|"syncs entries"| node_frontendapi
node_frontendapi -->|"accounting requests"| node_accounting
node_accounting -->|"reads/writes"| node_db
node_frontendapi -->|"sales requests"| node_sales
node_frontendapi -->|"procurement requests"| node_procurement
node_frontendapi -->|"production requests"| node_production
node_frontendapi -->|"return requests"| node_returns
node_frontendapi -->|"report requests"| node_reports
node_sales -->|"reads/writes"| node_db
node_procurement -->|"reads/writes"| node_db
node_production -->|"reads/writes"| node_db
node_returns -->|"reads/writes"| node_db
node_reports -->|"queries"| node_db
node_frontendapi -->|"auth requests"| node_auth
node_auth -->|"reads/writes"| node_db
node_operator -->|"uploads images"| node_images
node_images -->|"normalizes uploads"| node_normalizer
node_images -.->|"stores objects"| node_r2

click node_routes "https://github.com/maxusfr0st/yarne/blob/main/YarneFront/src/app/routes.tsx"
click node_checkout "https://github.com/maxusfr0st/yarne/blob/main/YarneFront/src/app/pages/CheckoutPage.tsx"
click node_frontendapi "https://github.com/maxusfr0st/yarne/blob/main/YarneFront/src/app/api/orders.ts"
click node_adminui "https://github.com/maxusfr0st/yarne/blob/main/YarneFront/src/app/pages/AdminPage.tsx"
click node_expensequeue "https://github.com/maxusfr0st/yarne/blob/main/YarneFront/src/app/offline/expenseQueue.ts"
click node_controllers "https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Controllers/OrdersController.cs"
click node_catalog "https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Services/ProductService.cs"
click node_auth "https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Services/AuthService.cs"
click node_accounting "https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Accounting/Services/AccountingService.cs"
click node_sales "https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Accounting/Services/SalesAccountingService.cs"
click node_procurement "https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Accounting/Services/ProcurementService.cs"
click node_production "https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Accounting/Services/ProductionService.cs"
click node_returns "https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Accounting/Services/ReturnService.cs"
click node_reports "https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Accounting/Services/AccountingReportsV3Service.cs"
click node_db "https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Data/YarneDbContext.cs"
click node_images "https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Controllers/ImagesController.cs"
click node_normalizer "https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Services/ImageUploadNormalizer.cs"
click node_r2 "https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Services/R2ImageStorageService.cs"
click node_shipping "https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Services/NovaPoshtaService.cs"
click node_email "https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Services/OrderConfirmationEmailBuilder.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_routes,node_checkout,node_frontendapi toneBlue
class node_adminui,node_expensequeue toneAmber
class node_controllers,node_catalog,node_auth,node_accounting,node_sales,node_procurement,node_production,node_returns,node_reports,node_images,node_normalizer toneMint
class node_db toneRose
class node_r2,node_shipping,node_email,node_carrier,node_emailprovider,node_shopper,node_operator toneIndigo
```

## Components

### Storefront

- [Storefront routes](https://github.com/maxusfr0st/yarne/blob/main/YarneFront/src/app/routes.tsx): `YarneFront/src/app/routes.tsx`
- [Checkout UI](https://github.com/maxusfr0st/yarne/blob/main/YarneFront/src/app/pages/CheckoutPage.tsx): `YarneFront/src/app/pages/CheckoutPage.tsx`
- [API clients](https://github.com/maxusfr0st/yarne/blob/main/YarneFront/src/app/api/orders.ts): `YarneFront/src/app/api/orders.ts`

### Admin ERP

- [Admin UI](https://github.com/maxusfr0st/yarne/blob/main/YarneFront/src/app/pages/AdminPage.tsx): `YarneFront/src/app/pages/AdminPage.tsx`
- [Offline expenses](https://github.com/maxusfr0st/yarne/blob/main/YarneFront/src/app/offline/expenseQueue.ts): `YarneFront/src/app/offline/expenseQueue.ts`

### API and domain

- [API controllers](https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Controllers/OrdersController.cs): `YarneBack/YarneAPIBack/YarneAPIBack/Controllers/OrdersController.cs`
- [Catalog service](https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Services/ProductService.cs): `YarneBack/YarneAPIBack/YarneAPIBack/Services/ProductService.cs`
- [Auth services](https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Services/AuthService.cs): `YarneBack/YarneAPIBack/YarneAPIBack/Services/AuthService.cs`
- [Accounting services](https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Accounting/Services/AccountingService.cs): `YarneBack/YarneAPIBack/YarneAPIBack/Accounting/Services/AccountingService.cs`
- [Sales accounting](https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Accounting/Services/SalesAccountingService.cs): `YarneBack/YarneAPIBack/YarneAPIBack/Accounting/Services/SalesAccountingService.cs`
- [Procurement](https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Accounting/Services/ProcurementService.cs): `YarneBack/YarneAPIBack/YarneAPIBack/Accounting/Services/ProcurementService.cs`
- [Production](https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Accounting/Services/ProductionService.cs): `YarneBack/YarneAPIBack/YarneAPIBack/Accounting/Services/ProductionService.cs`
- [Returns](https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Accounting/Services/ReturnService.cs): `YarneBack/YarneAPIBack/YarneAPIBack/Accounting/Services/ReturnService.cs`
- [Accounting reports](https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Accounting/Services/AccountingReportsV3Service.cs): `YarneBack/YarneAPIBack/YarneAPIBack/Accounting/Services/AccountingReportsV3Service.cs`
- [Image handling](https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Controllers/ImagesController.cs): `YarneBack/YarneAPIBack/YarneAPIBack/Controllers/ImagesController.cs`
- [Image normalization](https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Services/ImageUploadNormalizer.cs): `YarneBack/YarneAPIBack/YarneAPIBack/Services/ImageUploadNormalizer.cs`

### Persistence and media

- [Business database](https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Data/YarneDbContext.cs): `YarneBack/YarneAPIBack/YarneAPIBack/Data/YarneDbContext.cs`

### External services

- [R2 storage](https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Services/R2ImageStorageService.cs): `YarneBack/YarneAPIBack/YarneAPIBack/Services/R2ImageStorageService.cs`
- [Nova Poshta](https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Services/NovaPoshtaService.cs): `YarneBack/YarneAPIBack/YarneAPIBack/Services/NovaPoshtaService.cs`
- [Email delivery](https://github.com/maxusfr0st/yarne/blob/main/YarneBack/YarneAPIBack/YarneAPIBack/Services/OrderConfirmationEmailBuilder.cs): `YarneBack/YarneAPIBack/YarneAPIBack/Services/OrderConfirmationEmailBuilder.cs`
- **Carrier API**
- **Email provider**

### Other components

- **Shopper**
- **Admin operator**

## Connections

- Shopper → Storefront routes: browses
- Storefront routes → Checkout UI: opens checkout
- Checkout UI → API clients: submits order
- API clients → API controllers: HTTP requests
- API controllers → Business database: reads/writes
- API controllers → Email delivery: builds confirmation
- API controllers → Nova Poshta: requests shipment
- Nova Poshta → Carrier API: tracking / waybill
- Email delivery → Email provider: delivers email
- Storefront routes → API clients: loads catalog
- API clients → Catalog service: catalog requests
- Catalog service → Business database: reads/writes
- Admin operator → Admin UI: operates ERP
- Admin UI → API clients: admin requests
- Admin UI → Offline expenses: queues offline
- Offline expenses → API clients: syncs entries
- API clients → Accounting services: accounting requests
- Accounting services → Business database: reads/writes
- API clients → Sales accounting: sales requests
- API clients → Procurement: procurement requests
- API clients → Production: production requests
- API clients → Returns: return requests
- API clients → Accounting reports: report requests
- Sales accounting → Business database: reads/writes
- Procurement → Business database: reads/writes
- Production → Business database: reads/writes
- Returns → Business database: reads/writes
- Accounting reports → Business database: queries
- API clients → Auth services: auth requests
- Auth services → Business database: reads/writes
- Admin operator → Image handling: uploads images
- Image handling → Image normalization: normalizes uploads
- Image handling → R2 storage: stores objects
