# didar-code/testprojectforservicebusandorchestraitor architecture

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

## Overview

This repository implements an API-based commerce workflow with separate authentication, order, and payment subsystems, coordinated by an order-payment orchestrator. Users register or log in, create and search orders, and access payment operations; the orchestrator dispatches payment and order commands through a service bus. The graph also preserves repository-backed state, JWT token generation, and payment-query caching. Several handlers and integrations are listed in the tree but were not excerpted, so their internal relationships are omitted or shown as unverified dispatches.

Main entry points: [`ServiceBus/ServiceBus.cs`](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/ServiceBus/ServiceBus.cs) (Service bus), [`AuthManagementSubSystem.Api/Controllers/AuthController.cs`](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/AuthManagementSubSystem.Api/Controllers/AuthController.cs) (Auth API), [`AuthManagementSubSystem.Handlers/Commands/LoginHandler.cs`](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/AuthManagementSubSystem.Handlers/Commands/LoginHandler.cs) (Login handler), [`PaymentManagementSubSystem.Handler/Queries/GetPaymentHandler.cs`](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/PaymentManagementSubSystem.Handler/Queries/GetPaymentHandler.cs) (Payment queries)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_auth["Authentication"]
  node_auth_api["Auth API<br/>[AuthController.cs]"]
  node_auth_handlers["Auth handlers<br/>[Commands]"]
  node_login_handler["Login handler<br/>[LoginHandler.cs]"]
  node_user_repo["User repository<br/>[UserRepository.cs]"]
  node_auth_store[("Auth database<br/>[AuthDbContext.cs]")]
  node_token_service["JWT tokens<br/>[JwtTokenService.cs]"]
end

subgraph group_orders["Order Management"]
  node_order_api["Order API<br/>[OrderController.cs]"]
  node_order_handlers["Order command handlers<br/>[Commands]"]
  node_order_search["Order search"]
  node_order_repo["Order repository<br/>[OrderRepository.cs]"]
  node_order_store[("Order database<br/>[AppDbContext.cs]")]
end

subgraph group_payments["Payment Management"]
  node_payment_api["Payment API"]
  node_payment_handlers["Payment handlers<br/>[Commands]"]
  node_payment_query["Payment queries"]
  node_payment_repo["Payment repository"]
  node_payment_store[("Payment database")]
  node_payment_cache["Payment cache"]
end

subgraph group_coordination["Workflow Coordination"]
  node_orchestrator_api["Orchestrator API"]
  node_orchestrator["Order-payment workflow"]
  node_service_bus["Service bus<br/>[ServiceBus.cs]"]
end

subgraph group_shared["Shared Runtime"]
  node_command_handlers["Command dispatch<br/>[ICommandHandler.cs]"]
  node_query_handlers["Query dispatch<br/>[IQueryHandler.cs]"]
  node_exception_middleware["Exception middleware"]
end

node_user(("User"))

node_user -->|"submits credentials"| node_auth_api
node_auth_api -->|"dispatches commands"| node_auth_handlers
node_auth_api -->|"handles login"| node_login_handler
node_login_handler -->|"loads user"| node_user_repo
node_login_handler -->|"generates token"| node_token_service
node_user_repo -->|"uses context"| node_auth_store
node_order_api -->|"dispatches commands"| node_order_handlers
node_order_api -->|"runs search"| node_order_search
node_order_search -->|"searches orders"| node_order_repo
node_order_repo -->|"uses context"| node_order_store
node_payment_api -->|"dispatches commands"| node_payment_handlers
node_payment_api -->|"gets payments"| node_payment_query
node_payment_query -->|"reads payments"| node_payment_repo
node_payment_query -->|"uses cache"| node_payment_cache
node_payment_repo -->|"uses context"| node_payment_store
node_orchestrator_api -->|"runs workflow"| node_orchestrator
node_orchestrator -->|"dispatches commands"| node_service_bus
node_service_bus -->|"resolves handler"| node_command_handlers
node_service_bus -.->|"dispatches payment"| node_payment_handlers
node_service_bus -.->|"dispatches order"| node_order_handlers

click node_auth_api "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/AuthManagementSubSystem.Api/Controllers/AuthController.cs"
click node_auth_handlers "https://github.com/didar-code/testprojectforservicebusandorchestraitor/tree/master/AuthManagementSubSystem.Handlers/Commands"
click node_login_handler "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/AuthManagementSubSystem.Handlers/Commands/LoginHandler.cs"
click node_user_repo "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/AuthManagementSubSystem.Repository/Repositories/UserRepository.cs"
click node_auth_store "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/AuthManagementSubSystem.Repository/Data/AuthDbContext.cs"
click node_token_service "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/AuthManagementSubSystem.Repository/Security/JwtTokenService.cs"
click node_order_api "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/OrderManagementSubsystem.Api/Controllers/OrderController.cs"
click node_order_handlers "https://github.com/didar-code/testprojectforservicebusandorchestraitor/tree/master/OrderManagementSubsystem.Handler/Commands"
click node_order_search "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/OrderManagementSubsystem.Handler/Queries/SearchOrderHandler.cs"
click node_order_repo "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/OrderManagementSubsystem.Repository/Repositories/OrderRepository.cs"
click node_order_store "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/OrderManagementSubsystem.Repository/Data/AppDbContext.cs"
click node_payment_api "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/PaymentManagementSubSystem.Api/Controllers/PaymentController.cs"
click node_payment_handlers "https://github.com/didar-code/testprojectforservicebusandorchestraitor/tree/master/PaymentManagementSubSystem.Handler/Commands"
click node_payment_query "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/PaymentManagementSubSystem.Handler/Queries/GetPaymentHandler.cs"
click node_payment_repo "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/PaymentManagementSubSystem.Repository/Repositories/PaymentRepository.cs"
click node_payment_store "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/PaymentManagementSubSystem.Repository/Data/PaymentDbContext.cs"
click node_payment_cache "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/SharedSubSystem/Redis/Caching/RedisCacheService.cs"
click node_orchestrator_api "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/OrchestraitorSubSystem.Api/Controllers/OrchestratorController.cs"
click node_orchestrator "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/OrchestraitorSubSystem.Handler/Orchestraitators/OrderPaymentOrchestrator.cs"
click node_service_bus "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/ServiceBus/ServiceBus.cs"
click node_command_handlers "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/SharedSubSystem/Generics/ICommandHandler.cs"
click node_query_handlers "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/SharedSubSystem/Generics/IQueryHandler.cs"
click node_exception_middleware "https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/SharedSubSystem/Middleware/GlobalExceptionMiddleware.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_auth_api,node_auth_handlers,node_login_handler,node_user_repo,node_auth_store,node_token_service,node_user toneBlue
class node_order_api,node_order_handlers,node_order_search,node_order_repo,node_order_store toneAmber
class node_payment_api,node_payment_handlers,node_payment_query,node_payment_repo,node_payment_store,node_payment_cache toneMint
class node_orchestrator_api,node_orchestrator,node_service_bus toneRose
class node_command_handlers,node_query_handlers,node_exception_middleware toneIndigo
```

## Components

### Authentication

- [Auth API](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/AuthManagementSubSystem.Api/Controllers/AuthController.cs): `AuthManagementSubSystem.Api/Controllers/AuthController.cs`
- [Auth handlers](https://github.com/didar-code/testprojectforservicebusandorchestraitor/tree/master/AuthManagementSubSystem.Handlers/Commands): `AuthManagementSubSystem.Handlers/Commands`
- [Login handler](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/AuthManagementSubSystem.Handlers/Commands/LoginHandler.cs): `AuthManagementSubSystem.Handlers/Commands/LoginHandler.cs`
- [User repository](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/AuthManagementSubSystem.Repository/Repositories/UserRepository.cs): `AuthManagementSubSystem.Repository/Repositories/UserRepository.cs`
- [Auth database](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/AuthManagementSubSystem.Repository/Data/AuthDbContext.cs): `AuthManagementSubSystem.Repository/Data/AuthDbContext.cs`
- [JWT tokens](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/AuthManagementSubSystem.Repository/Security/JwtTokenService.cs): `AuthManagementSubSystem.Repository/Security/JwtTokenService.cs`

### Order Management

- [Order API](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/OrderManagementSubsystem.Api/Controllers/OrderController.cs): `OrderManagementSubsystem.Api/Controllers/OrderController.cs`
- [Order command handlers](https://github.com/didar-code/testprojectforservicebusandorchestraitor/tree/master/OrderManagementSubsystem.Handler/Commands): `OrderManagementSubsystem.Handler/Commands`
- [Order search](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/OrderManagementSubsystem.Handler/Queries/SearchOrderHandler.cs): `OrderManagementSubsystem.Handler/Queries/SearchOrderHandler.cs`
- [Order repository](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/OrderManagementSubsystem.Repository/Repositories/OrderRepository.cs): `OrderManagementSubsystem.Repository/Repositories/OrderRepository.cs`
- [Order database](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/OrderManagementSubsystem.Repository/Data/AppDbContext.cs): `OrderManagementSubsystem.Repository/Data/AppDbContext.cs`

### Payment Management

- [Payment API](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/PaymentManagementSubSystem.Api/Controllers/PaymentController.cs): `PaymentManagementSubSystem.Api/Controllers/PaymentController.cs`
- [Payment handlers](https://github.com/didar-code/testprojectforservicebusandorchestraitor/tree/master/PaymentManagementSubSystem.Handler/Commands): `PaymentManagementSubSystem.Handler/Commands`
- [Payment queries](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/PaymentManagementSubSystem.Handler/Queries/GetPaymentHandler.cs): `PaymentManagementSubSystem.Handler/Queries/GetPaymentHandler.cs`
- [Payment repository](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/PaymentManagementSubSystem.Repository/Repositories/PaymentRepository.cs): `PaymentManagementSubSystem.Repository/Repositories/PaymentRepository.cs`
- [Payment database](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/PaymentManagementSubSystem.Repository/Data/PaymentDbContext.cs): `PaymentManagementSubSystem.Repository/Data/PaymentDbContext.cs`
- [Payment cache](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/SharedSubSystem/Redis/Caching/RedisCacheService.cs): `SharedSubSystem/Redis/Caching/RedisCacheService.cs`

### Workflow Coordination

- [Orchestrator API](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/OrchestraitorSubSystem.Api/Controllers/OrchestratorController.cs): `OrchestraitorSubSystem.Api/Controllers/OrchestratorController.cs`
- [Order-payment workflow](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/OrchestraitorSubSystem.Handler/Orchestraitators/OrderPaymentOrchestrator.cs): `OrchestraitorSubSystem.Handler/Orchestraitators/OrderPaymentOrchestrator.cs`
- [Service bus](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/ServiceBus/ServiceBus.cs): `ServiceBus/ServiceBus.cs`

### Shared Runtime

- [Command dispatch](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/SharedSubSystem/Generics/ICommandHandler.cs): `SharedSubSystem/Generics/ICommandHandler.cs`
- [Query dispatch](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/SharedSubSystem/Generics/IQueryHandler.cs): `SharedSubSystem/Generics/IQueryHandler.cs`
- [Exception middleware](https://github.com/didar-code/testprojectforservicebusandorchestraitor/blob/master/SharedSubSystem/Middleware/GlobalExceptionMiddleware.cs): `SharedSubSystem/Middleware/GlobalExceptionMiddleware.cs`

### Other components

- **User**

## Connections

- User → Auth API: submits credentials (evidence: `AuthManagementSubSystem.Api/Controllers/AuthController.cs`)
- Auth API → Auth handlers: dispatches commands (evidence: `AuthManagementSubSystem.Api/Controllers/AuthController.cs`)
- Auth API → Login handler: handles login (evidence: `AuthManagementSubSystem.Api/Controllers/AuthController.cs`)
- Login handler → User repository: loads user (evidence: `AuthManagementSubSystem.Handlers/Commands/LoginHandler.cs`)
- Login handler → JWT tokens: generates token (evidence: `AuthManagementSubSystem.Handlers/Commands/LoginHandler.cs`)
- User repository → Auth database: uses context (evidence: `AuthManagementSubSystem.Repository/Repositories/UserRepository.cs`)
- Order API → Order command handlers: dispatches commands (evidence: `OrderManagementSubsystem.Api/Controllers/OrderController.cs`)
- Order API → Order search: runs search (evidence: `OrderManagementSubsystem.Api/Controllers/OrderController.cs`)
- Order search → Order repository: searches orders (evidence: `OrderManagementSubsystem.Handler/Queries/SearchOrderHandler.cs`)
- Order repository → Order database: uses context (evidence: `OrderManagementSubsystem.Repository/Repositories/OrderRepository.cs`)
- Payment API → Payment handlers: dispatches commands (evidence: `PaymentManagementSubSystem.Api/Controllers/PaymentController.cs`)
- Payment API → Payment queries: gets payments (evidence: `PaymentManagementSubSystem.Api/Controllers/PaymentController.cs`)
- Payment queries → Payment repository: reads payments (evidence: `PaymentManagementSubSystem.Handler/Queries/GetPaymentHandler.cs`)
- Payment queries → Payment cache: uses cache (evidence: `PaymentManagementSubSystem.Handler/Queries/GetPaymentHandler.cs`)
- Payment repository → Payment database: uses context (evidence: `PaymentManagementSubSystem.Repository/Repositories/PaymentRepository.cs`)
- Orchestrator API → Order-payment workflow: runs workflow (evidence: `OrchestraitorSubSystem.Api/Controllers/OrchestratorController.cs`)
- Order-payment workflow → Service bus: dispatches commands (evidence: `OrchestraitorSubSystem.Handler/Orchestraitators/OrderPaymentOrchestrator.cs`)
- Service bus → Command dispatch: resolves handler (evidence: `ServiceBus/ServiceBus.cs`)
- Service bus → Payment handlers: dispatches payment
- Service bus → Order command handlers: dispatches order
