The Chronicle Web template
The cratis-chronicle-web template is a minimal ASP.NET Core application connected to Chronicle. It is deliberately small: two endpoints, one event, one projection. You get the server-side skeleton without Arc, without a frontend, and without anything else in the way.
dotnet new cratis-chronicle-web -n MyApiYou need the .NET 10 SDK and Docker with the Compose plugin.
Options
Section titled “Options”| Option | Values | Default |
|---|---|---|
--Database | MongoDB, PostgreSQL, MsSql, SQLite | MongoDB |
--Framework | net10.0 | net10.0 |
--SkipAiUpdateInstructions | true, false | false |
The template scaffolds a Chronicle client. --Database changes only where the Chronicle kernel in docker-compose.yml stores its data.
What you get
Section titled “What you get”Program.cs wires Chronicle into ASP.NET Core and maps two minimal API endpoints. This is the top of the file; the TestEvent, TestProjection, and TestReactor types follow below it:
var builder = WebApplication.CreateBuilder(args) .AddCratisChronicle();
var app = builder.Build();
app.UseCratisChronicle();
app.MapGet("/", (IEventLog log) => log.Append(Guid.NewGuid().ToString(), new TestEvent("Hello, Chronicle!")));app.MapGet("/projection", (IReadModels readModels) => readModels.GetInstances<TestProjection>());
await app.RunAsync();appsettings.json names the event store after your project and connects to the local development kernel with the development client credentials.
Run it
Section titled “Run it”Start the infrastructure and the app:
docker compose up -ddotnet runThe app listens on http://localhost:5000. In another terminal, call the two endpoints:
curl http://localhost:5000/ # appends a TestEvent to the logcurl http://localhost:5000/projection # reads the projected read modelThe first call returns the append result with "isSuccess":true, and the app logs Received event with message: Hello, Chronicle! from the reactor. The second returns every projected instance, for example [{"message":"Hello, Chronicle!","eventSource":"…"}].
The sample appends on a GET to keep the demo to one curl. Use POST for anything that changes state in your own endpoints.
What it is for
Section titled “What it is for”Use this template when you know you want Chronicle inside an ASP.NET Core service and you would rather grow the application yourself. When you want model-bound commands and queries with routes and TypeScript proxies handled for you, use the Cratis Web Application template.
AI assistance
Section titled “AI assistance”The scaffolded project includes a .cratis/ai.json selecting the cratis/application/chronicle-dotnet profile with the C# language. Make sure the Cratis CLI is installed, then run:
cratis ai updateThat installs the AI rules, skills, and harness integration for the selected coding agents (AGENTS.md plus .claude/, .cursor/, .github/, .opencode/, and .pi/) and records what it installed in .cratis/ai.manifest.json. dotnet new prints this reminder after scaffolding; cratis new runs the update for you. Running it again refreshes only Cratis-managed files. See the CLI AI documentation for the full command reference.