# saimahmt03/smartshop architecture

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

- Interactive diagram: https://gitdiagram.com/saimahmt03/smartshop
- Repository: https://github.com/saimahmt03/smartshop

## Overview

SmartShop is a Blazor WebAssembly client backed by an ASP.NET Core API. Users browse and manage inventory through client HTTP calls; API startup maps item and user routes, configures authentication, and initializes caching. Registration and login persist users and issue JWTs. The tree also includes order request/result contracts, but no sampled order-processing implementation, so that capability is shown only as a contract. Relationships involving unsampled endpoint and order internals are omitted or marked unverified.

Main entry points: [`SmartShopAPI/SmartShopAPI/Program.cs`](https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Program.cs) (API host), [`SmartShopAPI/SmartShopAPI/Data/SmartShopAPIDbContext.cs`](https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Data/SmartShopAPIDbContext.cs) (Shop database), [`SmartShopClient/SmartShopClient/Program.cs`](https://github.com/saimahmt03/smartshop/blob/master/SmartShopClient/SmartShopClient/Program.cs) (Blazor app), [`SmartShopAPI/SmartShopAPI/Service/UserService/UserService.cs`](https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Service/UserService/UserService.cs) (User service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_clientapp["Blazor app<br/>[Program.cs]"]
  node_itemclient["Inventory client<br/>[ItemService.cs]"]
  node_userclient["User client<br/>[UserService.cs]"]
  node_tokenclient["Token service<br/>[TokenService.cs]"]
end

subgraph group_api["API routing"]
  node_apiapp["API host<br/>[Program.cs]"]
  node_itemroutes["Item routes<br/>[ItemEndpoints.cs]"]
  node_userroutes["User routes<br/>[UserEndpoints.cs]"]
end

subgraph group_domain["Commerce services"]
  node_itemservice["Inventory service<br/>[ItemService.cs]"]
  node_ordercontracts["Order contracts"]
end

subgraph group_identity["Identity and access"]
  node_userservice["User service<br/>[UserService.cs]"]
  node_jwt["JWT manager<br/>[JwtManager.cs]"]
  node_authconfig["JWT configuration"]
  node_userentity["User model<br/>[User.cs]"]
end

subgraph group_state["Persistence and cache"]
  node_db[("Shop database")]
  node_cache["Data cache"]
  node_cacheworker["Cache refresher"]
end

node_shopper(("Shop user"))

node_shopper -->|"uses"| node_clientapp
node_clientapp -->|"registers"| node_itemclient
node_clientapp -->|"registers"| node_userclient
node_clientapp -->|"registers"| node_tokenclient
node_itemclient -->|"HTTP requests"| node_apiapp
node_userclient -.->|"HTTP requests"| node_apiapp
node_apiapp -->|"maps routes"| node_itemroutes
node_apiapp -->|"maps routes"| node_userroutes
node_itemroutes -.->|"dispatches to"| node_itemservice
node_userroutes -.->|"dispatches to"| node_userservice
node_itemservice -->|"reads and writes"| node_db
node_itemservice -->|"updates cache"| node_cache
node_apiapp -->|"loads at startup"| node_cache
node_cache -->|"loads records"| node_db
node_apiapp -->|"registers worker"| node_cacheworker
node_cacheworker -->|"refreshes"| node_cache
node_userservice -->|"reads and writes"| node_db
node_userservice -->|"requests token"| node_jwt
node_jwt -->|"reads user type"| node_db
node_userservice -->|"creates user"| node_userentity
node_apiapp -->|"configures authentication"| node_authconfig
node_ordercontracts -.->|"describes order data"| node_db

click node_clientapp "https://github.com/saimahmt03/smartshop/blob/master/SmartShopClient/SmartShopClient/Program.cs"
click node_itemclient "https://github.com/saimahmt03/smartshop/blob/master/SmartShopClient/SmartShopClient/Service/ItemService.cs"
click node_userclient "https://github.com/saimahmt03/smartshop/blob/master/SmartShopClient/SmartShopClient/Service/UserService.cs"
click node_tokenclient "https://github.com/saimahmt03/smartshop/blob/master/SmartShopClient/SmartShopClient/Service/TokenService.cs"
click node_apiapp "https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Program.cs"
click node_itemroutes "https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Endpoints/ItemEndpoints.cs"
click node_userroutes "https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Endpoints/UserEndpoints.cs"
click node_itemservice "https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Service/ItemService/ItemService.cs"
click node_ordercontracts "https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/DTO/Request/OrderRequest/CreateOrderRequest.cs"
click node_db "https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Data/SmartShopAPIDbContext.cs"
click node_cache "https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Service/CacheService/DataCacheService.cs"
click node_cacheworker "https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Extension/CacheRefreshService.cs"
click node_userservice "https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Service/UserService/UserService.cs"
click node_jwt "https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Utilities/JwtManager.cs"
click node_authconfig "https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Extension/ServiceCollectionExtensions.cs"
click node_userentity "https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Model/User.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_clientapp,node_itemclient,node_userclient,node_tokenclient,node_shopper toneBlue
class node_apiapp,node_itemroutes,node_userroutes toneAmber
class node_itemservice,node_ordercontracts toneMint
class node_userservice,node_jwt,node_authconfig,node_userentity toneRose
class node_db,node_cache,node_cacheworker toneIndigo
```

## Components

### Web client

- [Blazor app](https://github.com/saimahmt03/smartshop/blob/master/SmartShopClient/SmartShopClient/Program.cs): `SmartShopClient/SmartShopClient/Program.cs`
- [Inventory client](https://github.com/saimahmt03/smartshop/blob/master/SmartShopClient/SmartShopClient/Service/ItemService.cs): `SmartShopClient/SmartShopClient/Service/ItemService.cs`
- [User client](https://github.com/saimahmt03/smartshop/blob/master/SmartShopClient/SmartShopClient/Service/UserService.cs): `SmartShopClient/SmartShopClient/Service/UserService.cs`
- [Token service](https://github.com/saimahmt03/smartshop/blob/master/SmartShopClient/SmartShopClient/Service/TokenService.cs): `SmartShopClient/SmartShopClient/Service/TokenService.cs`

### API routing

- [API host](https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Program.cs): `SmartShopAPI/SmartShopAPI/Program.cs`
- [Item routes](https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Endpoints/ItemEndpoints.cs): `SmartShopAPI/SmartShopAPI/Endpoints/ItemEndpoints.cs`
- [User routes](https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Endpoints/UserEndpoints.cs): `SmartShopAPI/SmartShopAPI/Endpoints/UserEndpoints.cs`

### Commerce services

- [Inventory service](https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Service/ItemService/ItemService.cs): `SmartShopAPI/SmartShopAPI/Service/ItemService/ItemService.cs`
- [Order contracts](https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/DTO/Request/OrderRequest/CreateOrderRequest.cs): `SmartShopAPI/SmartShopAPI/DTO/Request/OrderRequest/CreateOrderRequest.cs`

### Identity and access

- [User service](https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Service/UserService/UserService.cs): `SmartShopAPI/SmartShopAPI/Service/UserService/UserService.cs`
- [JWT manager](https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Utilities/JwtManager.cs): `SmartShopAPI/SmartShopAPI/Utilities/JwtManager.cs`
- [JWT configuration](https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Extension/ServiceCollectionExtensions.cs): `SmartShopAPI/SmartShopAPI/Extension/ServiceCollectionExtensions.cs`
- [User model](https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Model/User.cs): `SmartShopAPI/SmartShopAPI/Model/User.cs`

### Persistence and cache

- [Shop database](https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Data/SmartShopAPIDbContext.cs): `SmartShopAPI/SmartShopAPI/Data/SmartShopAPIDbContext.cs`
- [Data cache](https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Service/CacheService/DataCacheService.cs): `SmartShopAPI/SmartShopAPI/Service/CacheService/DataCacheService.cs`
- [Cache refresher](https://github.com/saimahmt03/smartshop/blob/master/SmartShopAPI/SmartShopAPI/Extension/CacheRefreshService.cs): `SmartShopAPI/SmartShopAPI/Extension/CacheRefreshService.cs`

### Other components

- **Shop user**

## Connections

- Shop user → Blazor app: uses (evidence: `SmartShopClient/SmartShopClient/Program.cs`)
- Blazor app → Inventory client: registers (evidence: `SmartShopClient/SmartShopClient/Program.cs`)
- Blazor app → User client: registers (evidence: `SmartShopClient/SmartShopClient/Program.cs`)
- Blazor app → Token service: registers (evidence: `SmartShopClient/SmartShopClient/Program.cs`)
- Inventory client → API host: HTTP requests (evidence: `SmartShopClient/SmartShopClient/Service/ItemService.cs`)
- User client → API host: HTTP requests
- API host → Item routes: maps routes (evidence: `SmartShopAPI/SmartShopAPI/Program.cs`)
- API host → User routes: maps routes (evidence: `SmartShopAPI/SmartShopAPI/Program.cs`)
- Item routes → Inventory service: dispatches to
- User routes → User service: dispatches to
- Inventory service → Shop database: reads and writes (evidence: `SmartShopAPI/SmartShopAPI/Service/ItemService/ItemService.cs`)
- Inventory service → Data cache: updates cache (evidence: `SmartShopAPI/SmartShopAPI/Service/ItemService/ItemService.cs`)
- API host → Data cache: loads at startup (evidence: `SmartShopAPI/SmartShopAPI/Program.cs`)
- Data cache → Shop database: loads records (evidence: `SmartShopAPI/SmartShopAPI/Service/CacheService/DataCacheService.cs`)
- API host → Cache refresher: registers worker (evidence: `SmartShopAPI/SmartShopAPI/Program.cs`)
- Cache refresher → Data cache: refreshes (evidence: `SmartShopAPI/SmartShopAPI/Extension/CacheRefreshService.cs`)
- User service → Shop database: reads and writes (evidence: `SmartShopAPI/SmartShopAPI/Service/UserService/UserService.cs`)
- User service → JWT manager: requests token (evidence: `SmartShopAPI/SmartShopAPI/Service/UserService/UserService.cs`)
- JWT manager → Shop database: reads user type (evidence: `SmartShopAPI/SmartShopAPI/Utilities/JwtManager.cs`)
- User service → User model: creates user (evidence: `SmartShopAPI/SmartShopAPI/Service/UserService/UserService.cs`)
- API host → JWT configuration: configures authentication (evidence: `SmartShopAPI/SmartShopAPI/Program.cs`)
- Order contracts → Shop database: describes order data
