# didar-code/salesmanagementwithddd_design architecture

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

- Interactive diagram: https://gitdiagram.com/didar-code/salesmanagementwithddd_design
- Repository: https://github.com/didar-code/salesmanagementwithddd_design

## Overview

This solution contains a working Sales Management API for creating and searching payment methods, plus a much less complete Auth Management area with login and registration command/response contracts. The sales workflow is controller-facing, with handlers performing domain creation or repository search and returning response DTOs; repository persistence is configured through the API. Auth source shown here does not establish an end-to-end login or registration workflow. Relationships are limited to those visible in excerpts or the source index.

Main entry points: [`SalesManagement.Handler/Commands/CreatePaymentMethodHandler.cs`](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Handler/Commands/CreatePaymentMethodHandler.cs) (Create handler), [`SalesManagement.API/Program.cs`](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.API/Program.cs) (API composition), [`SalesManagement.Handler/Queries/SearchPaymentMethodHandler.cs`](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Handler/Queries/SearchPaymentMethodHandler.cs) (Search handler), [`SalesManagement.Repository/Data/AppDbContext.cs`](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Repository/Data/AppDbContext.cs) (Database context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sales_api["Sales API"]
  node_payment_controller["Payment method controller"]
  node_sales_program["API composition<br/>[Program.cs]"]
end

subgraph group_sales_contracts["Sales Contracts"]
  node_create_command["Create payment command"]
  node_search_query["Search payment query"]
  node_payment_response["Payment response DTO"]
end

subgraph group_sales_application["Sales Application"]
  node_create_handler["Create handler"]
  node_search_handler["Search handler"]
  node_command_handler_contract["Command handler interface<br/>[ICommandHandler.cs]"]
  node_query_handler_contract["Query handler interface<br/>[IQueryHandler.cs]"]
  node_command_contract["Command interface<br/>[ICommand.cs]"]
  node_query_contract["Query interface<br/>[IQuery.cs]"]
end

subgraph group_sales_domain_data["Domain and Persistence"]
  node_payment_aggregate["Payment method aggregate"]
  node_payment_repository_interface["Payment repository contract"]
  node_payment_repository["Payment repository"]
  node_app_db_context["Database context<br/>[AppDbContext.cs]"]
  node_sales_database[("Sales database")]
end

subgraph group_auth_contracts["Auth Contracts"]
  node_login_command["Login command<br/>[LoginCommand.cs]"]
  node_register_command["Register command"]
  node_login_response["Login response"]
  node_register_response["Registration response"]
  node_auth_aggregate_root["User aggregate root"]
  node_auth_program["Auth API composition<br/>[Program.cs]"]
end

node_client(("API client"))

node_client -.->|"sends requests"| node_payment_controller
node_payment_controller -->|"accepts command"| node_create_command
node_payment_controller -->|"accepts query"| node_search_query
node_sales_program -->|"registers handler"| node_create_handler
node_sales_program -->|"registers handler"| node_search_handler
node_sales_program -->|"registers repository"| node_payment_repository
node_sales_program -->|"configures context"| node_app_db_context
node_create_command -->|"implements"| node_command_contract
node_search_query -->|"implements"| node_query_contract
node_create_handler -->|"implements"| node_command_handler_contract
node_search_handler -->|"implements"| node_query_handler_contract
node_create_handler -->|"creates aggregate"| node_payment_aggregate
node_create_handler -->|"adds and saves"| node_payment_repository_interface
node_search_handler -->|"searches"| node_payment_repository_interface
node_create_handler -->|"returns DTO"| node_payment_response
node_search_handler -->|"maps results"| node_payment_response
node_payment_repository -->|"implements"| node_payment_repository_interface
node_payment_repository -->|"uses context"| node_app_db_context
node_app_db_context -->|"stores entities"| node_payment_aggregate
node_app_db_context -.->|"persists data"| node_sales_database
node_login_command -->|"references response"| node_login_response
node_register_command -->|"references response"| node_register_response

click node_payment_controller "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.API/Controllers/PaymentMethodController.cs"
click node_sales_program "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.API/Program.cs"
click node_create_command "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.DTOs/Commands/CreatePaymentMethodCommand.cs"
click node_search_query "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.DTOs/Queries/SearchPaymentMethodQuery.cs"
click node_payment_response "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.DTOs/Responses/PaymentMethodResponseDto.cs"
click node_create_handler "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Handler/Commands/CreatePaymentMethodHandler.cs"
click node_search_handler "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Handler/Queries/SearchPaymentMethodHandler.cs"
click node_command_handler_contract "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Shared/Generics/ICommandHandler.cs"
click node_query_handler_contract "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Shared/Generics/IQueryHandler.cs"
click node_command_contract "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Shared/ICommand.cs"
click node_query_contract "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Shared/IQuery.cs"
click node_payment_aggregate "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Aggregators/Aggregators/PaymentMethodAggregatorsRoot.cs"
click node_payment_repository_interface "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Repository/Interfaces/IPaymentMethodRepository.cs"
click node_payment_repository "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Repository/Implementations/PaymentMethodRepository.cs"
click node_app_db_context "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Repository/Data/AppDbContext.cs"
click node_login_command "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/AuthManagement.DTOs/Commands/LoginCommand.cs"
click node_register_command "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/AuthManagement.DTOs/Commands/RegisterUserCommand.cs"
click node_login_response "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/AuthManagement.DTOs/Responses/LoginResponseDto.cs"
click node_register_response "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/AuthManagement.DTOs/Responses/RegisterResponseDto.cs"
click node_auth_aggregate_root "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/AuthManagement.Aggregators/Aggregators/UserAggregatorsRoot.cs"
click node_auth_program "https://github.com/didar-code/salesmanagementwithddd_design/blob/main/AuthManagement.Api/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_payment_controller,node_sales_program,node_client toneBlue
class node_create_command,node_search_query,node_payment_response toneAmber
class node_create_handler,node_search_handler,node_command_handler_contract,node_query_handler_contract,node_command_contract,node_query_contract toneMint
class node_payment_aggregate,node_payment_repository_interface,node_payment_repository,node_app_db_context,node_sales_database toneRose
class node_login_command,node_register_command,node_login_response,node_register_response,node_auth_aggregate_root,node_auth_program toneIndigo
```

## Components

### Sales API

- [Payment method controller](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.API/Controllers/PaymentMethodController.cs): `SalesManagement.API/Controllers/PaymentMethodController.cs`
- [API composition](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.API/Program.cs): `SalesManagement.API/Program.cs`

### Sales Contracts

- [Create payment command](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.DTOs/Commands/CreatePaymentMethodCommand.cs): `SalesManagement.DTOs/Commands/CreatePaymentMethodCommand.cs`
- [Search payment query](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.DTOs/Queries/SearchPaymentMethodQuery.cs): `SalesManagement.DTOs/Queries/SearchPaymentMethodQuery.cs`
- [Payment response DTO](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.DTOs/Responses/PaymentMethodResponseDto.cs): `SalesManagement.DTOs/Responses/PaymentMethodResponseDto.cs`

### Sales Application

- [Create handler](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Handler/Commands/CreatePaymentMethodHandler.cs): `SalesManagement.Handler/Commands/CreatePaymentMethodHandler.cs`
- [Search handler](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Handler/Queries/SearchPaymentMethodHandler.cs): `SalesManagement.Handler/Queries/SearchPaymentMethodHandler.cs`
- [Command handler interface](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Shared/Generics/ICommandHandler.cs): `SalesManagement.Shared/Generics/ICommandHandler.cs`
- [Query handler interface](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Shared/Generics/IQueryHandler.cs): `SalesManagement.Shared/Generics/IQueryHandler.cs`
- [Command interface](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Shared/ICommand.cs): `SalesManagement.Shared/ICommand.cs`
- [Query interface](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Shared/IQuery.cs): `SalesManagement.Shared/IQuery.cs`

### Domain and Persistence

- [Payment method aggregate](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Aggregators/Aggregators/PaymentMethodAggregatorsRoot.cs): `SalesManagement.Aggregators/Aggregators/PaymentMethodAggregatorsRoot.cs`
- [Payment repository contract](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Repository/Interfaces/IPaymentMethodRepository.cs): `SalesManagement.Repository/Interfaces/IPaymentMethodRepository.cs`
- [Payment repository](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Repository/Implementations/PaymentMethodRepository.cs): `SalesManagement.Repository/Implementations/PaymentMethodRepository.cs`
- [Database context](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/SalesManagement.Repository/Data/AppDbContext.cs): `SalesManagement.Repository/Data/AppDbContext.cs`
- **Sales database**

### Auth Contracts

- [Login command](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/AuthManagement.DTOs/Commands/LoginCommand.cs): `AuthManagement.DTOs/Commands/LoginCommand.cs`
- [Register command](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/AuthManagement.DTOs/Commands/RegisterUserCommand.cs): `AuthManagement.DTOs/Commands/RegisterUserCommand.cs`
- [Login response](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/AuthManagement.DTOs/Responses/LoginResponseDto.cs): `AuthManagement.DTOs/Responses/LoginResponseDto.cs`
- [Registration response](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/AuthManagement.DTOs/Responses/RegisterResponseDto.cs): `AuthManagement.DTOs/Responses/RegisterResponseDto.cs`
- [User aggregate root](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/AuthManagement.Aggregators/Aggregators/UserAggregatorsRoot.cs): `AuthManagement.Aggregators/Aggregators/UserAggregatorsRoot.cs`
- [Auth API composition](https://github.com/didar-code/salesmanagementwithddd_design/blob/main/AuthManagement.Api/Program.cs): `AuthManagement.Api/Program.cs`

### Other components

- **API client**

## Connections

- API client → Payment method controller: sends requests
- Payment method controller → Create payment command: accepts command (evidence: `SalesManagement.API/Controllers/PaymentMethodController.cs`)
- Payment method controller → Search payment query: accepts query (evidence: `SalesManagement.API/Controllers/PaymentMethodController.cs`)
- API composition → Create handler: registers handler (evidence: `SalesManagement.API/Program.cs`)
- API composition → Search handler: registers handler (evidence: `SalesManagement.API/Program.cs`)
- API composition → Payment repository: registers repository (evidence: `SalesManagement.API/Program.cs`)
- API composition → Database context: configures context (evidence: `SalesManagement.API/Program.cs`)
- Create payment command → Command interface: implements (evidence: `SalesManagement.DTOs/Commands/CreatePaymentMethodCommand.cs`)
- Search payment query → Query interface: implements (evidence: `SalesManagement.DTOs/Queries/SearchPaymentMethodQuery.cs`)
- Create handler → Command handler interface: implements (evidence: `SalesManagement.Handler/Commands/CreatePaymentMethodHandler.cs`)
- Search handler → Query handler interface: implements (evidence: `SalesManagement.Handler/Queries/SearchPaymentMethodHandler.cs`)
- Create handler → Payment method aggregate: creates aggregate (evidence: `SalesManagement.Handler/Commands/CreatePaymentMethodHandler.cs`)
- Create handler → Payment repository contract: adds and saves (evidence: `SalesManagement.Handler/Commands/CreatePaymentMethodHandler.cs`)
- Search handler → Payment repository contract: searches (evidence: `SalesManagement.Handler/Queries/SearchPaymentMethodHandler.cs`)
- Create handler → Payment response DTO: returns DTO (evidence: `SalesManagement.Handler/Commands/CreatePaymentMethodHandler.cs`)
- Search handler → Payment response DTO: maps results (evidence: `SalesManagement.Handler/Queries/SearchPaymentMethodHandler.cs`)
- Payment repository → Payment repository contract: implements (evidence: `SalesManagement.Repository/Implementations/PaymentMethodRepository.cs`)
- Payment repository → Database context: uses context (evidence: `SalesManagement.Repository/Implementations/PaymentMethodRepository.cs`)
- Database context → Payment method aggregate: stores entities (evidence: `SalesManagement.Repository/Data/AppDbContext.cs`)
- Database context → Sales database: persists data
- Login command → Login response: references response (evidence: `AuthManagement.DTOs/Commands/LoginCommand.cs`)
- Register command → Registration response: references response (evidence: `AuthManagement.DTOs/Commands/RegisterUserCommand.cs`)
