# mhmdkhalid4444-eng/ecommerceproject-api architecture

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

- Interactive diagram: https://gitdiagram.com/mhmdkhalid4444-eng/ecommerceproject-api
- Repository: https://github.com/mhmdkhalid4444-eng/ecommerceproject-api

## Overview

This is a Clean Architecture ecommerce API. Its main customer workflow exposes catalog and basket operations, creates orders from baskets, and supports payment; authentication and delivery methods are separate capabilities. The graph preserves documented features even where controller or service implementations were not sampled. Edges are limited to relationships visible in excerpts, the source index, or README; dashed links indicate documented integrations whose implementation relationship was not verified in the excerpts.

Main entry points: [`Ecommerce.API/Program.cs`](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.API/Program.cs) (Ecommerce API), [`Ecommerce.Application/Services/PaymentService.cs`](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Application/Services/PaymentService.cs) (Payment intents), [`Ecommerce.API/Controllers/OrderController.cs`](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.API/Controllers/OrderController.cs) (Order endpoints), [`Ecommerce.Application/Services/AuthenticationService.cs`](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Application/Services/AuthenticationService.cs) (Authentication workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_api["Ecommerce API<br/>[Program.cs]"]
  node_auth_api["Authentication endpoints"]
  node_catalog_api["Catalog endpoints"]
  node_basket_api["Basket endpoints"]
  node_order_api["Order endpoints<br/>[OrderController.cs]"]
  node_payment_api["Payment endpoints"]
end

subgraph group_app["Application workflows"]
  node_auth["Authentication workflow"]
  node_catalog["Product catalog<br/>[ProductService.cs]"]
  node_basket["Shopping basket<br/>[BasketService.cs]"]
  node_orders["Order management<br/>[OrderService.cs]"]
  node_payments["Payment intents<br/>[PaymentService.cs]"]
  node_delivery["Delivery methods<br/>[OrderService.cs]"]
end

subgraph group_identity["Identity and access"]
  node_identity_service["Identity operations<br/>[IdentityService.cs]"]
  node_tokens["JWT tokens<br/>[TokenService.cs]"]
end

subgraph group_infra["Persistence and integrations"]
  node_identity_db[("Identity database")]
  node_unit_of_work["Unit of work<br/>[UnitOfWork.cs]"]
  node_store_db[("Store database<br/>[StoreDbContext.cs]")]
  node_basket_repo["Basket repository"]
  node_cache_repo["Cache repository<br/>[CacheRepository.cs]"]
  node_redis[("Redis")]
  node_stripe["Stripe gateway"]
end

node_shopper(("Shopper"))

node_shopper -->|"calls"| node_api
node_api -.->|"routes"| node_auth_api
node_api -.->|"routes"| node_catalog_api
node_api -.->|"routes"| node_basket_api
node_api -.->|"routes"| node_order_api
node_api -.->|"routes"| node_payment_api
node_auth_api -->|"invokes"| node_auth
node_order_api -->|"invokes"| node_orders
node_payment_api -->|"invokes"| node_payments
node_auth -->|"delegates"| node_identity_service
node_auth -->|"creates tokens"| node_tokens
node_orders -->|"reads basket"| node_basket_repo
node_orders -->|"loads and saves"| node_unit_of_work
node_payments -->|"reads basket"| node_basket_repo
node_payments -->|"loads and saves"| node_unit_of_work
node_payments -.->|"requests payment"| node_stripe
node_basket -.->|"stores basket"| node_redis
node_identity_service -.->|"uses identity store"| node_identity_db
node_unit_of_work -.->|"accesses store data"| node_store_db
node_catalog_api -.->|"serves catalog"| node_catalog
node_basket_api -.->|"serves basket"| node_basket
node_order_api -.->|"serves delivery methods"| node_delivery

click node_api "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.API/Program.cs"
click node_auth_api "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.API/Controllers/AuthenticationController.cs"
click node_catalog_api "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.API/Controllers/ProductsController.cs"
click node_basket_api "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.API/Controllers/BasketController.cs"
click node_order_api "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.API/Controllers/OrderController.cs"
click node_payment_api "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.API/Controllers/PaymentController.cs"
click node_auth "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Application/Services/AuthenticationService.cs"
click node_catalog "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Application/Services/ProductService.cs"
click node_basket "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Application/Services/BasketService.cs"
click node_orders "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Application/Services/OrderService.cs"
click node_payments "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Application/Services/PaymentService.cs"
click node_delivery "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Application/Services/OrderService.cs"
click node_identity_service "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Infrastructure/Identity/Service/IdentityService.cs"
click node_tokens "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Infrastructure/Identity/Service/TokenService.cs"
click node_identity_db "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Infrastructure/Identity/Data/StoreIdentitydbcontext.cs"
click node_unit_of_work "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Infrastructure/Repositories/UnitOfWork.cs"
click node_store_db "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Infrastructure/Data/StoreDbContext.cs"
click node_basket_repo "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Infrastructure/Repositories/BasketRepository.cs"
click node_cache_repo "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Infrastructure/Repositories/CacheRepository.cs"
click node_stripe "https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Infrastructure/Payments/StripePaymentGeteway.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_api,node_auth_api,node_catalog_api,node_basket_api,node_order_api,node_payment_api toneBlue
class node_auth,node_catalog,node_basket,node_orders,node_payments,node_delivery toneAmber
class node_identity_service,node_tokens toneMint
class node_identity_db,node_unit_of_work,node_store_db,node_basket_repo,node_cache_repo,node_redis,node_stripe toneRose
class node_shopper toneIndigo
```

## Components

### HTTP API

- [Ecommerce API](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.API/Program.cs): `Ecommerce.API/Program.cs`
- [Authentication endpoints](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.API/Controllers/AuthenticationController.cs): `Ecommerce.API/Controllers/AuthenticationController.cs`
- [Catalog endpoints](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.API/Controllers/ProductsController.cs): `Ecommerce.API/Controllers/ProductsController.cs`
- [Basket endpoints](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.API/Controllers/BasketController.cs): `Ecommerce.API/Controllers/BasketController.cs`
- [Order endpoints](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.API/Controllers/OrderController.cs): `Ecommerce.API/Controllers/OrderController.cs`
- [Payment endpoints](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.API/Controllers/PaymentController.cs): `Ecommerce.API/Controllers/PaymentController.cs`

### Application workflows

- [Authentication workflow](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Application/Services/AuthenticationService.cs): `Ecommerce.Application/Services/AuthenticationService.cs`
- [Product catalog](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Application/Services/ProductService.cs): `Ecommerce.Application/Services/ProductService.cs`
- [Shopping basket](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Application/Services/BasketService.cs): `Ecommerce.Application/Services/BasketService.cs`
- [Order management](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Application/Services/OrderService.cs): `Ecommerce.Application/Services/OrderService.cs`
- [Payment intents](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Application/Services/PaymentService.cs): `Ecommerce.Application/Services/PaymentService.cs`
- [Delivery methods](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Application/Services/OrderService.cs): `Ecommerce.Application/Services/OrderService.cs`

### Identity and access

- [Identity operations](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Infrastructure/Identity/Service/IdentityService.cs): `Ecommerce.Infrastructure/Identity/Service/IdentityService.cs`
- [JWT tokens](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Infrastructure/Identity/Service/TokenService.cs): `Ecommerce.Infrastructure/Identity/Service/TokenService.cs`

### Persistence and integrations

- [Identity database](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Infrastructure/Identity/Data/StoreIdentitydbcontext.cs): `Ecommerce.Infrastructure/Identity/Data/StoreIdentitydbcontext.cs`
- [Unit of work](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Infrastructure/Repositories/UnitOfWork.cs): `Ecommerce.Infrastructure/Repositories/UnitOfWork.cs`
- [Store database](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Infrastructure/Data/StoreDbContext.cs): `Ecommerce.Infrastructure/Data/StoreDbContext.cs`
- [Basket repository](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Infrastructure/Repositories/BasketRepository.cs): `Ecommerce.Infrastructure/Repositories/BasketRepository.cs`
- [Cache repository](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Infrastructure/Repositories/CacheRepository.cs): `Ecommerce.Infrastructure/Repositories/CacheRepository.cs`
- **Redis**
- [Stripe gateway](https://github.com/mhmdkhalid4444-eng/ecommerceproject-api/blob/main/Ecommerce.Infrastructure/Payments/StripePaymentGeteway.cs): `Ecommerce.Infrastructure/Payments/StripePaymentGeteway.cs`

### Other components

- **Shopper**

## Connections

- Shopper → Ecommerce API: calls
- Ecommerce API → Authentication endpoints: routes
- Ecommerce API → Catalog endpoints: routes
- Ecommerce API → Basket endpoints: routes
- Ecommerce API → Order endpoints: routes
- Ecommerce API → Payment endpoints: routes
- Authentication endpoints → Authentication workflow: invokes (evidence: `Ecommerce.API/Controllers/AuthenticationController.cs`)
- Order endpoints → Order management: invokes (evidence: `Ecommerce.API/Controllers/OrderController.cs`)
- Payment endpoints → Payment intents: invokes (evidence: `Ecommerce.API/Controllers/PaymentController.cs`)
- Authentication workflow → Identity operations: delegates (evidence: `Ecommerce.Application/Services/AuthenticationService.cs`)
- Authentication workflow → JWT tokens: creates tokens (evidence: `Ecommerce.Application/Services/AuthenticationService.cs`)
- Order management → Basket repository: reads basket (evidence: `Ecommerce.Application/Services/OrderService.cs`)
- Order management → Unit of work: loads and saves (evidence: `Ecommerce.Application/Services/OrderService.cs`)
- Payment intents → Basket repository: reads basket (evidence: `Ecommerce.Application/Services/PaymentService.cs`)
- Payment intents → Unit of work: loads and saves (evidence: `Ecommerce.Application/Services/PaymentService.cs`)
- Payment intents → Stripe gateway: requests payment
- Shopping basket → Redis: stores basket
- Identity operations → Identity database: uses identity store
- Unit of work → Store database: accesses store data
- Catalog endpoints → Product catalog: serves catalog
- Basket endpoints → Shopping basket: serves basket
- Order endpoints → Delivery methods: serves delivery methods
