# huynhtrung1404/shopaction architecture

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

- Interactive diagram: https://gitdiagram.com/huynhtrung1404/shopaction
- Repository: https://github.com/huynhtrung1404/shopaction

## Overview

ShopAction is a small ASP.NET Core ecommerce application. The documented customer journey is browsing a product catalog by category and page, managing a cart, then submitting shipping details at checkout. The tree shows product commands and queries plus order and catalog domain models, but no cart or checkout handlers or API controllers, so those capabilities cannot be traced as implemented stages. The sampled code supports product persistence through repository abstractions and EF Core. Cart and checkout implementation details and runtime routing remain unverified.

Main entry points: [`ShopAction/ShopAction.Domain/Entities/Product.cs`](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Entities/Product.cs) (Product), [`ShopAction/ShopAction.Application/Features/Products/Commands/AddNewProduct.cs`](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Application/Features/Products/Commands/AddNewProduct.cs) (Add product), [`ShopAction/ShopAction.Application/Features/Products/Queries`](https://github.com/huynhtrung1404/shopaction/tree/develop/ShopAction/ShopAction.Application/Features/Products/Queries) (Product queries), [`ShopAction/ShopAction.Infrastructure/Persistences/AppDbContext.cs`](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Infrastructure/Persistences/AppDbContext.cs) (EF DbContext)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web boundary"]
  node_webapi["Web API<br/>[Program.cs]"]
  node_currentuser["Current user"]
end

subgraph group_application["Product application"]
  node_usercontract["User service contract"]
  node_productcommands["Add product<br/>[AddNewProduct.cs]"]
  node_productqueries["Product queries<br/>[Queries]"]
  node_productdto["Product DTO<br/>[ProductDto.cs]"]
  node_mapping["Product mapping<br/>[MappingProfile.cs]"]
  node_paging["Paging models<br/>[PaginatedList.cs]"]
  node_specifications["Query specifications"]
end

subgraph group_domain["Commerce domain"]
  node_repo_contracts["Repository contracts"]
  node_repository_contract["Product repository contract<br/>[IRepository.cs]"]
  node_uow_contract["Unit of work contract<br/>[IUnitOfWork.cs]"]
  node_product["Product<br/>[Product.cs]"]
  node_catalog_entities["Catalog entities<br/>[Category.cs]"]
  node_order["Order and details<br/>[Order.cs]"]
  node_orderdetail["Order detail<br/>[OrderDetail.cs]"]
  node_supplier["Supplier<br/>[Supplier.cs]"]
  node_baseentity["Entity audit fields<br/>[BaseEntity.cs]"]
end

subgraph group_persistence["Persistence"]
  node_dbcontext[("EF DbContext<br/>[AppDbContext.cs]")]
  node_genericrepo["Generic repository"]
  node_repository["Repository adapter<br/>[Repository.cs]"]
  node_uow["Unit of work<br/>[UnitOfWork.cs]"]
  node_entityconfig["Entity configuration"]
end

node_shopper(("Customer"))

node_shopper -->|"uses API"| node_webapi
node_currentuser -->|"implements"| node_usercontract
node_webapi -.->|"provides service"| node_currentuser
node_productcommands -->|"accepts"| node_productdto
node_productcommands -->|"creates"| node_product
node_productcommands -->|"uses"| node_repository_contract
node_productcommands -->|"uses"| node_uow_contract
node_productqueries -->|"returns"| node_productdto
node_productqueries -->|"queries"| node_repository_contract
node_productqueries -->|"selects"| node_product
node_productqueries -->|"uses paging"| node_paging
node_mapping -->|"maps from"| node_product
node_mapping -->|"maps to"| node_productdto
node_genericrepo -->|"implements"| node_repo_contracts
node_repository -->|"extends"| node_genericrepo
node_repository -->|"uses"| node_dbcontext
node_dbcontext -->|"reads audit user"| node_usercontract
node_dbcontext -->|"applies"| node_entityconfig
node_dbcontext -->|"audits"| node_baseentity
node_product -->|"references"| node_supplier
node_product -->|"categorized by"| node_catalog_entities
node_product -->|"appears in"| node_orderdetail
node_order -->|"contains"| node_orderdetail

click node_webapi "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Web/Program.cs"
click node_currentuser "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Web/Services/CurrentUserService.cs"
click node_usercontract "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Application/Common/Interface/ICurrentUserService.cs"
click node_productcommands "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Application/Features/Products/Commands/AddNewProduct.cs"
click node_productqueries "https://github.com/huynhtrung1404/shopaction/tree/develop/ShopAction/ShopAction.Application/Features/Products/Queries"
click node_productdto "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Application/Dtos/ProductDto.cs"
click node_mapping "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Application/Mappings/MappingProfile.cs"
click node_paging "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Application/Models/PaginatedList.cs"
click node_specifications "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Application/Specifications/BaseSpecification.cs"
click node_repo_contracts "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Interfaces/IGenericRepository.cs"
click node_repository_contract "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Interfaces/IRepository.cs"
click node_uow_contract "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Interfaces/IUnitOfWork.cs"
click node_product "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Entities/Product.cs"
click node_catalog_entities "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Entities/Category.cs"
click node_order "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Entities/Order.cs"
click node_orderdetail "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Entities/OrderDetail.cs"
click node_supplier "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Entities/Supplier.cs"
click node_baseentity "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Entities/Base/BaseEntity.cs"
click node_dbcontext "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Infrastructure/Persistences/AppDbContext.cs"
click node_genericrepo "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Infrastructure/Persistences/Repositories/GenericRepository.cs"
click node_repository "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Infrastructure/Persistences/Repositories/Repository.cs"
click node_uow "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Infrastructure/Persistences/Repositories/UnitOfWork.cs"
click node_entityconfig "https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Infrastructure/Persistences/Configurations/AppEntityTypeBaseConfiguration.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_webapi,node_currentuser toneBlue
class node_usercontract,node_productcommands,node_productqueries,node_productdto,node_mapping,node_paging,node_specifications toneAmber
class node_repo_contracts,node_repository_contract,node_uow_contract,node_product,node_catalog_entities,node_order,node_orderdetail,node_supplier,node_baseentity toneMint
class node_dbcontext,node_genericrepo,node_repository,node_uow,node_entityconfig toneRose
class node_shopper toneIndigo
```

## Components

### Web boundary

- [Web API](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Web/Program.cs): `ShopAction/ShopAction.Web/Program.cs`
- [Current user](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Web/Services/CurrentUserService.cs): `ShopAction/ShopAction.Web/Services/CurrentUserService.cs`

### Product application

- [User service contract](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Application/Common/Interface/ICurrentUserService.cs): `ShopAction/ShopAction.Application/Common/Interface/ICurrentUserService.cs`
- [Add product](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Application/Features/Products/Commands/AddNewProduct.cs): `ShopAction/ShopAction.Application/Features/Products/Commands/AddNewProduct.cs`
- [Product queries](https://github.com/huynhtrung1404/shopaction/tree/develop/ShopAction/ShopAction.Application/Features/Products/Queries): `ShopAction/ShopAction.Application/Features/Products/Queries`
- [Product DTO](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Application/Dtos/ProductDto.cs): `ShopAction/ShopAction.Application/Dtos/ProductDto.cs`
- [Product mapping](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Application/Mappings/MappingProfile.cs): `ShopAction/ShopAction.Application/Mappings/MappingProfile.cs`
- [Paging models](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Application/Models/PaginatedList.cs): `ShopAction/ShopAction.Application/Models/PaginatedList.cs`
- [Query specifications](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Application/Specifications/BaseSpecification.cs): `ShopAction/ShopAction.Application/Specifications/BaseSpecification.cs`

### Commerce domain

- [Repository contracts](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Interfaces/IGenericRepository.cs): `ShopAction/ShopAction.Domain/Interfaces/IGenericRepository.cs`
- [Product repository contract](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Interfaces/IRepository.cs): `ShopAction/ShopAction.Domain/Interfaces/IRepository.cs`
- [Unit of work contract](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Interfaces/IUnitOfWork.cs): `ShopAction/ShopAction.Domain/Interfaces/IUnitOfWork.cs`
- [Product](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Entities/Product.cs): `ShopAction/ShopAction.Domain/Entities/Product.cs`
- [Catalog entities](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Entities/Category.cs): `ShopAction/ShopAction.Domain/Entities/Category.cs`
- [Order and details](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Entities/Order.cs): `ShopAction/ShopAction.Domain/Entities/Order.cs`
- [Order detail](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Entities/OrderDetail.cs): `ShopAction/ShopAction.Domain/Entities/OrderDetail.cs`
- [Supplier](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Entities/Supplier.cs): `ShopAction/ShopAction.Domain/Entities/Supplier.cs`
- [Entity audit fields](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Domain/Entities/Base/BaseEntity.cs): `ShopAction/ShopAction.Domain/Entities/Base/BaseEntity.cs`

### Persistence

- [EF DbContext](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Infrastructure/Persistences/AppDbContext.cs): `ShopAction/ShopAction.Infrastructure/Persistences/AppDbContext.cs`
- [Generic repository](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Infrastructure/Persistences/Repositories/GenericRepository.cs): `ShopAction/ShopAction.Infrastructure/Persistences/Repositories/GenericRepository.cs`
- [Repository adapter](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Infrastructure/Persistences/Repositories/Repository.cs): `ShopAction/ShopAction.Infrastructure/Persistences/Repositories/Repository.cs`
- [Unit of work](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Infrastructure/Persistences/Repositories/UnitOfWork.cs): `ShopAction/ShopAction.Infrastructure/Persistences/Repositories/UnitOfWork.cs`
- [Entity configuration](https://github.com/huynhtrung1404/shopaction/blob/develop/ShopAction/ShopAction.Infrastructure/Persistences/Configurations/AppEntityTypeBaseConfiguration.cs): `ShopAction/ShopAction.Infrastructure/Persistences/Configurations/AppEntityTypeBaseConfiguration.cs`

### Other components

- **Customer**

## Connections

- Customer → Web API: uses API
- Current user → User service contract: implements (evidence: `ShopAction/ShopAction.Web/Services/CurrentUserService.cs`)
- Web API → Current user: provides service
- Add product → Product DTO: accepts (evidence: `ShopAction/ShopAction.Application/Features/Products/Commands/AddNewProduct.cs`)
- Add product → Product: creates (evidence: `ShopAction/ShopAction.Application/Features/Products/Commands/AddNewProduct.cs`)
- Add product → Product repository contract: uses (evidence: `ShopAction/ShopAction.Application/Features/Products/Commands/AddNewProduct.cs`)
- Add product → Unit of work contract: uses (evidence: `ShopAction/ShopAction.Application/Features/Products/Commands/AddNewProduct.cs`)
- Product queries → Product DTO: returns (evidence: `ShopAction/ShopAction.Application/Features/Products/Queries/GetAllProductByCategory.cs`)
- Product queries → Product repository contract: queries (evidence: `ShopAction/ShopAction.Application/Features/Products/Queries/GetAllProductByCategory.cs`)
- Product queries → Product: selects (evidence: `ShopAction/ShopAction.Application/Features/Products/Queries/GetAllProductByCategory.cs`)
- Product queries → Paging models: uses paging (evidence: `ShopAction/ShopAction.Application/Features/Products/Queries/GetAllProductByCategory.cs`)
- Product mapping → Product: maps from (evidence: `ShopAction/ShopAction.Application/Mappings/MappingProfile.cs`)
- Product mapping → Product DTO: maps to (evidence: `ShopAction/ShopAction.Application/Mappings/MappingProfile.cs`)
- Generic repository → Repository contracts: implements (evidence: `ShopAction/ShopAction.Infrastructure/Persistences/Repositories/GenericRepository.cs`)
- Repository adapter → Generic repository: extends (evidence: `ShopAction/ShopAction.Infrastructure/Persistences/Repositories/Repository.cs`)
- Repository adapter → EF DbContext: uses (evidence: `ShopAction/ShopAction.Infrastructure/Persistences/Repositories/Repository.cs`)
- EF DbContext → User service contract: reads audit user (evidence: `ShopAction/ShopAction.Infrastructure/Persistences/AppDbContext.cs`)
- EF DbContext → Entity configuration: applies (evidence: `ShopAction/ShopAction.Infrastructure/Persistences/AppDbContext.cs`)
- EF DbContext → Entity audit fields: audits (evidence: `ShopAction/ShopAction.Infrastructure/Persistences/AppDbContext.cs`)
- Product → Supplier: references (evidence: `ShopAction/ShopAction.Domain/Entities/Product.cs`)
- Product → Catalog entities: categorized by (evidence: `ShopAction/ShopAction.Domain/Entities/Product.cs`)
- Product → Order detail: appears in (evidence: `ShopAction/ShopAction.Domain/Entities/Product.cs`)
- Order and details → Order detail: contains (evidence: `ShopAction/ShopAction.Domain/Entities/Order.cs`)
