# beshoy-05/e-commerceapi architecture

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

- Interactive diagram: https://gitdiagram.com/beshoy-05/e-commerceapi
- Repository: https://github.com/beshoy-05/e-commerceapi

## Overview

This is an e-commerce API organized around product discovery, basket management, order creation and lookup, and account registration/login. Requests enter through presentation controllers, which use a service manager to reach domain services; those services use repository abstractions and map domain data to shared DTOs. Persistence includes product/order data contexts and identity storage, while baskets and caching are separate repository concerns. The README names no capabilities; the feature map follows the controllers, service implementations, and source index. Several persistence and optional integration links are omitted where the supplied excerpts do not show their runtime wiring.

Main entry points: [`Core/Services/Services/ServiceManager.cs`](https://github.com/beshoy-05/e-commerceapi/blob/main/Core/Services/Services/ServiceManager.cs) (Service manager), [`Core/Services/Services/ProductService.cs`](https://github.com/beshoy-05/e-commerceapi/blob/main/Core/Services/Services/ProductService.cs) (Product service), [`Core/Services/Services/OrderService.cs`](https://github.com/beshoy-05/e-commerceapi/blob/main/Core/Services/Services/OrderService.cs) (Order service), [`Shared/DTOs`](https://github.com/beshoy-05/e-commerceapi/tree/main/Shared/DTOs) (Shared DTOs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API surface"]
  node_product_api["Product API"]
  node_basket_api["Basket API"]
  node_order_api["Order API<br/>[OrderController.cs]"]
  node_auth_api["Authentication API"]
end

subgraph group_domain["Commerce services"]
  node_manager["Service manager<br/>[ServiceManager.cs]"]
  node_products["Product service<br/>[ProductService.cs]"]
  node_baskets["Basket service<br/>[BasketService.cs]"]
  node_orders["Order service<br/>[OrderService.cs]"]
  node_authentication["Authentication service<br/>[Authentication.cs]"]
  node_product_specs["Product specifications"]
end

subgraph group_data["Persistence"]
  node_basket_repo["Basket repository<br/>[BasketRepo.cs]"]
  node_unit_of_work["Unit of work<br/>[UnitOfWork.cs]"]
  node_store_db[("Commerce database<br/>[StoreDbContext.cs]")]
  node_identity_db[("Identity database")]
  node_cache_repo["Cache repository<br/>[CacheRepo.cs]"]
end

subgraph group_shared["Contracts and models"]
  node_product_models["Product models"]
  node_basket_models["Basket models"]
  node_order_models["Order models"]
  node_identity_models["Identity models"]
  node_shared_dtos["Shared DTOs"]
end

subgraph group_runtime["Web runtime"]
  node_web_runtime["Web application<br/>[Program.cs]"]
  node_exception_handler["Exception handler"]
end

node_customer(("Customer"))

node_customer -->|"browses"| node_product_api
node_customer -->|"manages basket"| node_basket_api
node_customer -->|"places orders"| node_order_api
node_customer -->|"authenticates"| node_auth_api
node_product_api -->|"resolves services"| node_manager
node_basket_api -->|"resolves services"| node_manager
node_order_api -->|"resolves services"| node_manager
node_auth_api -->|"resolves services"| node_manager
node_manager -->|"provides"| node_products
node_manager -->|"provides"| node_baskets
node_manager -->|"provides"| node_orders
node_manager -->|"provides"| node_authentication
node_products -->|"builds queries"| node_product_specs
node_orders -->|"loads basket"| node_basket_repo
node_orders -->|"reads and saves"| node_unit_of_work
node_products -->|"queries repositories"| node_unit_of_work
node_products -->|"maps results"| node_shared_dtos
node_baskets -->|"reads and writes"| node_basket_repo
node_baskets -->|"maps baskets"| node_shared_dtos
node_orders -->|"maps orders"| node_shared_dtos
node_authentication -->|"creates users"| node_identity_models
node_authentication -->|"accepts and returns"| node_shared_dtos
node_store_db -->|"stores products"| node_product_models
node_identity_db -->|"stores identities"| node_identity_models
node_web_runtime -->|"configures middleware"| node_exception_handler

click node_product_api "https://github.com/beshoy-05/e-commerceapi/blob/main/Infrastructure/Presentation/Controllers/ProductController.cs"
click node_basket_api "https://github.com/beshoy-05/e-commerceapi/blob/main/Infrastructure/Presentation/Controllers/BasketController.cs"
click node_order_api "https://github.com/beshoy-05/e-commerceapi/blob/main/Infrastructure/Presentation/Controllers/OrderController.cs"
click node_auth_api "https://github.com/beshoy-05/e-commerceapi/blob/main/Infrastructure/Presentation/Controllers/AuthenticationController.cs"
click node_manager "https://github.com/beshoy-05/e-commerceapi/blob/main/Core/Services/Services/ServiceManager.cs"
click node_products "https://github.com/beshoy-05/e-commerceapi/blob/main/Core/Services/Services/ProductService.cs"
click node_baskets "https://github.com/beshoy-05/e-commerceapi/blob/main/Core/Services/Services/BasketService.cs"
click node_orders "https://github.com/beshoy-05/e-commerceapi/blob/main/Core/Services/Services/OrderService.cs"
click node_authentication "https://github.com/beshoy-05/e-commerceapi/blob/main/Core/Services/Services/Authentication.cs"
click node_product_specs "https://github.com/beshoy-05/e-commerceapi/tree/main/Core/Services/Specifications"
click node_basket_repo "https://github.com/beshoy-05/e-commerceapi/blob/main/Infrastructure/persistence/Implementation/BasketRepo.cs"
click node_unit_of_work "https://github.com/beshoy-05/e-commerceapi/blob/main/Infrastructure/persistence/Implementation/UnitOfWork.cs"
click node_store_db "https://github.com/beshoy-05/e-commerceapi/blob/main/Infrastructure/persistence/Data/StoreDbContext.cs"
click node_identity_db "https://github.com/beshoy-05/e-commerceapi/blob/main/Infrastructure/persistence/Identity/StoreIdentityDbContext.cs"
click node_cache_repo "https://github.com/beshoy-05/e-commerceapi/blob/main/Infrastructure/persistence/Implementation/CacheRepo.cs"
click node_product_models "https://github.com/beshoy-05/e-commerceapi/tree/main/Core/DomainLayer/Models/ProductModules"
click node_basket_models "https://github.com/beshoy-05/e-commerceapi/tree/main/Core/DomainLayer/Models/BasketModules"
click node_order_models "https://github.com/beshoy-05/e-commerceapi/tree/main/Core/DomainLayer/Models/OrderModules"
click node_identity_models "https://github.com/beshoy-05/e-commerceapi/tree/main/Core/DomainLayer/Models/IdentityModules"
click node_shared_dtos "https://github.com/beshoy-05/e-commerceapi/tree/main/Shared/DTOs"
click node_web_runtime "https://github.com/beshoy-05/e-commerceapi/blob/main/e-commerce.web/Program.cs"
click node_exception_handler "https://github.com/beshoy-05/e-commerceapi/blob/main/e-commerce.web/Middlewares/CustomeExeptionHandler.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_product_api,node_basket_api,node_order_api,node_auth_api toneBlue
class node_manager,node_products,node_baskets,node_orders,node_authentication,node_product_specs toneAmber
class node_basket_repo,node_unit_of_work,node_store_db,node_identity_db,node_cache_repo toneMint
class node_product_models,node_basket_models,node_order_models,node_identity_models,node_shared_dtos toneRose
class node_web_runtime,node_exception_handler,node_customer toneIndigo
```

## Components

### API surface

- [Product API](https://github.com/beshoy-05/e-commerceapi/blob/main/Infrastructure/Presentation/Controllers/ProductController.cs): `Infrastructure/Presentation/Controllers/ProductController.cs`
- [Basket API](https://github.com/beshoy-05/e-commerceapi/blob/main/Infrastructure/Presentation/Controllers/BasketController.cs): `Infrastructure/Presentation/Controllers/BasketController.cs`
- [Order API](https://github.com/beshoy-05/e-commerceapi/blob/main/Infrastructure/Presentation/Controllers/OrderController.cs): `Infrastructure/Presentation/Controllers/OrderController.cs`
- [Authentication API](https://github.com/beshoy-05/e-commerceapi/blob/main/Infrastructure/Presentation/Controllers/AuthenticationController.cs): `Infrastructure/Presentation/Controllers/AuthenticationController.cs`

### Commerce services

- [Service manager](https://github.com/beshoy-05/e-commerceapi/blob/main/Core/Services/Services/ServiceManager.cs): `Core/Services/Services/ServiceManager.cs`
- [Product service](https://github.com/beshoy-05/e-commerceapi/blob/main/Core/Services/Services/ProductService.cs): `Core/Services/Services/ProductService.cs`
- [Basket service](https://github.com/beshoy-05/e-commerceapi/blob/main/Core/Services/Services/BasketService.cs): `Core/Services/Services/BasketService.cs`
- [Order service](https://github.com/beshoy-05/e-commerceapi/blob/main/Core/Services/Services/OrderService.cs): `Core/Services/Services/OrderService.cs`
- [Authentication service](https://github.com/beshoy-05/e-commerceapi/blob/main/Core/Services/Services/Authentication.cs): `Core/Services/Services/Authentication.cs`
- [Product specifications](https://github.com/beshoy-05/e-commerceapi/tree/main/Core/Services/Specifications): `Core/Services/Specifications`

### Persistence

- [Basket repository](https://github.com/beshoy-05/e-commerceapi/blob/main/Infrastructure/persistence/Implementation/BasketRepo.cs): `Infrastructure/persistence/Implementation/BasketRepo.cs`
- [Unit of work](https://github.com/beshoy-05/e-commerceapi/blob/main/Infrastructure/persistence/Implementation/UnitOfWork.cs): `Infrastructure/persistence/Implementation/UnitOfWork.cs`
- [Commerce database](https://github.com/beshoy-05/e-commerceapi/blob/main/Infrastructure/persistence/Data/StoreDbContext.cs): `Infrastructure/persistence/Data/StoreDbContext.cs`
- [Identity database](https://github.com/beshoy-05/e-commerceapi/blob/main/Infrastructure/persistence/Identity/StoreIdentityDbContext.cs): `Infrastructure/persistence/Identity/StoreIdentityDbContext.cs`
- [Cache repository](https://github.com/beshoy-05/e-commerceapi/blob/main/Infrastructure/persistence/Implementation/CacheRepo.cs): `Infrastructure/persistence/Implementation/CacheRepo.cs`

### Contracts and models

- [Product models](https://github.com/beshoy-05/e-commerceapi/tree/main/Core/DomainLayer/Models/ProductModules): `Core/DomainLayer/Models/ProductModules`
- [Basket models](https://github.com/beshoy-05/e-commerceapi/tree/main/Core/DomainLayer/Models/BasketModules): `Core/DomainLayer/Models/BasketModules`
- [Order models](https://github.com/beshoy-05/e-commerceapi/tree/main/Core/DomainLayer/Models/OrderModules): `Core/DomainLayer/Models/OrderModules`
- [Identity models](https://github.com/beshoy-05/e-commerceapi/tree/main/Core/DomainLayer/Models/IdentityModules): `Core/DomainLayer/Models/IdentityModules`
- [Shared DTOs](https://github.com/beshoy-05/e-commerceapi/tree/main/Shared/DTOs): `Shared/DTOs`

### Web runtime

- [Web application](https://github.com/beshoy-05/e-commerceapi/blob/main/e-commerce.web/Program.cs): `e-commerce.web/Program.cs`
- [Exception handler](https://github.com/beshoy-05/e-commerceapi/blob/main/e-commerce.web/Middlewares/CustomeExeptionHandler.cs): `e-commerce.web/Middlewares/CustomeExeptionHandler.cs`

### Other components

- **Customer**

## Connections

- Customer → Product API: browses (evidence: `Infrastructure/Presentation/Controllers/ProductController.cs`)
- Customer → Basket API: manages basket (evidence: `Infrastructure/Presentation/Controllers/BasketController.cs`)
- Customer → Order API: places orders (evidence: `Infrastructure/Presentation/Controllers/OrderController.cs`)
- Customer → Authentication API: authenticates (evidence: `Infrastructure/Presentation/Controllers/AuthenticationController.cs`)
- Product API → Service manager: resolves services (evidence: `Infrastructure/Presentation/Controllers/ProductController.cs`)
- Basket API → Service manager: resolves services (evidence: `Infrastructure/Presentation/Controllers/BasketController.cs`)
- Order API → Service manager: resolves services (evidence: `Infrastructure/Presentation/Controllers/OrderController.cs`)
- Authentication API → Service manager: resolves services (evidence: `Infrastructure/Presentation/Controllers/AuthenticationController.cs`)
- Service manager → Product service: provides (evidence: `Core/Services/Services/ServiceManager.cs`)
- Service manager → Basket service: provides (evidence: `Core/Services/Services/ServiceManager.cs`)
- Service manager → Order service: provides (evidence: `Core/Services/Services/ServiceManager.cs`)
- Service manager → Authentication service: provides (evidence: `Core/Services/Services/ServiceManager.cs`)
- Product service → Product specifications: builds queries (evidence: `Core/Services/Services/ProductService.cs`)
- Order service → Basket repository: loads basket (evidence: `Core/Services/Services/OrderService.cs`)
- Order service → Unit of work: reads and saves (evidence: `Core/Services/Services/OrderService.cs`)
- Product service → Unit of work: queries repositories (evidence: `Core/Services/Services/ProductService.cs`)
- Product service → Shared DTOs: maps results (evidence: `Core/Services/Services/ProductService.cs`)
- Basket service → Basket repository: reads and writes (evidence: `Core/Services/Services/BasketService.cs`)
- Basket service → Shared DTOs: maps baskets (evidence: `Core/Services/Services/BasketService.cs`)
- Order service → Shared DTOs: maps orders (evidence: `Core/Services/Services/OrderService.cs`)
- Authentication service → Identity models: creates users (evidence: `Core/Services/Services/Authentication.cs`)
- Authentication service → Shared DTOs: accepts and returns (evidence: `Core/Services/Services/Authentication.cs`)
- Commerce database → Product models: stores products (evidence: `Infrastructure/persistence/Data/StoreDbContext.cs`)
- Identity database → Identity models: stores identities (evidence: `Infrastructure/persistence/Identity/StoreIdentityDbContext.cs`)
- Web application → Exception handler: configures middleware (evidence: `e-commerce.web/Program.cs`)
