# akonaweb/eshop architecture

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

- Interactive diagram: https://gitdiagram.com/akonaweb/eshop
- Repository: https://github.com/akonaweb/eshop

## Overview

Eshop is a web shop with a Next.js client and an ASP.NET Web API. The principal workflow is browsing products, building a cart, and submitting an order; administrators manage catalog entries and orders, while users can authenticate. The API routes requests through MediatR feature handlers to EF Core persistence. The graph includes these documented-by-tree capabilities, but client-to-API and most handler-to-storage links are dashed because the relevant source was not sampled. The README primarily documents configuration and deployment, not detailed product behavior.

Main entry points: [`Eshop.Client/api/core/api.ts`](https://github.com/akonaweb/eshop/blob/main/Eshop.Client/api/core/api.ts) (Client API access), [`Eshop.Persistence/EshopDbContext.cs`](https://github.com/akonaweb/eshop/blob/main/Eshop.Persistence/EshopDbContext.cs) (EF data context), [`Eshop.WebApi/Features/Categories`](https://github.com/akonaweb/eshop/tree/main/Eshop.WebApi/Features/Categories) (Category API), [`Eshop.WebApi/Features/Products`](https://github.com/akonaweb/eshop/tree/main/Eshop.WebApi/Features/Products) (Product API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Shop client"]
  node_storefront["Storefront<br/>[page.tsx]"]
  node_productbrowse["Product browsing<br/>[page.tsx]"]
  node_buycontrols["Quantity and buy<br/>[QuantityAndBuy.tsx]"]
  node_cartui["Cart and checkout<br/>[page.tsx]"]
  node_clientapi["Client API access<br/>[api.ts]"]
  node_adminui["Admin screens<br/>[admin]"]
end

subgraph group_api["API features"]
  node_categories["Category API<br/>[Categories]"]
  node_products["Product API<br/>[Products]"]
  node_orders["Order API<br/>[Orders]"]
  node_users["User API<br/>[Users]"]
  node_categorycontroller["Category routes"]
  node_productcontroller["Product routes"]
  node_ordercontroller["Order routes<br/>[OrderController.cs]"]
  node_usercontroller["User routes<br/>[UserController.cs]"]
  node_exceptions["API error mapping"]
end

subgraph group_domain["Commerce domain"]
  node_catalogdomain["Catalog entities<br/>[Product.cs]"]
  node_orderdomain["Order entities<br/>[Order.cs]"]
end

subgraph group_persistence["Persistence and identity"]
  node_dbcontext[("EF data context<br/>[EshopDbContext.cs]")]
  node_identityuser["Identity user<br/>[ApplicationUser.cs]"]
end

subgraph group_auth["Authentication"]
  node_tokenmanager["Token manager<br/>[TokenManager.cs]"]
  node_authconfig["JWT configuration"]
end

node_shopper(("Shopper"))
node_admin(("Administrator"))

node_shopper -.->|"browses"| node_storefront
node_shopper -.->|"views products"| node_productbrowse
node_productbrowse -->|"offers buying"| node_buycontrols
node_shopper -.->|"checks out"| node_cartui
node_admin -.->|"manages shop"| node_adminui
node_storefront -.->|"requests data"| node_clientapi
node_productbrowse -.->|"requests data"| node_clientapi
node_cartui -.->|"submits cart"| node_clientapi
node_adminui -.->|"requests changes"| node_clientapi
node_clientapi -.->|"calls API"| node_categories
node_clientapi -.->|"calls API"| node_products
node_clientapi -.->|"calls API"| node_orders
node_clientapi -.->|"calls API"| node_users
node_categorycontroller -->|"dispatches"| node_categories
node_productcontroller -->|"dispatches"| node_products
node_ordercontroller -->|"dispatches"| node_orders
node_usercontroller -->|"dispatches"| node_users
node_products -.->|"reads and writes"| node_dbcontext
node_categories -.->|"reads and writes"| node_dbcontext
node_orders -.->|"reads and writes"| node_dbcontext
node_users -.->|"uses identity"| node_identityuser
node_dbcontext -->|"maps entities"| node_catalogdomain
node_dbcontext -->|"maps entities"| node_orderdomain
node_orderdomain -->|"contains product items"| node_catalogdomain
node_tokenmanager -->|"updates refresh token"| node_identityuser
node_tokenmanager -->|"uses signing settings"| node_authconfig
node_usercontroller -.->|"issues tokens"| node_tokenmanager
node_exceptions -.->|"maps failures"| node_categories
node_exceptions -.->|"maps failures"| node_products
node_exceptions -.->|"maps failures"| node_orders

click node_storefront "https://github.com/akonaweb/eshop/blob/main/Eshop.Client/app/(home)/page.tsx"
click node_productbrowse "https://github.com/akonaweb/eshop/blob/main/Eshop.Client/app/products/%5BcategoryId%5D/page.tsx"
click node_buycontrols "https://github.com/akonaweb/eshop/blob/main/Eshop.Client/app/products/%5BcategoryId%5D/QuantityAndBuy.tsx"
click node_cartui "https://github.com/akonaweb/eshop/blob/main/Eshop.Client/app/cart/page.tsx"
click node_clientapi "https://github.com/akonaweb/eshop/blob/main/Eshop.Client/api/core/api.ts"
click node_adminui "https://github.com/akonaweb/eshop/tree/main/Eshop.Client/app/admin"
click node_categories "https://github.com/akonaweb/eshop/tree/main/Eshop.WebApi/Features/Categories"
click node_products "https://github.com/akonaweb/eshop/tree/main/Eshop.WebApi/Features/Products"
click node_orders "https://github.com/akonaweb/eshop/tree/main/Eshop.WebApi/Features/Orders"
click node_users "https://github.com/akonaweb/eshop/tree/main/Eshop.WebApi/Features/Users"
click node_categorycontroller "https://github.com/akonaweb/eshop/blob/main/Eshop.WebApi/Features/Categories/CategoryController.cs"
click node_productcontroller "https://github.com/akonaweb/eshop/blob/main/Eshop.WebApi/Features/Products/ProductController.cs"
click node_ordercontroller "https://github.com/akonaweb/eshop/blob/main/Eshop.WebApi/Features/Orders/OrderController.cs"
click node_usercontroller "https://github.com/akonaweb/eshop/blob/main/Eshop.WebApi/Features/Users/UserController.cs"
click node_catalogdomain "https://github.com/akonaweb/eshop/blob/main/Eshop.Domain/Product.cs"
click node_orderdomain "https://github.com/akonaweb/eshop/blob/main/Eshop.Domain/Order.cs"
click node_dbcontext "https://github.com/akonaweb/eshop/blob/main/Eshop.Persistence/EshopDbContext.cs"
click node_identityuser "https://github.com/akonaweb/eshop/blob/main/Eshop.Persistence/ApplicationUser.cs"
click node_tokenmanager "https://github.com/akonaweb/eshop/blob/main/Eshop.WebApi/Infrastructure/TokenManager.cs"
click node_authconfig "https://github.com/akonaweb/eshop/blob/main/Eshop.WebApi/Infrastructure/AuthConfiguration.cs"
click node_exceptions "https://github.com/akonaweb/eshop/blob/main/Eshop.WebApi/Filters/GlobalExceptionFilter.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_storefront,node_productbrowse,node_buycontrols,node_cartui,node_clientapi,node_adminui toneBlue
class node_categories,node_products,node_orders,node_users,node_categorycontroller,node_productcontroller,node_ordercontroller,node_usercontroller,node_exceptions toneAmber
class node_catalogdomain,node_orderdomain toneMint
class node_dbcontext,node_identityuser toneRose
class node_tokenmanager,node_authconfig,node_shopper,node_admin toneIndigo
```

## Components

### Shop client

- [Storefront](https://github.com/akonaweb/eshop/blob/main/Eshop.Client/app/(home)/page.tsx): `Eshop.Client/app/(home)/page.tsx`
- [Product browsing](https://github.com/akonaweb/eshop/blob/main/Eshop.Client/app/products/%5BcategoryId%5D/page.tsx): `Eshop.Client/app/products/[categoryId]/page.tsx`
- [Quantity and buy](https://github.com/akonaweb/eshop/blob/main/Eshop.Client/app/products/%5BcategoryId%5D/QuantityAndBuy.tsx): `Eshop.Client/app/products/[categoryId]/QuantityAndBuy.tsx`
- [Cart and checkout](https://github.com/akonaweb/eshop/blob/main/Eshop.Client/app/cart/page.tsx): `Eshop.Client/app/cart/page.tsx`
- [Client API access](https://github.com/akonaweb/eshop/blob/main/Eshop.Client/api/core/api.ts): `Eshop.Client/api/core/api.ts`
- [Admin screens](https://github.com/akonaweb/eshop/tree/main/Eshop.Client/app/admin): `Eshop.Client/app/admin`

### API features

- [Category API](https://github.com/akonaweb/eshop/tree/main/Eshop.WebApi/Features/Categories): `Eshop.WebApi/Features/Categories`
- [Product API](https://github.com/akonaweb/eshop/tree/main/Eshop.WebApi/Features/Products): `Eshop.WebApi/Features/Products`
- [Order API](https://github.com/akonaweb/eshop/tree/main/Eshop.WebApi/Features/Orders): `Eshop.WebApi/Features/Orders`
- [User API](https://github.com/akonaweb/eshop/tree/main/Eshop.WebApi/Features/Users): `Eshop.WebApi/Features/Users`
- [Category routes](https://github.com/akonaweb/eshop/blob/main/Eshop.WebApi/Features/Categories/CategoryController.cs): `Eshop.WebApi/Features/Categories/CategoryController.cs`
- [Product routes](https://github.com/akonaweb/eshop/blob/main/Eshop.WebApi/Features/Products/ProductController.cs): `Eshop.WebApi/Features/Products/ProductController.cs`
- [Order routes](https://github.com/akonaweb/eshop/blob/main/Eshop.WebApi/Features/Orders/OrderController.cs): `Eshop.WebApi/Features/Orders/OrderController.cs`
- [User routes](https://github.com/akonaweb/eshop/blob/main/Eshop.WebApi/Features/Users/UserController.cs): `Eshop.WebApi/Features/Users/UserController.cs`
- [API error mapping](https://github.com/akonaweb/eshop/blob/main/Eshop.WebApi/Filters/GlobalExceptionFilter.cs): `Eshop.WebApi/Filters/GlobalExceptionFilter.cs`

### Commerce domain

- [Catalog entities](https://github.com/akonaweb/eshop/blob/main/Eshop.Domain/Product.cs): `Eshop.Domain/Product.cs`
- [Order entities](https://github.com/akonaweb/eshop/blob/main/Eshop.Domain/Order.cs): `Eshop.Domain/Order.cs`

### Persistence and identity

- [EF data context](https://github.com/akonaweb/eshop/blob/main/Eshop.Persistence/EshopDbContext.cs): `Eshop.Persistence/EshopDbContext.cs`
- [Identity user](https://github.com/akonaweb/eshop/blob/main/Eshop.Persistence/ApplicationUser.cs): `Eshop.Persistence/ApplicationUser.cs`

### Authentication

- [Token manager](https://github.com/akonaweb/eshop/blob/main/Eshop.WebApi/Infrastructure/TokenManager.cs): `Eshop.WebApi/Infrastructure/TokenManager.cs`
- [JWT configuration](https://github.com/akonaweb/eshop/blob/main/Eshop.WebApi/Infrastructure/AuthConfiguration.cs): `Eshop.WebApi/Infrastructure/AuthConfiguration.cs`

### Other components

- **Shopper**
- **Administrator**

## Connections

- Shopper → Storefront: browses
- Shopper → Product browsing: views products
- Product browsing → Quantity and buy: offers buying (evidence: `Eshop.Client/app/products/[categoryId]/page.tsx`)
- Shopper → Cart and checkout: checks out
- Administrator → Admin screens: manages shop
- Storefront → Client API access: requests data
- Product browsing → Client API access: requests data
- Cart and checkout → Client API access: submits cart
- Admin screens → Client API access: requests changes
- Client API access → Category API: calls API
- Client API access → Product API: calls API
- Client API access → Order API: calls API
- Client API access → User API: calls API
- Category routes → Category API: dispatches (evidence: `Eshop.WebApi/Features/Categories/CategoryController.cs`)
- Product routes → Product API: dispatches (evidence: `Eshop.WebApi/Features/Products/ProductController.cs`)
- Order routes → Order API: dispatches (evidence: `Eshop.WebApi/Features/Orders/OrderController.cs`)
- User routes → User API: dispatches (evidence: `Eshop.WebApi/Features/Users/UserController.cs`)
- Product API → EF data context: reads and writes (evidence: `Eshop.WebApi/Features/Products/UpdateProduct.cs`)
- Category API → EF data context: reads and writes
- Order API → EF data context: reads and writes (evidence: `Eshop.WebApi/Features/Orders/UpdateOrder.cs`)
- User API → Identity user: uses identity (evidence: `Eshop.WebApi/Features/Users/UserController.cs`)
- EF data context → Catalog entities: maps entities (evidence: `Eshop.Persistence/EshopDbContext.cs`)
- EF data context → Order entities: maps entities (evidence: `Eshop.Persistence/EshopDbContext.cs`)
- Order entities → Catalog entities: contains product items (evidence: `Eshop.Domain/Order.cs`)
- Token manager → Identity user: updates refresh token (evidence: `Eshop.WebApi/Infrastructure/TokenManager.cs`)
- Token manager → JWT configuration: uses signing settings (evidence: `Eshop.WebApi/Infrastructure/TokenManager.cs`)
- User routes → Token manager: issues tokens
- API error mapping → Category API: maps failures
- API error mapping → Product API: maps failures
- API error mapping → Order API: maps failures
