KnOwl is a set of reusable .NET libraries for designing, versioning, promoting, distributing, and consuming async contract metadata. It gives teams a Control Plane where contracts are authored and released, plus a Runtime surface where deployed contracts can be consumed by running services.
The goal is to keep product hosts thin. Your app owns the executable project, configuration, and EF migrations; KnOwl packages provide the domain model, application services, storage adapters, Razor UI, catalog endpoints, distribution endpoints, and runtime synchronization behavior.
- Design event and command contracts with versioned payload schemas.
- Model commands with a required request schema and optional reply schema.
- Promote versions through lifecycle states and generate immutable artifacts.
- Distribute deployed artifacts from a Control Plane to one or more Runtime hosts.
- Expose deployed schemas through split event and command catalog endpoints.
- Keep host-specific database migrations outside the reusable NuGet libraries.
Install only the layer your host needs:
| Package | Purpose |
|---|---|
KnOwl.Contracts |
Shared DTOs for artifacts, delivery, catalog responses, and security. |
KnOwl.ControlPlane |
Control Plane domain model and repository contracts. |
KnOwl.ControlPlane.Application |
Control Plane services for design, lifecycle, artifacts, releases, and delivery. |
KnOwl.ControlPlane.Storage.EntityFramework |
EF Core storage for Control Plane state. |
KnOwl.ControlPlane.WebUI |
Reusable Razor UI for Control Plane hosts. |
KnOwl.ControlPlane.Bootstrap |
ASP.NET Core composition for Control Plane hosts. |
KnOwl.Runtime |
Runtime domain model and repository contracts. |
KnOwl.Runtime.Application |
Runtime catalog, deployment, pull, and security services. |
KnOwl.Runtime.Storage.EntityFramework |
EF Core storage for Runtime state. |
KnOwl.Runtime.WebUI |
Reusable Razor UI for Runtime hosts. |
KnOwl.Runtime.Bootstrap |
ASP.NET Core composition for Runtime hosts. |
All packages target net9.0 and net10.0.
dotnet new web -n MyCompany.Contracts.ControlPlane
cd MyCompany.Contracts.ControlPlane
dotnet add package KnOwl.ControlPlane.Bootstrap
dotnet add package KnOwl.ControlPlane.Storage.EntityFrameworkUse the bootstrap package in Program.cs:
using KnOwl.ControlPlane.Bootstrap;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddKnOwlControlPlane(
builder.Configuration,
options => options.MigrationsAssembly = typeof(Program).Assembly.GetName().Name);
var app = builder.Build();
app.MapKnOwlControlPlane();
app.Run();Add configuration:
{
"ConnectionStrings": {
"KnOwlDb": "Server=localhost;Database=KnOwlControlPlane;Trusted_Connection=True;TrustServerCertificate=True"
}
}Create migrations in the host project:
dotnet ef migrations add InitialKnOwlControlPlane `
--context KnOwlDbContext `
--output-dir Migrations
dotnet ef database update --context KnOwlDbContextRun the host and open the Control Plane UI. From there you can create data types, custom metadata fields, events, commands, versions, artifacts, runtime environments, runtime nodes, and releases.
dotnet new web -n MyCompany.Contracts.Runtime
cd MyCompany.Contracts.Runtime
dotnet add package KnOwl.Runtime.Bootstrap
dotnet add package KnOwl.Runtime.Storage.EntityFrameworkUse the runtime bootstrap in Program.cs:
using KnOwl.Runtime.Bootstrap;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddKnOwlRuntime(
builder.Configuration,
options => options.MigrationsAssembly = typeof(Program).Assembly.GetName().Name);
var app = builder.Build();
app.MapKnOwlRuntime();
app.Run();Add configuration:
{
"ConnectionStrings": {
"KnOwlRuntimeDb": "Server=localhost;Database=KnOwlRuntime;Trusted_Connection=True;TrustServerCertificate=True"
},
"Runtime": {
"ArtifactPull": {
"Enabled": true,
"InitialDelaySeconds": 5,
"IntervalSeconds": 30
}
}
}Create runtime migrations in the host project:
dotnet ef migrations add InitialKnOwlRuntime `
--context KnOwlRuntimeDbContext `
--output-dir Migrations/RuntimeStorage
dotnet ef database update --context KnOwlRuntimeDbContext- In the Runtime UI, create a Control Plane connection.
- Generate or import the connection credentials.
- In the Control Plane UI, register the Runtime node and credentials.
- Release deployed artifacts from the Control Plane.
- Let the Runtime pull pending artifacts, or push artifacts to the Runtime delivery endpoint.
The sample hosts show the intended shape:
samples/KnOwl.ControlPlaneHost.Samplesamples/KnOwl.RuntimeHost.Sample
Control Plane hosts expose deployed source artifacts only when their artifact status is deployed:
GET /contracts/artifactsGET /contracts/events/{eventKey}/versions/{versionNumber}GET /contracts/commands/{commandKey}/versions/{versionNumber}
Runtime hosts expose deployed local artifacts:
GET /runtime/contracts/artifactsGET /runtime/contracts/events/{eventKey}/versions/{versionNumber}GET /runtime/contracts/commands/{commandKey}/versions/{versionNumber}
Event responses return one artifact. Command responses return both sides of the command version:
{
"commandKey": "inventories.reserve",
"version": "1.0.0",
"requestArtifact": {
"artifactType": "CommandRequest",
"payloadSchema": {}
},
"replyArtifact": {
"artifactType": "CommandReply",
"payloadSchema": {}
}
}replyArtifact is optional. Request artifacts are required.
Build and test:
dotnet restore KnOwl.slnx
dotnet build KnOwl.slnx --no-restore --configuration Release
dotnet test KnOwl.slnx --no-build --configuration ReleasePack the libraries:
Get-ChildItem src -Recurse -Filter *.csproj | ForEach-Object {
dotnet pack $_.FullName --configuration Release -o artifacts/packages
}Run the distribution end-to-end test. This starts SQL Server in Docker, runs the Control Plane and Runtime samples, and validates SQL Server storage plus push/pull artifact distribution for both target frameworks.
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/run-knowl-distribution-e2e.ps1The release workflow builds, tests, packs, creates the GitHub release, and publishes NuGet packages. Production releases are driven by .release and CHANGELOG.md.
Current release: 1.0.0