# shresthasuman/learningmicroservice architecture

> Architecture diagram of the GitHub repository shresthasuman/learningmicroservice, 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/shresthasuman/learningmicroservice
- Repository: https://github.com/shresthasuman/learningmicroservice

## Overview

This learning microservice repository currently exposes two product domains: product catalog management and user shopping baskets. A user can browse or maintain products, then retrieve, store, or delete a basket; the tree also shows validation and shared CQRS behaviors. Catalog and basket persistence use document sessions, while basket reads and writes additionally use a distributed-cache decorator. The README is only a brief project description, and endpoint implementations and basket startup wiring were not sampled, so those dispatch relationships are left unspecified.

Main entry points: [`E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Data/BasketRepository.cs`](https://github.com/shresthasuman/learningmicroservice/blob/main/E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Data/BasketRepository.cs) (Basket repository), [`E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Data/CachedBasketRepository.cs`](https://github.com/shresthasuman/learningmicroservice/blob/main/E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Data/CachedBasketRepository.cs) (Cached repository), [`E-commerce/src/Services/Catalog/CatalogAPI/Program.cs`](https://github.com/shresthasuman/learningmicroservice/blob/main/E-commerce/src/Services/Catalog/CatalogAPI/Program.cs) (Catalog API), [`E-commerce/src/Services/Catalog/CatalogAPI/Features`](https://github.com/shresthasuman/learningmicroservice/tree/main/E-commerce/src/Services/Catalog/CatalogAPI/Features) (Product queries)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Product catalog"]
  node_catalog_api["Catalog API<br/>[Program.cs]"]
  node_catalog_reads["Product queries"]
  node_catalog_writes["Product commands"]
  node_product_model["Product model<br/>[Products.cs]"]
end

subgraph group_basket["Shopping basket"]
  node_basket_endpoints["Basket endpoints"]
  node_basket_queries["Basket queries"]
  node_basket_commands["Basket commands"]
  node_basket_model["Shopping cart<br/>[ShoppingCart.cs]"]
end

subgraph group_shared["Shared application layer"]
  node_cqrs["CQRS contracts"]
  node_validation["Validation behavior"]
  node_logging["Logging behavior<br/>[LoggingBehavior.cs]"]
end

subgraph group_infra["Persistence and cache"]
  node_basket_repo["Basket repository"]
  node_cached_repo["Cached repository"]
  node_catalog_store[("Catalog document store")]
  node_basket_store[("Basket document store")]
  node_distributed_cache[("Distributed cache")]
end

node_shopper(("User"))

node_shopper -->|"requests"| node_catalog_api
node_shopper -->|"requests"| node_basket_endpoints
node_catalog_api -->|"configures session"| node_catalog_store
node_catalog_reads -->|"queries and loads"| node_catalog_store
node_catalog_writes -->|"stores and updates"| node_catalog_store
node_basket_queries -->|"reads basket"| node_basket_repo
node_basket_commands -->|"writes basket"| node_basket_repo
node_basket_repo -->|"loads and saves"| node_basket_store
node_cached_repo -->|"delegates operations"| node_basket_repo
node_cached_repo -->|"reads and updates"| node_distributed_cache

click node_catalog_api "https://github.com/shresthasuman/learningmicroservice/blob/main/E-commerce/src/Services/Catalog/CatalogAPI/Program.cs"
click node_catalog_reads "https://github.com/shresthasuman/learningmicroservice/tree/main/E-commerce/src/Services/Catalog/CatalogAPI/Features"
click node_catalog_writes "https://github.com/shresthasuman/learningmicroservice/tree/main/E-commerce/src/Services/Catalog/CatalogAPI/Features"
click node_product_model "https://github.com/shresthasuman/learningmicroservice/blob/main/E-commerce/src/Services/Catalog/CatalogAPI/Model/Products.cs"
click node_basket_endpoints "https://github.com/shresthasuman/learningmicroservice/tree/main/E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Features"
click node_basket_queries "https://github.com/shresthasuman/learningmicroservice/tree/main/E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Features/GetBasket"
click node_basket_commands "https://github.com/shresthasuman/learningmicroservice/tree/main/E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Features"
click node_basket_model "https://github.com/shresthasuman/learningmicroservice/blob/main/E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Models/ShoppingCart.cs"
click node_basket_repo "https://github.com/shresthasuman/learningmicroservice/blob/main/E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Data/BasketRepository.cs"
click node_cached_repo "https://github.com/shresthasuman/learningmicroservice/blob/main/E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Data/CachedBasketRepository.cs"
click node_cqrs "https://github.com/shresthasuman/learningmicroservice/tree/main/E-commerce/src/BuildingBlocks/BuildingBlocks/CQRS"
click node_validation "https://github.com/shresthasuman/learningmicroservice/blob/main/E-commerce/src/BuildingBlocks/BuildingBlocks/Behaviors/ValidationBehavior.cs"
click node_logging "https://github.com/shresthasuman/learningmicroservice/blob/main/E-commerce/src/BuildingBlocks/BuildingBlocks/Behaviors/LoggingBehavior.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_catalog_api,node_catalog_reads,node_catalog_writes,node_product_model,node_shopper toneBlue
class node_basket_endpoints,node_basket_queries,node_basket_commands,node_basket_model toneAmber
class node_cqrs,node_validation,node_logging toneMint
class node_basket_repo,node_cached_repo,node_catalog_store,node_basket_store,node_distributed_cache toneRose
```

## Components

### Product catalog

- [Catalog API](https://github.com/shresthasuman/learningmicroservice/blob/main/E-commerce/src/Services/Catalog/CatalogAPI/Program.cs): `E-commerce/src/Services/Catalog/CatalogAPI/Program.cs`
- [Product queries](https://github.com/shresthasuman/learningmicroservice/tree/main/E-commerce/src/Services/Catalog/CatalogAPI/Features): `E-commerce/src/Services/Catalog/CatalogAPI/Features`
- [Product commands](https://github.com/shresthasuman/learningmicroservice/tree/main/E-commerce/src/Services/Catalog/CatalogAPI/Features): `E-commerce/src/Services/Catalog/CatalogAPI/Features`
- [Product model](https://github.com/shresthasuman/learningmicroservice/blob/main/E-commerce/src/Services/Catalog/CatalogAPI/Model/Products.cs): `E-commerce/src/Services/Catalog/CatalogAPI/Model/Products.cs`

### Shopping basket

- [Basket endpoints](https://github.com/shresthasuman/learningmicroservice/tree/main/E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Features): `E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Features`
- [Basket queries](https://github.com/shresthasuman/learningmicroservice/tree/main/E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Features/GetBasket): `E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Features/GetBasket`
- [Basket commands](https://github.com/shresthasuman/learningmicroservice/tree/main/E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Features): `E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Features`
- [Shopping cart](https://github.com/shresthasuman/learningmicroservice/blob/main/E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Models/ShoppingCart.cs): `E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Models/ShoppingCart.cs`

### Shared application layer

- [CQRS contracts](https://github.com/shresthasuman/learningmicroservice/tree/main/E-commerce/src/BuildingBlocks/BuildingBlocks/CQRS): `E-commerce/src/BuildingBlocks/BuildingBlocks/CQRS`
- [Validation behavior](https://github.com/shresthasuman/learningmicroservice/blob/main/E-commerce/src/BuildingBlocks/BuildingBlocks/Behaviors/ValidationBehavior.cs): `E-commerce/src/BuildingBlocks/BuildingBlocks/Behaviors/ValidationBehavior.cs`
- [Logging behavior](https://github.com/shresthasuman/learningmicroservice/blob/main/E-commerce/src/BuildingBlocks/BuildingBlocks/Behaviors/LoggingBehavior.cs): `E-commerce/src/BuildingBlocks/BuildingBlocks/Behaviors/LoggingBehavior.cs`

### Persistence and cache

- [Basket repository](https://github.com/shresthasuman/learningmicroservice/blob/main/E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Data/BasketRepository.cs): `E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Data/BasketRepository.cs`
- [Cached repository](https://github.com/shresthasuman/learningmicroservice/blob/main/E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Data/CachedBasketRepository.cs): `E-commerce/src/Services/Basket/BasketAPI/BasketAPI/Data/CachedBasketRepository.cs`
- **Catalog document store**
- **Basket document store**
- **Distributed cache**

### Other components

- **User**

## Connections

- User → Catalog API: requests
- User → Basket endpoints: requests
- Catalog API → Catalog document store: configures session
- Product queries → Catalog document store: queries and loads
- Product commands → Catalog document store: stores and updates
- Basket queries → Basket repository: reads basket
- Basket commands → Basket repository: writes basket
- Basket repository → Basket document store: loads and saves
- Cached repository → Basket repository: delegates operations
- Cached repository → Distributed cache: reads and updates
