# omaradel320/cqrs architecture

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

- Interactive diagram: https://gitdiagram.com/omaradel320/cqrs
- Repository: https://github.com/omaradel320/cqrs

## Overview

ProductCatalog is a small ASP.NET Core product CRUD API. HTTP endpoints in Program dispatch MediatR queries and commands; handlers perform product reads and writes through an EF Core SQLite context. Product and command/query models define the data exchanged, with AutoMapper configured for product mappings. Handler details for create and delete were not excerpted, so their database interactions are shown only where the source index confirms references; no separate integrations are documented.

Main entry points: [`ProductCatalog/Program.cs`](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Program.cs) (Product endpoints), [`ProductCatalog/Data/ProductDBContext.cs`](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Data/ProductDBContext.cs) (EF context), [`ProductCatalog/Models/Product.cs`](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Models/Product.cs) (Product model), [`ProductCatalog/MappingProfile.cs`](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/MappingProfile.cs) (Product mappings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_api["Product endpoints<br/>[Program.cs]"]
end

subgraph group_cqrs["CQRS operations"]
  node_create_cmd["Create command"]
  node_create_handler["Create handler"]
  node_update_cmd["Update command"]
  node_update_handler["Update handler"]
  node_delete_cmd["Delete command"]
  node_delete_handler["Delete handler"]
  node_all_query["List query"]
  node_all_handler["List handler"]
  node_id_query["Product query"]
  node_id_handler["Product handler"]
end

subgraph group_data["Product data"]
  node_mapping["Product mappings<br/>[MappingProfile.cs]"]
  node_product["Product model<br/>[Product.cs]"]
  node_context["EF context"]
  node_sqlite[("SQLite database<br/>[products.db]")]
end

node_client(("API client"))

node_client -->|"sends HTTP"| node_api
node_api -->|"dispatches"| node_create_cmd
node_api -->|"dispatches"| node_update_cmd
node_api -->|"dispatches"| node_delete_cmd
node_api -->|"dispatches"| node_all_query
node_api -->|"dispatches"| node_id_query
node_create_handler -->|"handles"| node_create_cmd
node_update_handler -->|"handles"| node_update_cmd
node_delete_handler -->|"handles"| node_delete_cmd
node_all_handler -->|"handles"| node_all_query
node_id_handler -->|"handles"| node_id_query
node_create_handler -->|"uses"| node_context
node_update_handler -->|"uses"| node_context
node_delete_handler -->|"uses"| node_context
node_all_handler -->|"reads"| node_context
node_id_handler -->|"reads"| node_context
node_context -->|"uses SQLite"| node_sqlite
node_context -->|"stores"| node_product
node_create_handler -->|"uses"| node_product
node_update_handler -->|"maps"| node_product
node_delete_handler -->|"uses"| node_product
node_all_handler -->|"returns"| node_product
node_id_handler -->|"returns"| node_product
node_api -->|"registers"| node_context
node_api -->|"registers"| node_mapping
node_mapping -->|"maps"| node_product
node_mapping -->|"maps"| node_create_cmd
node_mapping -->|"maps"| node_update_cmd

click node_api "https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Program.cs"
click node_create_cmd "https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Commands/Create/CreateProductCommand.cs"
click node_create_handler "https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Commands/Create/CreateProductCommandHandler.cs"
click node_update_cmd "https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Commands/Update/UpdateProductCommand.cs"
click node_update_handler "https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Commands/Update/UpdateProductCommandHandler.cs"
click node_delete_cmd "https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Commands/Delete/DeleteProductCommand.cs"
click node_delete_handler "https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Commands/Delete/DeleteProductCommandHandler.cs"
click node_all_query "https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Queries/GetAllProductQuery.cs"
click node_all_handler "https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Queries/GetAllProductQueryHandler.cs"
click node_id_query "https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Queries/GetProductByIdQuery.cs"
click node_id_handler "https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Queries/GetProductByIdQueryHandler.cs"
click node_mapping "https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/MappingProfile.cs"
click node_product "https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Models/Product.cs"
click node_context "https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Data/ProductDBContext.cs"
click node_sqlite "https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/products.db"

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_client toneBlue
class node_create_cmd,node_create_handler,node_update_cmd,node_update_handler,node_delete_cmd,node_delete_handler,node_all_query,node_all_handler,node_id_query,node_id_handler toneAmber
class node_mapping,node_product,node_context,node_sqlite toneMint
```

## Components

### HTTP API

- [Product endpoints](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Program.cs): `ProductCatalog/Program.cs`

### CQRS operations

- [Create command](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Commands/Create/CreateProductCommand.cs): `ProductCatalog/Resources/Commands/Create/CreateProductCommand.cs`
- [Create handler](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Commands/Create/CreateProductCommandHandler.cs): `ProductCatalog/Resources/Commands/Create/CreateProductCommandHandler.cs`
- [Update command](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Commands/Update/UpdateProductCommand.cs): `ProductCatalog/Resources/Commands/Update/UpdateProductCommand.cs`
- [Update handler](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Commands/Update/UpdateProductCommandHandler.cs): `ProductCatalog/Resources/Commands/Update/UpdateProductCommandHandler.cs`
- [Delete command](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Commands/Delete/DeleteProductCommand.cs): `ProductCatalog/Resources/Commands/Delete/DeleteProductCommand.cs`
- [Delete handler](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Commands/Delete/DeleteProductCommandHandler.cs): `ProductCatalog/Resources/Commands/Delete/DeleteProductCommandHandler.cs`
- [List query](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Queries/GetAllProductQuery.cs): `ProductCatalog/Resources/Queries/GetAllProductQuery.cs`
- [List handler](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Queries/GetAllProductQueryHandler.cs): `ProductCatalog/Resources/Queries/GetAllProductQueryHandler.cs`
- [Product query](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Queries/GetProductByIdQuery.cs): `ProductCatalog/Resources/Queries/GetProductByIdQuery.cs`
- [Product handler](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Resources/Queries/GetProductByIdQueryHandler.cs): `ProductCatalog/Resources/Queries/GetProductByIdQueryHandler.cs`

### Product data

- [Product mappings](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/MappingProfile.cs): `ProductCatalog/MappingProfile.cs`
- [Product model](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Models/Product.cs): `ProductCatalog/Models/Product.cs`
- [EF context](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/Data/ProductDBContext.cs): `ProductCatalog/Data/ProductDBContext.cs`
- [SQLite database](https://github.com/omaradel320/cqrs/blob/master/ProductCatalog/products.db): `ProductCatalog/products.db`

### Other components

- **API client**

## Connections

- API client → Product endpoints: sends HTTP (evidence: `ProductCatalog/Program.cs`)
- Product endpoints → Create command: dispatches (evidence: `ProductCatalog/Program.cs`)
- Product endpoints → Update command: dispatches (evidence: `ProductCatalog/Program.cs`)
- Product endpoints → Delete command: dispatches (evidence: `ProductCatalog/Program.cs`)
- Product endpoints → List query: dispatches (evidence: `ProductCatalog/Program.cs`)
- Product endpoints → Product query: dispatches (evidence: `ProductCatalog/Program.cs`)
- Create handler → Create command: handles (evidence: `ProductCatalog/Resources/Commands/Create/CreateProductCommandHandler.cs`)
- Update handler → Update command: handles (evidence: `ProductCatalog/Resources/Commands/Update/UpdateProductCommandHandler.cs`)
- Delete handler → Delete command: handles (evidence: `ProductCatalog/Resources/Commands/Delete/DeleteProductCommandHandler.cs`)
- List handler → List query: handles (evidence: `ProductCatalog/Resources/Queries/GetAllProductQueryHandler.cs`)
- Product handler → Product query: handles (evidence: `ProductCatalog/Resources/Queries/GetProductByIdQueryHandler.cs`)
- Create handler → EF context: uses (evidence: `ProductCatalog/Resources/Commands/Create/CreateProductCommandHandler.cs`)
- Update handler → EF context: uses (evidence: `ProductCatalog/Resources/Commands/Update/UpdateProductCommandHandler.cs`)
- Delete handler → EF context: uses (evidence: `ProductCatalog/Resources/Commands/Delete/DeleteProductCommandHandler.cs`)
- List handler → EF context: reads (evidence: `ProductCatalog/Resources/Queries/GetAllProductQueryHandler.cs`)
- Product handler → EF context: reads (evidence: `ProductCatalog/Resources/Queries/GetProductByIdQueryHandler.cs`)
- EF context → SQLite database: uses SQLite (evidence: `ProductCatalog/Data/ProductDBContext.cs`)
- EF context → Product model: stores (evidence: `ProductCatalog/Data/ProductDBContext.cs`)
- Create handler → Product model: uses (evidence: `ProductCatalog/Resources/Commands/Create/CreateProductCommandHandler.cs`)
- Update handler → Product model: maps (evidence: `ProductCatalog/Resources/Commands/Update/UpdateProductCommandHandler.cs`)
- Delete handler → Product model: uses (evidence: `ProductCatalog/Resources/Commands/Delete/DeleteProductCommandHandler.cs`)
- List handler → Product model: returns (evidence: `ProductCatalog/Resources/Queries/GetAllProductQueryHandler.cs`)
- Product handler → Product model: returns (evidence: `ProductCatalog/Resources/Queries/GetProductByIdQueryHandler.cs`)
- Product endpoints → EF context: registers (evidence: `ProductCatalog/Program.cs`)
- Product endpoints → Product mappings: registers (evidence: `ProductCatalog/Program.cs`)
- Product mappings → Product model: maps (evidence: `ProductCatalog/MappingProfile.cs`)
- Product mappings → Create command: maps (evidence: `ProductCatalog/MappingProfile.cs`)
- Product mappings → Update command: maps (evidence: `ProductCatalog/MappingProfile.cs`)
