# nguyenlinhit-cpu/kernelstore architecture

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

- Interactive diagram: https://gitdiagram.com/nguyenlinhit-cpu/kernelstore
- Repository: https://github.com/nguyenlinhit-cpu/kernelstore

## Overview

KernelStore is a multi-vendor e-commerce marketplace: customers discover products, authenticate, add items to a cart, check out, track orders, review delivered items, and manage warranty claims; sellers manage shops, products, and orders, while admins oversee marketplace operations. The Leptos frontend calls an ASP.NET API backed by PostgreSQL, with chat also supporting realtime WebSockets. The README documents major capabilities not fully sampled; their subsystem paths are taken from the repository tree, while uncertain internal call links are omitted.

Main entry points: [`frontend/src/api.rs`](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/api.rs) (API client), [`frontend/src/lib.rs`](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/lib.rs) (Leptos app), [`backend/KernelStore.Api/Data/ApplicationDbContext.cs`](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Data/ApplicationDbContext.cs) (EF data context), [`backend/KernelStore.Api/Controllers/AuthController.cs`](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/AuthController.cs) (Authentication API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Marketplace frontend"]
  node_app["Leptos app<br/>[lib.rs]"]
  node_auth_ui["Session state<br/>[auth.rs]"]
  node_catalog_ui["Catalog pages<br/>[products.rs]"]
  node_product_ui["Product detail<br/>[product_detail.rs]"]
  node_checkout_ui["Cart and checkout<br/>[checkout.rs]"]
  node_orders_ui["Order pages<br/>[orders.rs]"]
  node_seller_ui["Seller pages<br/>[seller.rs]"]
  node_admin_ui["Admin page<br/>[admin.rs]"]
  node_chat_ui["Chat page<br/>[chat.rs]"]
  node_warranty_ui["Warranty page<br/>[warranty.rs]"]
  node_api_client["API client<br/>[api.rs]"]
end

subgraph group_identity["Identity and access"]
  node_auth_api["Authentication API<br/>[AuthController.cs]"]
  node_token_service["Token service<br/>[TokenService.cs]"]
end

subgraph group_commerce["Marketplace commerce"]
  node_shop_api["Shop management<br/>[ShopsController.cs]"]
  node_catalog_api["Products and categories"]
  node_cart_api["Cart API<br/>[CartController.cs]"]
  node_orders_api["Orders API"]
  node_reviews_api["Reviews API"]
  node_warranty_api["Warranty claims"]
end

subgraph group_operations["Marketplace operations"]
  node_chat_api["Chat API<br/>[ChatController.cs]"]
  node_chat_ws["Chat WebSocket<br/>[ChatEndpoints.cs]"]
  node_connections["Connection manager"]
  node_admin_api["Admin operations"]
  node_uploads_api["Image uploads"]
end

subgraph group_persistence["Persistence and runtime"]
  node_api_host["API host<br/>[Program.cs]"]
  node_db_context["EF data context"]
  node_postgres[("PostgreSQL")]
end

node_customer(("Customer"))
node_seller(("Seller"))
node_admin(("Admin"))

node_customer -->|"uses"| node_app
node_seller -->|"uses"| node_app
node_admin -->|"uses"| node_app
node_app -->|"provides session"| node_auth_ui
node_app -->|"routes to"| node_catalog_ui
node_app -->|"routes to"| node_product_ui
node_app -->|"routes to"| node_checkout_ui
node_app -->|"routes to"| node_orders_ui
node_app -->|"routes to"| node_seller_ui
node_app -->|"routes to"| node_admin_ui
node_app -->|"routes to"| node_chat_ui
node_app -->|"routes to"| node_warranty_ui
node_auth_ui -->|"uses"| node_api_client
node_catalog_ui -->|"requests data"| node_api_client
node_product_ui -->|"requests data"| node_api_client
node_checkout_ui -->|"submits actions"| node_api_client
node_orders_ui -->|"requests data"| node_api_client
node_seller_ui -->|"submits actions"| node_api_client
node_admin_ui -->|"submits actions"| node_api_client
node_chat_ui -->|"uses"| node_api_client
node_warranty_ui -->|"submits actions"| node_api_client
node_api_client -->|"HTTP requests"| node_auth_api
node_api_client -->|"HTTP requests"| node_shop_api
node_api_client -->|"HTTP requests"| node_catalog_api
node_api_client -->|"HTTP requests"| node_cart_api
node_api_client -->|"HTTP requests"| node_orders_api
node_api_client -->|"HTTP requests"| node_reviews_api
node_api_client -->|"HTTP requests"| node_warranty_api
node_api_client -->|"HTTP requests"| node_chat_api
node_api_client -->|"HTTP requests"| node_admin_api
node_api_client -->|"HTTP requests"| node_uploads_api
node_auth_api -->|"creates tokens"| node_token_service
node_api_host -->|"maps controllers"| node_auth_api
node_api_host -->|"maps endpoint"| node_chat_ws
node_chat_api -->|"dispatches messages"| node_connections
node_chat_ws -->|"tracks sockets"| node_connections
node_auth_api -->|"reads and writes"| node_db_context
node_shop_api -->|"reads and writes"| node_db_context
node_catalog_api -->|"reads and writes"| node_db_context
node_cart_api -->|"reads and writes"| node_db_context
node_orders_api -->|"reads and writes"| node_db_context
node_reviews_api -->|"reads and writes"| node_db_context
node_warranty_api -->|"reads and writes"| node_db_context
node_chat_api -->|"reads and writes"| node_db_context
node_admin_api -->|"reads and writes"| node_db_context
node_uploads_api -->|"product image data"| node_db_context
node_api_host -->|"configures EF"| node_db_context
node_db_context -->|"persists data"| node_postgres

click node_app "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/lib.rs"
click node_auth_ui "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/auth.rs"
click node_catalog_ui "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/pages/products.rs"
click node_product_ui "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/pages/product_detail.rs"
click node_checkout_ui "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/pages/checkout.rs"
click node_orders_ui "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/pages/orders.rs"
click node_seller_ui "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/pages/seller.rs"
click node_admin_ui "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/pages/admin.rs"
click node_chat_ui "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/pages/chat.rs"
click node_warranty_ui "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/pages/warranty.rs"
click node_api_client "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/api.rs"
click node_auth_api "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/AuthController.cs"
click node_token_service "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Services/TokenService.cs"
click node_shop_api "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/ShopsController.cs"
click node_catalog_api "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/ProductsController.cs"
click node_cart_api "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/CartController.cs"
click node_orders_api "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/OrdersController.cs"
click node_reviews_api "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/ReviewsController.cs"
click node_warranty_api "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/WarrantyController.cs"
click node_chat_api "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/ChatController.cs"
click node_chat_ws "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Common/ChatEndpoints.cs"
click node_connections "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Services/ChatConnectionManager.cs"
click node_admin_api "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/AdminDashboardController.cs"
click node_uploads_api "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/UploadsController.cs"
click node_api_host "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Program.cs"
click node_db_context "https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Data/ApplicationDbContext.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_app,node_auth_ui,node_catalog_ui,node_product_ui,node_checkout_ui,node_orders_ui,node_seller_ui,node_admin_ui,node_chat_ui,node_warranty_ui,node_api_client toneBlue
class node_auth_api,node_token_service toneAmber
class node_shop_api,node_catalog_api,node_cart_api,node_orders_api,node_reviews_api,node_warranty_api toneMint
class node_chat_api,node_chat_ws,node_connections,node_admin_api,node_uploads_api toneRose
class node_api_host,node_db_context,node_postgres,node_customer,node_seller,node_admin toneIndigo
```

## Components

### Marketplace frontend

- [Leptos app](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/lib.rs): `frontend/src/lib.rs`
- [Session state](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/auth.rs): `frontend/src/auth.rs`
- [Catalog pages](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/pages/products.rs): `frontend/src/pages/products.rs`
- [Product detail](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/pages/product_detail.rs): `frontend/src/pages/product_detail.rs`
- [Cart and checkout](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/pages/checkout.rs): `frontend/src/pages/checkout.rs`
- [Order pages](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/pages/orders.rs): `frontend/src/pages/orders.rs`
- [Seller pages](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/pages/seller.rs): `frontend/src/pages/seller.rs`
- [Admin page](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/pages/admin.rs): `frontend/src/pages/admin.rs`
- [Chat page](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/pages/chat.rs): `frontend/src/pages/chat.rs`
- [Warranty page](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/pages/warranty.rs): `frontend/src/pages/warranty.rs`
- [API client](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/frontend/src/api.rs): `frontend/src/api.rs`

### Identity and access

- [Authentication API](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/AuthController.cs): `backend/KernelStore.Api/Controllers/AuthController.cs`
- [Token service](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Services/TokenService.cs): `backend/KernelStore.Api/Services/TokenService.cs`

### Marketplace commerce

- [Shop management](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/ShopsController.cs): `backend/KernelStore.Api/Controllers/ShopsController.cs`
- [Products and categories](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/ProductsController.cs): `backend/KernelStore.Api/Controllers/ProductsController.cs`
- [Cart API](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/CartController.cs): `backend/KernelStore.Api/Controllers/CartController.cs`
- [Orders API](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/OrdersController.cs): `backend/KernelStore.Api/Controllers/OrdersController.cs`
- [Reviews API](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/ReviewsController.cs): `backend/KernelStore.Api/Controllers/ReviewsController.cs`
- [Warranty claims](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/WarrantyController.cs): `backend/KernelStore.Api/Controllers/WarrantyController.cs`

### Marketplace operations

- [Chat API](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/ChatController.cs): `backend/KernelStore.Api/Controllers/ChatController.cs`
- [Chat WebSocket](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Common/ChatEndpoints.cs): `backend/KernelStore.Api/Common/ChatEndpoints.cs`
- [Connection manager](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Services/ChatConnectionManager.cs): `backend/KernelStore.Api/Services/ChatConnectionManager.cs`
- [Admin operations](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/AdminDashboardController.cs): `backend/KernelStore.Api/Controllers/AdminDashboardController.cs`
- [Image uploads](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Controllers/UploadsController.cs): `backend/KernelStore.Api/Controllers/UploadsController.cs`

### Persistence and runtime

- [API host](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Program.cs): `backend/KernelStore.Api/Program.cs`
- [EF data context](https://github.com/nguyenlinhit-cpu/kernelstore/blob/main/backend/KernelStore.Api/Data/ApplicationDbContext.cs): `backend/KernelStore.Api/Data/ApplicationDbContext.cs`
- **PostgreSQL**

### Other components

- **Customer**
- **Seller**
- **Admin**

## Connections

- Customer → Leptos app: uses
- Seller → Leptos app: uses
- Admin → Leptos app: uses
- Leptos app → Session state: provides session
- Leptos app → Catalog pages: routes to
- Leptos app → Product detail: routes to
- Leptos app → Cart and checkout: routes to
- Leptos app → Order pages: routes to
- Leptos app → Seller pages: routes to
- Leptos app → Admin page: routes to
- Leptos app → Chat page: routes to
- Leptos app → Warranty page: routes to
- Session state → API client: uses
- Catalog pages → API client: requests data
- Product detail → API client: requests data
- Cart and checkout → API client: submits actions
- Order pages → API client: requests data
- Seller pages → API client: submits actions
- Admin page → API client: submits actions
- Chat page → API client: uses
- Warranty page → API client: submits actions
- API client → Authentication API: HTTP requests
- API client → Shop management: HTTP requests
- API client → Products and categories: HTTP requests
- API client → Cart API: HTTP requests
- API client → Orders API: HTTP requests
- API client → Reviews API: HTTP requests
- API client → Warranty claims: HTTP requests
- API client → Chat API: HTTP requests
- API client → Admin operations: HTTP requests
- API client → Image uploads: HTTP requests
- Authentication API → Token service: creates tokens
- API host → Authentication API: maps controllers
- API host → Chat WebSocket: maps endpoint
- Chat API → Connection manager: dispatches messages
- Chat WebSocket → Connection manager: tracks sockets
- Authentication API → EF data context: reads and writes
- Shop management → EF data context: reads and writes
- Products and categories → EF data context: reads and writes
- Cart API → EF data context: reads and writes
- Orders API → EF data context: reads and writes
- Reviews API → EF data context: reads and writes
- Warranty claims → EF data context: reads and writes
- Chat API → EF data context: reads and writes
- Admin operations → EF data context: reads and writes
- Image uploads → EF data context: product image data
- API host → EF data context: configures EF
- EF data context → PostgreSQL: persists data
