- Create GRAPH.md: package layers, metadata-driven endpoint flow - Add GRAPH.md maintenance rule to CLAUDE.md Co-Authored-By: Svrnty Inc. <eng@svrnty.com>
58 lines
3.7 KiB
Markdown
58 lines
3.7 KiB
Markdown
╔══════════════════════════════════════════════════════════╗
|
|
║ dotnet-cqrs Architecture ║
|
|
╚══════════════════════════════════════════════════════════╝
|
|
|
|
PACKAGE LAYERS
|
|
══════════════
|
|
|
|
┌─────────────────────────────────────────────────────┐
|
|
│ Abstractions (Interfaces) │
|
|
│ ICommandHandler<T> IQueryHandler<T,R> │
|
|
│ ICommandDiscovery IQueryDiscovery │
|
|
│ IDynamicQuery<S,D> IQueryableProvider<S> │
|
|
└─────────────────────────┬───────────────────────────┘
|
|
│ implements
|
|
┌─────────────────────────▼───────────────────────────┐
|
|
│ Core Implementation │
|
|
│ CQRS (discovery + dispatch) │
|
|
│ DynamicQuery (OData-like filter/sort/group) │
|
|
│ FluentValidation (validators → RFC 7807 errors) │
|
|
└─────────────────────────┬───────────────────────────┘
|
|
│ exposes via
|
|
┌─────────────────────────▼───────────────────────────┐
|
|
│ Protocol / Transport │
|
|
│ MinimalApi ─── HTTP endpoints (auto-mapped) │
|
|
│ Grpc ───────── gRPC endpoints (source-generated) │
|
|
│ Grpc.Generators ── compile-time codegen │
|
|
└─────────────────────────┬───────────────────────────┘
|
|
│ optional
|
|
┌─────────────────────────▼───────────────────────────┐
|
|
│ Extended Features │
|
|
│ Events + Events.RabbitMQ ── event sourcing │
|
|
│ Sagas + Sagas.RabbitMQ ─── long-running txns │
|
|
│ DynamicQuery.EF ────────── Entity Framework │
|
|
│ Notifications ──────────── real-time push │
|
|
└─────────────────────────────────────────────────────┘
|
|
|
|
|
|
METADATA-DRIVEN ENDPOINT FLOW
|
|
══════════════════════════════
|
|
|
|
Developer writes handler:
|
|
ICommandHandler<CreatePersonCommand, PersonResult>
|
|
│
|
|
▼
|
|
DI registration (AddSvrntyCqrs)
|
|
│
|
|
▼
|
|
Discovery auto-enumerates all handlers
|
|
│
|
|
▼
|
|
┌────┴────────────────────┐
|
|
│ │
|
|
▼ ▼
|
|
HTTP: MapSvrntyCommands() gRPC: Source Generator
|
|
POST /api/command/ CommandServiceImpl
|
|
createPerson QueryServiceImpl
|
|
(compile-time generated)
|