BulletsForHumanity.Hermetic
0.5.11
dotnet add package BulletsForHumanity.Hermetic --version 0.5.11
NuGet\Install-Package BulletsForHumanity.Hermetic -Version 0.5.11
<PackageReference Include="BulletsForHumanity.Hermetic" Version="0.5.11" />
<PackageVersion Include="BulletsForHumanity.Hermetic" Version="0.5.11" />
<PackageReference Include="BulletsForHumanity.Hermetic" />
paket add BulletsForHumanity.Hermetic --version 0.5.11
#r "nuget: BulletsForHumanity.Hermetic, 0.5.11"
#:package BulletsForHumanity.Hermetic@0.5.11
#addin nuget:?package=BulletsForHumanity.Hermetic&version=0.5.11
#tool nuget:?package=BulletsForHumanity.Hermetic&version=0.5.11
Hermetic
A domain-driven development kit for event-sourced .NET applications, built fully around source generation.
You declare commands, events, aggregates, and reactions. Hermetic generates the endpoints, the registrations, the projections, the typed Refit clients, and the SignalR observation hub. Compile-time analyzers verify every connection — every event has a handler, every reaction declares its commands, every cycle is detected.
[RaisesEvent<CadetEnrolled>]
public sealed record EnrolCadet(AcademyId AcademyId, CallSign CallSign) : ICommandLaw
{
public sealed class Handler : CommandHandler<EnrolCadet>
{
public override async IAsyncEnumerable<IEffectLaw> Handle(
EnrolCadet cmd, [EnumeratorCancellation] CancellationToken ct)
{
var cadetId = new CadetId(cmd.AcademyId, cmd.CallSign);
yield return new AppendChronicleEffect(
cmd.AcademyId.Value,
new CadetEnrolled(cadetId, cmd.CallSign));
await Task.CompletedTask;
}
}
}
That declaration alone produces:
- A
POST /api/command/enrol-cadetendpoint with FluentValidation,[Requires<>]aggregate loading, event-contract verification, transactional save, and projection / reaction fanout. - A typed Refit extension method on every interface marked
[CommandApiSeal<…>]. - A bus dispatch arm so reactions can issue this command without HTTP.
- An OpenAPI schema entry with the command's events documented.
No reflection, fully trimmable, AOT-compatible.
Why Hermetic
| Problem | Hermetic |
|---|---|
| Event/handler drift over time | Compile-time bidirectional contract — every event has an applier, every command declares its events |
| Direct event-store writes from anywhere | Sealed Chronicle invariant — analyzer forbids session.Events.Append outside generated code |
| Hand-maintained client code that drifts from the server | Typed Refit extensions generated from the same declarations as endpoints |
| Reactions that spawn aggregates by bypassing the pipeline | Three reaction shapes (terminal / command / router); commands cascade through one shared pipeline |
| Untyped identifiers, GUID foreign keys, manual joins | Hierarchical keys — typed paths that encode the full ancestor chain |
| Polling for read-model updates | SignalR observation — projections push to subscribed clients in real time |
Install
dotnet add package BulletsForHumanity.Hermetic
Hermetic ships the runtime contracts together with the analyzers and generators. There is no separate "Logos" package to install.
For domains that need EF Core value converters or Refit extensions, also add:
dotnet add package Marten # the standard event-store backend
dotnet add package Refit # for typed client surfaces
dotnet add package Microsoft.AspNetCore.SignalR.Client # for real-time observation (clients only)
Quick start
The Your First Aggregate guide walks through a complete minimal application in under 15 minutes. It uses the Starwatch Academy domain — a fictional superhero training institution — that all the documentation builds on.
After the first guide:
- Events and Commands — the bidirectional contract in depth.
- Reactions — three shapes, one dispatcher.
- Sealing Your API — typed Refit clients.
- Real-Time Observation — projection updates over SignalR.
Documentation
| Section | What you'll find |
|---|---|
| Concepts | What each Hermetic concept is, why it exists, how to use it |
| Reference | Exhaustive lookups — every attribute, generator, and diagnostic |
| Guides | Step-by-step tutorials building the Starwatch Academy |
| Design | Rationale, philosophy, and open questions |
Technical properties
| Property | Detail |
|---|---|
| Framework | .NET 10 (net10.0); analyzer payload targets netstandard2.0 per Roslyn requirement |
| Backend | Marten (default); EF Core backend in design |
| Reflection | Zero — generated code uses no reflection at runtime |
| Trim / AOT | Fully trimmable, AOT-compatible |
| Telemetry | Built-in HermeticTelemetryScope wraps every endpoint, query, and Refit call |
| Test framework | xUnit v3 + Shouldly + Bogus |
| License | BSL 1.1 |
Status
Hermetic is actively developed alongside an application that uses every concept here. Public surface is intentionally narrow; deep changes (analyzer additions, new sigils) ship behind major version bumps. See version.json for the current release and CHANGELOG for what's shipped.
Contributing
See CONTRIBUTING.md. The project follows Conventional Commits; a commit-msg hook in .githooks/ validates the format. Set it up with:
git config core.hooksPath .githooks
License
Business Source License 1.1. Free to use, view, modify, and run. Production use of competing services is restricted; see the license for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.