# baranacikgoz/modular-monolith-ddd-vsa-webapi architecture

> Architecture diagram of the GitHub repository baranacikgoz/modular-monolith-ddd-vsa-webapi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/baranacikgoz/modular-monolith-ddd-vsa-webapi
- Repository: https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi

## Overview

This is a .NET modular-monolith WebAPI boilerplate. Its user-facing flow is an API request entering the host, passing module endpoint and authorization handling, then brokering identity or domain work to backing services and returning a result. The repository also documents event-driven messaging, inter-module requests, background jobs, persistence, caching, and observability. Some module links below are documented in the README rather than shown in sampled implementation excerpts; those edges cite the README.

Main entry points: [`src/Host/Host/Program.cs`](https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Host/Host/Program.cs) (Web API Host), [`src/Modules/IAM/IAM.Endpoints`](https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/tree/main/src/Modules/IAM/IAM.Endpoints) (Identity Endpoints), [`src/Modules/IAM/IAM.Infrastructure/Auth/KeycloakPermissionAuthorizationHandler.cs`](https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Modules/IAM/IAM.Infrastructure/Auth/KeycloakPermissionAuthorizationHandler.cs) (Permission Authorization), [`src/Modules/Products`](https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/tree/main/src/Modules/Products) (Products)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API Host"]
  node_host["Web API Host<br/>[Program.cs]"]
  node_module_loader["Module Registration<br/>[Setup.Modules.cs]"]
end

subgraph group_identity["Identity and Access"]
  node_iam_endpoints["Identity Endpoints<br/>[IAM.Endpoints]"]
  node_permission_auth["Permission Authorization"]
  node_keycloak_client["Keycloak Admin Client"]
end

subgraph group_modules["Domain Modules"]
  node_products["Products"]
  node_inventory["Inventory"]
  node_notifications["Notifications and OTP"]
end

subgraph group_platform["Shared Infrastructure"]
  node_database[("Relational Database")]
  node_redis[("Redis Cache")]
  node_observability["OpenTelemetry"]
end

subgraph group_messaging["Messaging and Jobs"]
  node_outbox["Transactional Outbox"]
  node_event_dispatch["Event Dispatch<br/>[EventDispatcher.cs]"]
  node_intermodule["Inter-module Requests"]
  node_jobs["Background Jobs"]
end

node_client(("API Client"))
node_keycloak["Keycloak"]
node_rabbitmq["RabbitMQ"]

node_client -->|"sends requests"| node_host
node_host -.->|"registers modules"| node_module_loader
node_module_loader -.->|"loads modules"| node_iam_endpoints
node_iam_endpoints -.->|"checks permissions"| node_permission_auth
node_permission_auth -->|"decides permissions"| node_keycloak
node_iam_endpoints -.->|"brokers identity"| node_keycloak_client
node_keycloak_client -->|"manages identities"| node_keycloak
node_host -.->|"routes module requests"| node_products
node_host -.->|"routes module requests"| node_inventory
node_host -.->|"routes module requests"| node_notifications
node_products -.->|"persists domain data"| node_database
node_inventory -.->|"persists domain data"| node_database
node_notifications -.->|"persists domain data"| node_database
node_permission_auth -->|"caches decisions"| node_redis
node_outbox -.->|"stores messages"| node_database
node_outbox -.->|"delivers messages"| node_event_dispatch
node_event_dispatch -.->|"publishes events"| node_rabbitmq
node_intermodule -->|"requests responses"| node_rabbitmq
node_products -.->|"requests other modules"| node_intermodule
node_jobs -.->|"runs persisted jobs"| node_database
node_host -.->|"exports telemetry"| node_observability

click node_host "https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Host/Host/Program.cs"
click node_module_loader "https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Host/Host/Infrastructure/Setup.Modules.cs"
click node_iam_endpoints "https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/tree/main/src/Modules/IAM/IAM.Endpoints"
click node_permission_auth "https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Modules/IAM/IAM.Infrastructure/Auth/KeycloakPermissionAuthorizationHandler.cs"
click node_keycloak_client "https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Modules/IAM/IAM.Infrastructure/Keycloak/KeycloakAdminClient.cs"
click node_products "https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/tree/main/src/Modules/Products"
click node_inventory "https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/tree/main/src/Modules/Inventory"
click node_notifications "https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/tree/main/src/Modules/Notifications"
click node_outbox "https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Common/Common.Infrastructure/EventBus/IntegrationEventOutbox.cs"
click node_event_dispatch "https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Common/Common.Infrastructure/EventBus/EventDispatcher.cs"
click node_intermodule "https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Common/Common.InterModuleRequests/Contracts/MassTransitInterModuleRequestClient.cs"
click node_jobs "https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Modules/BackgroundJobs/BackgroundJobs/BackgroundJobsService.cs"
click node_observability "https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Host/Host/Infrastructure/Setup.Observability.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_host,node_module_loader,node_client toneBlue
class node_iam_endpoints,node_permission_auth,node_keycloak_client toneAmber
class node_products,node_inventory,node_notifications toneMint
class node_database,node_redis,node_observability toneRose
class node_outbox,node_event_dispatch,node_intermodule,node_jobs,node_keycloak,node_rabbitmq toneIndigo
```

## Components

### API Host

- [Web API Host](https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Host/Host/Program.cs): `src/Host/Host/Program.cs`
- [Module Registration](https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Host/Host/Infrastructure/Setup.Modules.cs): `src/Host/Host/Infrastructure/Setup.Modules.cs`

### Identity and Access

- [Identity Endpoints](https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/tree/main/src/Modules/IAM/IAM.Endpoints): `src/Modules/IAM/IAM.Endpoints`
- [Permission Authorization](https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Modules/IAM/IAM.Infrastructure/Auth/KeycloakPermissionAuthorizationHandler.cs): `src/Modules/IAM/IAM.Infrastructure/Auth/KeycloakPermissionAuthorizationHandler.cs`
- [Keycloak Admin Client](https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Modules/IAM/IAM.Infrastructure/Keycloak/KeycloakAdminClient.cs): `src/Modules/IAM/IAM.Infrastructure/Keycloak/KeycloakAdminClient.cs`

### Domain Modules

- [Products](https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/tree/main/src/Modules/Products): `src/Modules/Products`
- [Inventory](https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/tree/main/src/Modules/Inventory): `src/Modules/Inventory`
- [Notifications and OTP](https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/tree/main/src/Modules/Notifications): `src/Modules/Notifications`

### Shared Infrastructure

- **Relational Database**
- **Redis Cache**
- [OpenTelemetry](https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Host/Host/Infrastructure/Setup.Observability.cs): `src/Host/Host/Infrastructure/Setup.Observability.cs`

### Messaging and Jobs

- [Transactional Outbox](https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Common/Common.Infrastructure/EventBus/IntegrationEventOutbox.cs): `src/Common/Common.Infrastructure/EventBus/IntegrationEventOutbox.cs`
- [Event Dispatch](https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Common/Common.Infrastructure/EventBus/EventDispatcher.cs): `src/Common/Common.Infrastructure/EventBus/EventDispatcher.cs`
- [Inter-module Requests](https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Common/Common.InterModuleRequests/Contracts/MassTransitInterModuleRequestClient.cs): `src/Common/Common.InterModuleRequests/Contracts/MassTransitInterModuleRequestClient.cs`
- [Background Jobs](https://github.com/baranacikgoz/modular-monolith-ddd-vsa-webapi/blob/main/src/Modules/BackgroundJobs/BackgroundJobs/BackgroundJobsService.cs): `src/Modules/BackgroundJobs/BackgroundJobs/BackgroundJobsService.cs`

### Other components

- **API Client**
- **Keycloak**
- **RabbitMQ**

## Connections

- API Client → Web API Host: sends requests (evidence: `README.md`)
- Web API Host → Module Registration: registers modules (evidence: `README.md`)
- Module Registration → Identity Endpoints: loads modules (evidence: `README.md`)
- Identity Endpoints → Permission Authorization: checks permissions (evidence: `README.md`)
- Permission Authorization → Keycloak: decides permissions (evidence: `src/Modules/IAM/IAM.Infrastructure/Auth/KeycloakPermissionAuthorizationHandler.cs`)
- Identity Endpoints → Keycloak Admin Client: brokers identity (evidence: `README.md`)
- Keycloak Admin Client → Keycloak: manages identities (evidence: `src/Modules/IAM/IAM.Infrastructure/Keycloak/KeycloakAdminClient.cs`)
- Web API Host → Products: routes module requests (evidence: `README.md`)
- Web API Host → Inventory: routes module requests (evidence: `README.md`)
- Web API Host → Notifications and OTP: routes module requests (evidence: `README.md`)
- Products → Relational Database: persists domain data (evidence: `README.md`)
- Inventory → Relational Database: persists domain data (evidence: `README.md`)
- Notifications and OTP → Relational Database: persists domain data (evidence: `README.md`)
- Permission Authorization → Redis Cache: caches decisions (evidence: `src/Modules/IAM/IAM.Infrastructure/Auth/KeycloakPermissionAuthorizationHandler.cs`)
- Transactional Outbox → Relational Database: stores messages (evidence: `README.md`)
- Transactional Outbox → Event Dispatch: delivers messages (evidence: `README.md`)
- Event Dispatch → RabbitMQ: publishes events (evidence: `README.md`)
- Inter-module Requests → RabbitMQ: requests responses (evidence: `README.md`)
- Products → Inter-module Requests: requests other modules (evidence: `README.md`)
- Background Jobs → Relational Database: runs persisted jobs (evidence: `README.md`)
- Web API Host → OpenTelemetry: exports telemetry (evidence: `README.md`)
