82 lines
2.6 KiB
Markdown
82 lines
2.6 KiB
Markdown
# Svrnty.CQRS
|
|
|
|
> Modern CQRS framework for .NET with gRPC source generation and HTTP Minimal API support.
|
|
|
|
## Where This Fits
|
|
|
|
**Layer**: libs
|
|
**Depends on**: Nothing (standalone .NET framework)
|
|
**Depended on by**: a-gent-app (backend services), flutter-cqrs-datasource (client)
|
|
**Git**: git.openharbor.io/svrnty/dotnet-cqrs.git
|
|
|
|
## Tech Stack
|
|
|
|
- **Language**: C# 14 / .NET 10
|
|
- **Framework**: ASP.NET Core Minimal API, gRPC
|
|
- **Key Dependencies**: FluentValidation 11.x, Grpc.AspNetCore, PoweredSoft.DynamicQuery
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
# Build
|
|
dotnet build
|
|
|
|
# Run
|
|
dotnet run --project Svrnty.Sample
|
|
|
|
# Test
|
|
dotnet test
|
|
```
|
|
|
|
## Architecture
|
|
|
|
18 NuGet packages organized by concern:
|
|
|
|
- **Abstractions**: Core interfaces (ICommandHandler, IQueryHandler, IDomainEvent, ISaga, INotificationPublisher)
|
|
- **Core**: Discovery, registration, handler execution, CqrsBuilder fluent API
|
|
- **MinimalApi**: HTTP endpoint mapping with RFC 7807 validation
|
|
- **Grpc**: gRPC service support with Google Rich Error Model
|
|
- **Grpc.Generators**: Roslyn source generator for .proto files and service implementations
|
|
- **DynamicQuery**: PoweredSoft integration for filtering, sorting, paging (with EF Core support)
|
|
- **FluentValidation**: Validator registration helpers
|
|
- **Events**: Domain event publishing (with RabbitMQ transport)
|
|
- **Sagas**: Saga orchestration pattern with compensation and distributed execution (with RabbitMQ transport)
|
|
- **Notifications**: Real-time notification streaming (with gRPC transport)
|
|
|
|
See [docs/ARCHITECTURE.md](./docs/ARCHITECTURE.md) for a full dependency diagram and data flow.
|
|
|
|
## Configuration
|
|
|
|
```csharp
|
|
// Register handlers
|
|
builder.Services.AddCommand<CreateUserCommand, int, CreateUserCommandHandler>();
|
|
builder.Services.AddQuery<GetUserQuery, User, GetUserQueryHandler>();
|
|
|
|
// Configure CQRS with gRPC + HTTP
|
|
builder.Services.AddSvrntyCqrs(cqrs =>
|
|
{
|
|
cqrs.AddGrpc(grpc => grpc.EnableReflection());
|
|
cqrs.AddMinimalApi();
|
|
});
|
|
|
|
app.UseSvrntyCqrs();
|
|
```
|
|
|
|
## Documentation
|
|
|
|
- [Architecture](./docs/ARCHITECTURE.md) -- Package dependency graph, CQRS data flows, separation of concerns
|
|
- [Package Index](./docs/PACKAGE_INDEX.md) -- Per-package reference with key types and dependencies
|
|
- [Getting Started](./docs/GETTING_STARTED.md) -- Step-by-step guide covering commands, queries, gRPC, DynamicQuery, events, sagas, and notifications
|
|
|
|
## Related Libraries
|
|
|
|
- **[flutter_cqrs_datasource](https://git.openharbor.io/svrnty/flutter_cqrs_datasource)** -- Flutter/Dart counterpart for consuming Svrnty.CQRS services from mobile and desktop apps
|
|
|
|
## Contributing
|
|
|
|
See [CLAUDE.md](./CLAUDE.md) for development guidelines.
|
|
|
|
## License
|
|
|
|
MIT OR Apache-2.0
|