# daxnet/apworks-core architecture

> Architecture diagram of the GitHub repository daxnet/apworks-core, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/daxnet/apworks-core
- Repository: https://github.com/daxnet/apworks-core

## Overview

Apworks Core is a .NET application framework for layered and event-driven CQRS applications. A representative user-facing workflow is an HTTP client calling the ASP.NET Core data service: query and sort text is parsed, the controller accesses aggregates through a repository, and changes are committed through its context. The tree also documents building blocks for event sourcing, messaging, snapshots, persistence adapters, and HAL responses. Repository-context behavior and parts of the HTTP/query workflow are sampled; other connections are included only where their role is explicit in the named components.

Main entry points: [`src/Apworks.Integration.AspNetCore/DataServices/DataServiceController.cs`](https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Integration.AspNetCore/DataServices/DataServiceController.cs) (Data service), [`src/Apworks/Repositories/EventSourcingDomainRepository.cs`](https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Repositories/EventSourcingDomainRepository.cs) (Event-sourcing repository), [`src/Apworks/Repositories/RepositoryContext.cs`](https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Repositories/RepositoryContext.cs) (Repository context), [`src/Apworks/Messaging/MessageBus.cs`](https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Messaging/MessageBus.cs) (Message bus)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["ASP.NET Core"]
  node_controller["Data service"]
  node_registration["Fluent configuration"]
  node_hal["HAL responses"]
  node_servicehandlers["DI handler execution"]
end

subgraph group_domain["Domain and CQRS"]
  node_domainrepo["Domain repository"]
  node_aggregate["Event-sourced aggregate"]
  node_command["Command contracts<br/>[ICommandBus.cs]"]
  node_eventrepo["Event-sourcing repository"]
  node_snapshot["Snapshots"]
end

subgraph group_data["Persistence"]
  node_repository["Repository contracts<br/>[IRepository.cs]"]
  node_context["Repository context"]
  node_adapters["Storage adapters"]
  node_eventadapters["Event-store adapters"]
end

subgraph group_events["Events and Messaging"]
  node_commandbus["Command bus"]
  node_eventpub["Event publishing<br/>[IEventPublisher.cs]"]
  node_eventstore["Event store<br/>[IEventStore.cs]"]
  node_messagebus["Message bus<br/>[MessageBus.cs]"]
  node_rabbit["RabbitMQ buses"]
  node_handlercontext["Handler execution"]
end

subgraph group_query["Querying and HAL"]
  node_condition["Condition parser"]
  node_sort["Sort parser"]
end

node_client(("HTTP client"))

node_client -->|"sends HTTP"| node_controller
node_controller -->|"parses query"| node_condition
node_controller -->|"parses sort"| node_sort
node_controller -->|"queries and mutates"| node_repository
node_controller -->|"commits changes"| node_context
node_context -->|"creates and caches"| node_repository
node_context -.->|"implemented by"| node_adapters
node_aggregate -.->|"uses event sourcing"| node_eventrepo
node_eventrepo -.->|"stores events"| node_eventstore
node_eventrepo -.->|"supports snapshots"| node_snapshot
node_eventrepo -->|"specializes repository"| node_domainrepo
node_command -.->|"dispatched through"| node_commandbus
node_eventpub -.->|"publishes events"| node_messagebus
node_messagebus -.->|"dispatches handling"| node_handlercontext
node_servicehandlers -->|"extends execution"| node_handlercontext
node_rabbit -.->|"provides transport"| node_messagebus
node_eventstore -.->|"implemented by"| node_eventadapters
node_registration -.->|"configures services"| node_controller
node_hal -.->|"formats responses"| node_controller

click node_controller "https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Integration.AspNetCore/DataServices/DataServiceController.cs"
click node_registration "https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Integration.AspNetCore/Configuration/ApworksConfigurator.cs"
click node_hal "https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Integration.AspNetCore/Hal/HalBuildConfiguration.cs"
click node_domainrepo "https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Repositories/DomainRepository.cs"
click node_aggregate "https://github.com/daxnet/apworks-core/blob/master/src/Apworks/AggregateRootWithEventSourcing.cs"
click node_command "https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Commands/ICommandBus.cs"
click node_commandbus "https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Messaging.Simple/SimpleCommandBus.cs"
click node_eventpub "https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Events/IEventPublisher.cs"
click node_eventstore "https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Events/IEventStore.cs"
click node_eventrepo "https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Repositories/EventSourcingDomainRepository.cs"
click node_snapshot "https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Snapshots/ISnapshotProvider.cs"
click node_messagebus "https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Messaging/MessageBus.cs"
click node_rabbit "https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Messaging.RabbitMQ/RabbitMessageBus.cs"
click node_handlercontext "https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Messaging/MessageHandlerExecutionContext.cs"
click node_servicehandlers "https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Integration.AspNetCore/Messaging/ServiceProviderMessageHandlerExecutionContext.cs"
click node_repository "https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Repositories/IRepository.cs"
click node_context "https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Repositories/RepositoryContext.cs"
click node_adapters "https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Repositories.EntityFramework/EntityFrameworkRepositoryContext.cs"
click node_eventadapters "https://github.com/daxnet/apworks-core/blob/master/src/Apworks.EventStore.AdoNet/AdoNetEventStore.cs"
click node_condition "https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Querying.Parsers.Irony/IronyQueryConditionParser.cs"
click node_sort "https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Querying.Parsers.Irony/IronySortSpecificationParser.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_registration,node_hal,node_servicehandlers,node_client toneBlue
class node_domainrepo,node_aggregate,node_command,node_eventrepo,node_snapshot toneAmber
class node_repository,node_context,node_adapters,node_eventadapters toneMint
class node_commandbus,node_eventpub,node_eventstore,node_messagebus,node_rabbit,node_handlercontext toneRose
class node_condition,node_sort toneIndigo
```

## Components

### ASP.NET Core

- [Data service](https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Integration.AspNetCore/DataServices/DataServiceController.cs): `src/Apworks.Integration.AspNetCore/DataServices/DataServiceController.cs`
- [Fluent configuration](https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Integration.AspNetCore/Configuration/ApworksConfigurator.cs): `src/Apworks.Integration.AspNetCore/Configuration/ApworksConfigurator.cs`
- [HAL responses](https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Integration.AspNetCore/Hal/HalBuildConfiguration.cs): `src/Apworks.Integration.AspNetCore/Hal/HalBuildConfiguration.cs`
- [DI handler execution](https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Integration.AspNetCore/Messaging/ServiceProviderMessageHandlerExecutionContext.cs): `src/Apworks.Integration.AspNetCore/Messaging/ServiceProviderMessageHandlerExecutionContext.cs`

### Domain and CQRS

- [Domain repository](https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Repositories/DomainRepository.cs): `src/Apworks/Repositories/DomainRepository.cs`
- [Event-sourced aggregate](https://github.com/daxnet/apworks-core/blob/master/src/Apworks/AggregateRootWithEventSourcing.cs): `src/Apworks/AggregateRootWithEventSourcing.cs`
- [Command contracts](https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Commands/ICommandBus.cs): `src/Apworks/Commands/ICommandBus.cs`
- [Event-sourcing repository](https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Repositories/EventSourcingDomainRepository.cs): `src/Apworks/Repositories/EventSourcingDomainRepository.cs`
- [Snapshots](https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Snapshots/ISnapshotProvider.cs): `src/Apworks/Snapshots/ISnapshotProvider.cs`

### Persistence

- [Repository contracts](https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Repositories/IRepository.cs): `src/Apworks/Repositories/IRepository.cs`
- [Repository context](https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Repositories/RepositoryContext.cs): `src/Apworks/Repositories/RepositoryContext.cs`
- [Storage adapters](https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Repositories.EntityFramework/EntityFrameworkRepositoryContext.cs): `src/Apworks.Repositories.EntityFramework/EntityFrameworkRepositoryContext.cs`
- [Event-store adapters](https://github.com/daxnet/apworks-core/blob/master/src/Apworks.EventStore.AdoNet/AdoNetEventStore.cs): `src/Apworks.EventStore.AdoNet/AdoNetEventStore.cs`

### Events and Messaging

- [Command bus](https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Messaging.Simple/SimpleCommandBus.cs): `src/Apworks.Messaging.Simple/SimpleCommandBus.cs`
- [Event publishing](https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Events/IEventPublisher.cs): `src/Apworks/Events/IEventPublisher.cs`
- [Event store](https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Events/IEventStore.cs): `src/Apworks/Events/IEventStore.cs`
- [Message bus](https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Messaging/MessageBus.cs): `src/Apworks/Messaging/MessageBus.cs`
- [RabbitMQ buses](https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Messaging.RabbitMQ/RabbitMessageBus.cs): `src/Apworks.Messaging.RabbitMQ/RabbitMessageBus.cs`
- [Handler execution](https://github.com/daxnet/apworks-core/blob/master/src/Apworks/Messaging/MessageHandlerExecutionContext.cs): `src/Apworks/Messaging/MessageHandlerExecutionContext.cs`

### Querying and HAL

- [Condition parser](https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Querying.Parsers.Irony/IronyQueryConditionParser.cs): `src/Apworks.Querying.Parsers.Irony/IronyQueryConditionParser.cs`
- [Sort parser](https://github.com/daxnet/apworks-core/blob/master/src/Apworks.Querying.Parsers.Irony/IronySortSpecificationParser.cs): `src/Apworks.Querying.Parsers.Irony/IronySortSpecificationParser.cs`

### Other components

- **HTTP client**

## Connections

- HTTP client → Data service: sends HTTP
- Data service → Condition parser: parses query
- Data service → Sort parser: parses sort
- Data service → Repository contracts: queries and mutates
- Data service → Repository context: commits changes
- Repository context → Repository contracts: creates and caches
- Repository context → Storage adapters: implemented by
- Event-sourced aggregate → Event-sourcing repository: uses event sourcing
- Event-sourcing repository → Event store: stores events
- Event-sourcing repository → Snapshots: supports snapshots
- Event-sourcing repository → Domain repository: specializes repository
- Command contracts → Command bus: dispatched through
- Event publishing → Message bus: publishes events
- Message bus → Handler execution: dispatches handling
- DI handler execution → Handler execution: extends execution
- RabbitMQ buses → Message bus: provides transport
- Event store → Event-store adapters: implemented by
- Fluent configuration → Data service: configures services
- HAL responses → Data service: formats responses
