# berkaymehmetsert/netcore.rabbitmq architecture

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

- Interactive diagram: https://gitdiagram.com/berkaymehmetsert/netcore.rabbitmq
- Repository: https://github.com/berkaymehmetsert/netcore.rabbitmq

## Overview

This repository is a .NET product-management REST API with CRUD operations, database persistence, and product-creation events published to RabbitMQ. The principal flow is an HTTP request through the products controller and product manager, then to repositories and the unit of work for persistence; creation also publishes an event. Product requests, responses, and entities define the domain data. The console consumer is present, but its event-handling behavior is not shown in the excerpts, so that connection remains unverified.

Main entry points: [`API/Application/Services/ProductManager.cs`](https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Application/Services/ProductManager.cs) (Product Manager), [`API/Persistence/Repositories/ProductRepository.cs`](https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Persistence/Repositories/ProductRepository.cs) (Product Repository), [`API/Controllers/ProductsController.cs`](https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Controllers/ProductsController.cs) (Products Controller), [`API/Persistence/Context/BaseDbContext.cs`](https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Persistence/Context/BaseDbContext.cs) (EF Database Context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Product API"]
  node_controller["Products Controller"]
end

subgraph group_application["Application and Domain"]
  node_manager["Product Manager<br/>[ProductManager.cs]"]
  node_service_contract["Product Service Contract<br/>[IProductService.cs]"]
  node_requests["Product Requests"]
  node_responses["Product Responses<br/>[ProductResponse.cs]"]
  node_product["Product Entity<br/>[Product.cs]"]
  node_base_entity["Base Entity<br/>[BaseEntity.cs]"]
  node_repo_contract["Repository Contracts"]
end

subgraph group_persistence["Persistence"]
  node_product_repo["Product Repository"]
  node_base_repo["Base Repository<br/>[BaseRepository.cs]"]
  node_unit_work["Unit of Work<br/>[UnitOfWork.cs]"]
  node_db_context["EF Database Context<br/>[BaseDbContext.cs]"]
  node_database[("Product Database")]
end

subgraph group_messaging["Event Messaging"]
  node_producer["RabbitMQ Producer"]
  node_rabbitmq["RabbitMQ"]
  node_consumer["Console Consumer<br/>[Program.cs]"]
end

node_client(("HTTP Client"))

node_client -->|"sends requests"| node_controller
node_controller -->|"calls service"| node_manager
node_controller -->|"accepts"| node_requests
node_controller -->|"returns"| node_responses
node_manager -->|"reads and writes"| node_product_repo
node_manager -->|"saves changes"| node_unit_work
node_manager -->|"publishes created product"| node_producer
node_manager -->|"creates and updates"| node_product
node_manager -->|"maps results"| node_responses
node_manager -->|"uses input"| node_requests
node_service_contract -->|"accepts"| node_requests
node_service_contract -->|"returns"| node_responses
node_product_repo -->|"inherits"| node_base_repo
node_product_repo -->|"uses context"| node_db_context
node_product_repo -->|"queries"| node_product
node_unit_work -->|"uses context"| node_db_context
node_db_context -->|"tracks"| node_product
node_product_repo -->|"implements"| node_repo_contract
node_base_repo -->|"implements"| node_repo_contract
node_product -->|"inherits"| node_base_entity
node_db_context -.->|"persists to"| node_database
node_producer -->|"publishes event"| node_rabbitmq
node_rabbitmq -.->|"may deliver event"| node_consumer

click node_controller "https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Controllers/ProductsController.cs"
click node_manager "https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Application/Services/ProductManager.cs"
click node_service_contract "https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Application/Services/IProductService.cs"
click node_requests "https://github.com/berkaymehmetsert/netcore.rabbitmq/tree/master/API/Application/Requests"
click node_responses "https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Application/Responses/ProductResponse.cs"
click node_product "https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Models/Entities/Product.cs"
click node_base_entity "https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Models/Common/BaseEntity.cs"
click node_repo_contract "https://github.com/berkaymehmetsert/netcore.rabbitmq/tree/master/API/Application/Repositories"
click node_product_repo "https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Persistence/Repositories/ProductRepository.cs"
click node_base_repo "https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Persistence/Repositories/BaseRepository.cs"
click node_unit_work "https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Persistence/Repositories/UnitOfWork.cs"
click node_db_context "https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Persistence/Context/BaseDbContext.cs"
click node_producer "https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Application/RabbitMq/RabbitMqProducer.cs"
click node_consumer "https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/Consumer.Console/Program.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_controller,node_client toneBlue
class node_manager,node_service_contract,node_requests,node_responses,node_product,node_base_entity,node_repo_contract toneAmber
class node_product_repo,node_base_repo,node_unit_work,node_db_context,node_database toneMint
class node_producer,node_rabbitmq,node_consumer toneRose
```

## Components

### Product API

- [Products Controller](https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Controllers/ProductsController.cs): `API/Controllers/ProductsController.cs`

### Application and Domain

- [Product Manager](https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Application/Services/ProductManager.cs): `API/Application/Services/ProductManager.cs`
- [Product Service Contract](https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Application/Services/IProductService.cs): `API/Application/Services/IProductService.cs`
- [Product Requests](https://github.com/berkaymehmetsert/netcore.rabbitmq/tree/master/API/Application/Requests): `API/Application/Requests`
- [Product Responses](https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Application/Responses/ProductResponse.cs): `API/Application/Responses/ProductResponse.cs`
- [Product Entity](https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Models/Entities/Product.cs): `API/Models/Entities/Product.cs`
- [Base Entity](https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Models/Common/BaseEntity.cs): `API/Models/Common/BaseEntity.cs`
- [Repository Contracts](https://github.com/berkaymehmetsert/netcore.rabbitmq/tree/master/API/Application/Repositories): `API/Application/Repositories`

### Persistence

- [Product Repository](https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Persistence/Repositories/ProductRepository.cs): `API/Persistence/Repositories/ProductRepository.cs`
- [Base Repository](https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Persistence/Repositories/BaseRepository.cs): `API/Persistence/Repositories/BaseRepository.cs`
- [Unit of Work](https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Persistence/Repositories/UnitOfWork.cs): `API/Persistence/Repositories/UnitOfWork.cs`
- [EF Database Context](https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Persistence/Context/BaseDbContext.cs): `API/Persistence/Context/BaseDbContext.cs`
- **Product Database**

### Event Messaging

- [RabbitMQ Producer](https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/API/Application/RabbitMq/RabbitMqProducer.cs): `API/Application/RabbitMq/RabbitMqProducer.cs`
- **RabbitMQ**
- [Console Consumer](https://github.com/berkaymehmetsert/netcore.rabbitmq/blob/master/Consumer.Console/Program.cs): `Consumer.Console/Program.cs`

### Other components

- **HTTP Client**

## Connections

- HTTP Client → Products Controller: sends requests (evidence: `API/Controllers/ProductsController.cs`)
- Products Controller → Product Manager: calls service (evidence: `API/Controllers/ProductsController.cs`)
- Products Controller → Product Requests: accepts (evidence: `API/Controllers/ProductsController.cs`)
- Products Controller → Product Responses: returns (evidence: `API/Controllers/ProductsController.cs`)
- Product Manager → Product Repository: reads and writes (evidence: `API/Application/Services/ProductManager.cs`)
- Product Manager → Unit of Work: saves changes (evidence: `API/Application/Services/ProductManager.cs`)
- Product Manager → RabbitMQ Producer: publishes created product (evidence: `API/Application/Services/ProductManager.cs`)
- Product Manager → Product Entity: creates and updates (evidence: `API/Application/Services/ProductManager.cs`)
- Product Manager → Product Responses: maps results (evidence: `API/Application/Services/ProductManager.cs`)
- Product Manager → Product Requests: uses input (evidence: `API/Application/Services/ProductManager.cs`)
- Product Service Contract → Product Requests: accepts (evidence: `API/Application/Services/IProductService.cs`)
- Product Service Contract → Product Responses: returns (evidence: `API/Application/Services/IProductService.cs`)
- Product Repository → Base Repository: inherits (evidence: `API/Persistence/Repositories/ProductRepository.cs`)
- Product Repository → EF Database Context: uses context (evidence: `API/Persistence/Repositories/ProductRepository.cs`)
- Product Repository → Product Entity: queries (evidence: `API/Persistence/Repositories/ProductRepository.cs`)
- Unit of Work → EF Database Context: uses context (evidence: `API/Persistence/Repositories/UnitOfWork.cs`)
- EF Database Context → Product Entity: tracks (evidence: `API/Persistence/Context/BaseDbContext.cs`)
- Product Repository → Repository Contracts: implements (evidence: `API/Persistence/Repositories/ProductRepository.cs`)
- Base Repository → Repository Contracts: implements (evidence: `API/Persistence/Repositories/BaseRepository.cs`)
- Product Entity → Base Entity: inherits (evidence: `API/Models/Entities/Product.cs`)
- EF Database Context → Product Database: persists to
- RabbitMQ Producer → RabbitMQ: publishes event (evidence: `README.md`)
- RabbitMQ → Console Consumer: may deliver event
