# karthikeyan-1234/wolverineunifieddemo architecture

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

- Interactive diagram: https://gitdiagram.com/karthikeyan-1234/wolverineunifieddemo
- Repository: https://github.com/karthikeyan-1234/wolverineunifieddemo

## Overview

#### Purpose and Solution Shape
`WolverineUnifiedDemo.slnx` is a .NET solution demonstrating a producer/consumer messaging workflow using Wolverine-style message handlers. It has three application projects: an HTTP host, a producer persistence component, and a consumer persistence/handler component, with event contracts shared separately.

#### HTTP Entry Point
The host is the executable boundary and likely bootstraps dependency injection, transport, and application services:
- `Host/Program.cs`
- `Host/Controllers/ProducerController.cs`
- `Host/01_Host.csproj`

`ProducerController` is the business-facing HTTP ingress: requests are expected to create or dispatch producer-side lead events. `WeatherForecastController` is template/sample HTTP surface rather than core workflow:
- `Host/Controllers/WeatherForecastController.cs`
- `Host/WeatherForecast.cs`

#### Shared Message Contract Boundary
`Shared` isolates cross-project event types so producer and consumer do not depend on each other directly:
- `Shared/Events.cs`
- `Shared/Shared.csproj`

Events defined here are the durable integration contract. Changes to these types affect dispatching and all handlers across the producer/consumer boundary.

#### Producer Stage
The producer owns the source-lead model and a dedicated EF Core-style data context:
- `Producer/Models/srcLead.cs`
- `Producer/ProducerDbContext.cs`
- `Producer/02_Producer.csproj`

The expected flow is HTTP command/input → producer model and database persistence → publication of a shared event. Keeping `srcLead` separate from consumer models establishes an ownership boundary between source data and downstream projections.

#### Consumer Stage and Event Reactions
The consumer receives shared events and materializes its own lead representation:
- `Consumer/Handlers/LeadCreatedHandler.cs`
- `Consumer/Handlers/SecondaryLeadCreatedHandler.cs`
- `Consumer/Models/trgtLead.cs`

Two handlers indicate fan-out or multiple reactions to the same lead-created event. The consumer owns its persistence boundary through:
- `Consumer/ConsumerDbContext.cs`
- `Consumer/03_Consumer.csproj`

Handlers should be treated as asynchronous integration endpoints: they translate the shared event into consumer-owned state or secondary processing, rather than exposing producer entities directly.

#### Primary Control and Data Flow
1. An HTTP caller reaches `Host/Controllers/ProducerController.cs`.
2. Host wiring in `Host/Program.cs` resolves producer/database/message infrastructure.
3. Producer data is represented by `Producer/Models/srcLead.cs` and persisted through `Producer/ProducerDbContext.cs`.
4. A contract from `Shared/Events.cs` is dispatched through the messaging runtime.
5. Consumer handlers receive the event and update consumer-owned state using `Consumer/Models/trgtLead.cs` and `Consumer/ConsumerDbContext.cs`.
6. `SecondaryLeadCreatedHandler` provides an additional downstream reaction without changing the HTTP producer API.

#### Runtime and Infrastructure Boundaries
The repository is a .NET/C# solution with separate project assemblies for host, producer, consumer, and contracts. ASP.NET Core controller hosting is indicated by `Host/Program.cs` and `Host/Controllers`. EF Core-style persistence is indicated by the two `DbContext` classes. Messaging configuration and service registration are expected in the host startup/configuration boundary:
- `Host/Program.cs`
- `Host/appsettings.json`
- `Host/appsettings.Development.json`

No specific database engine, broker, or external service is identifiable from the supplied tree; those details would be determined by project dependencies and host configuration.

Main entry points: [`Host/Program.cs`](https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Host/Program.cs) (Host Startup), [`Host/Controllers/ProducerController.cs`](https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Host/Controllers/ProducerController.cs) (Producer Controller), [`Shared/Events.cs`](https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Shared/Events.cs) (Lead Events), [`Producer/Models/srcLead.cs`](https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Producer/Models/srcLead.cs) (Source Lead)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["HTTP Host"]
  node_host_program["Host Startup<br/>ASP.NET Core host<br/>[Program.cs]"]
  node_producer_controller["Producer Controller<br/>HTTP controller"]
  node_messaging_runtime["Messaging Runtime<br/>Wolverine transport<br/>[Program.cs]"]
end

subgraph group_producer["Producer"]
  node_source_lead["Source Lead<br/>producer model<br/>[srcLead.cs]"]
  node_producer_db_context[("Producer DbContext<br/>EF Core context")]
end

subgraph group_contracts["Shared Contracts"]
  node_shared_events["Lead Events<br/>message contracts<br/>[Events.cs]"]
end

subgraph group_consumer["Consumer"]
  node_lead_created_handler["Lead Created Handler<br/>event handler"]
  node_secondary_handler["Secondary Lead Handler<br/>event handler"]
  node_target_lead["Target Lead<br/>consumer model<br/>[trgtLead.cs]"]
  node_consumer_db_context[("Consumer DbContext<br/>EF Core context")]
end

node_http_caller(("HTTP Caller<br/>external client"))

node_http_caller -->|"HTTP request"| node_producer_controller
node_host_program -->|"hosts"| node_producer_controller
node_host_program -->|"configures"| node_producer_db_context
node_host_program -->|"configures"| node_consumer_db_context
node_host_program -->|"configures"| node_messaging_runtime
node_producer_controller -->|"creates"| node_source_lead
node_source_lead -->|"persists"| node_producer_db_context
node_producer_controller -->|"publishes"| node_shared_events
node_shared_events -->|"dispatches"| node_messaging_runtime
node_messaging_runtime -->|"delivers event"| node_lead_created_handler
node_messaging_runtime -->|"fan-out"| node_secondary_handler
node_lead_created_handler -->|"maps to"| node_target_lead
node_target_lead -->|"persists"| node_consumer_db_context
node_secondary_handler -.->|"handles contract"| node_shared_events

click node_host_program "https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Host/Program.cs"
click node_producer_controller "https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Host/Controllers/ProducerController.cs"
click node_source_lead "https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Producer/Models/srcLead.cs"
click node_producer_db_context "https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Producer/ProducerDbContext.cs"
click node_shared_events "https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Shared/Events.cs"
click node_messaging_runtime "https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Host/Program.cs"
click node_lead_created_handler "https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Consumer/Handlers/LeadCreatedHandler.cs"
click node_secondary_handler "https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Consumer/Handlers/SecondaryLeadCreatedHandler.cs"
click node_target_lead "https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Consumer/Models/trgtLead.cs"
click node_consumer_db_context "https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Consumer/ConsumerDbContext.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_program,node_producer_controller,node_messaging_runtime toneBlue
class node_source_lead,node_producer_db_context toneAmber
class node_shared_events toneMint
class node_lead_created_handler,node_secondary_handler,node_target_lead,node_consumer_db_context toneRose
class node_http_caller toneNeutral
```

## Components

### HTTP Host

- [Host Startup](https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Host/Program.cs): ASP.NET Core host · Bootstraps DI, persistence, and messaging. · `Host/Program.cs`
- [Producer Controller](https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Host/Controllers/ProducerController.cs): HTTP controller · Core HTTP ingress for lead creation. · `Host/Controllers/ProducerController.cs`
- [Messaging Runtime](https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Host/Program.cs): Wolverine transport · Dispatches shared events to asynchronous handlers. · `Host/Program.cs`

### Producer

- [Source Lead](https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Producer/Models/srcLead.cs): producer model · `Producer/Models/srcLead.cs`
- [Producer DbContext](https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Producer/ProducerDbContext.cs): EF Core context · Producer-owned persistence boundary. · `Producer/ProducerDbContext.cs`

### Shared Contracts

- [Lead Events](https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Shared/Events.cs): message contracts · Durable producer-consumer integration contract. · `Shared/Events.cs`

### Consumer

- [Lead Created Handler](https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Consumer/Handlers/LeadCreatedHandler.cs): event handler · Materializes consumer-owned lead state. · `Consumer/Handlers/LeadCreatedHandler.cs`
- [Secondary Lead Handler](https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Consumer/Handlers/SecondaryLeadCreatedHandler.cs): event handler · Additional reaction to the lead-created event. · `Consumer/Handlers/SecondaryLeadCreatedHandler.cs`
- [Target Lead](https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Consumer/Models/trgtLead.cs): consumer model · `Consumer/Models/trgtLead.cs`
- [Consumer DbContext](https://github.com/karthikeyan-1234/wolverineunifieddemo/blob/master/Consumer/ConsumerDbContext.cs): EF Core context · Consumer-owned persistence boundary. · `Consumer/ConsumerDbContext.cs`

### Other components

- **HTTP Caller**: external client

## Connections

- HTTP Caller → Producer Controller: HTTP request
- Host Startup → Producer Controller: hosts
- Host Startup → Producer DbContext: configures
- Host Startup → Consumer DbContext: configures
- Host Startup → Messaging Runtime: configures
- Producer Controller → Source Lead: creates
- Source Lead → Producer DbContext: persists
- Producer Controller → Lead Events: publishes
- Lead Events → Messaging Runtime: dispatches
- Messaging Runtime → Lead Created Handler: delivers event
- Messaging Runtime → Secondary Lead Handler: fan-out
- Lead Created Handler → Target Lead: maps to
- Target Lead → Consumer DbContext: persists
- Secondary Lead Handler → Lead Events: handles contract
