Skip to content

Release v1.2.0

Choose a tag to compare

@github-actions github-actions released this 12 Apr 08:19
7b88bfc

Adds a new cratis-aspire dotnet template that extends the existing cratis template with .NET Aspire orchestration, a Chronicle Aspire resource integration, and shared infrastructure defaults.

New template: cratis-aspire

dotnet new cratis-aspire -n MyApp

Generates a three-project solution:

Project Role
MyApp/ Cratis Arc + Chronicle web app (same vertical-slice structure as cratis)
MyApp.Composition/ Aspire AppHost — orchestrates Chronicle + backend
MyApp.Infrastructure/ Service defaults — OpenTelemetry, health checks, service discovery

Composition (AppHost)

Wires Chronicle as an Aspire resource using Cratis.Chronicle.Aspire (the forthcoming package from Chronicle#2798):

var chronicle = builder.AddCratisChronicle();

builder.AddProject<Projects.MyApp_MyApp>("backend")
    .WithReference(chronicle)
    .WaitFor(chronicle);

Infrastructure (ServiceDefaults)

Provides AddServiceDefaults() and MapDefaultEndpoints() extensions consumed by the main app — covering OTLP export, metrics/tracing instrumentation, HTTP resilience, and service discovery. Chronicle and MongoDB connection strings are omitted from appsettings.json; Aspire injects them at runtime.

Template mechanics

  • Three GUIDs generated for the solution file (ProjectGuid, CompositionGuid, InfrastructureGuid)
  • sourceName: CratisAspire handles directory, file, and namespace renaming across all three projects
  • Aspire.AppHost.Sdk + explicit Aspire.Hosting.AppHost package reference (both pinned to the same Aspire version, as required by the SDK targets validation)
  • NuGet packages added via post-actions in template.json (same pattern as the cratis template) so that users always get the latest published versions:
    • Cratis and Cratis.Arc.MongoDB → main app project
    • Cratis.Chronicle.Aspire → Composition project
    • Microsoft.Extensions.Http.Resilience, Microsoft.Extensions.ServiceDiscovery, and OpenTelemetry instrumentation packages → Infrastructure project
  • Restore and yarn install post-actions run after package references are added
Original prompt

This section details on the original issue you should resolve

<issue_title>Aspire template</issue_title>
<issue_description>Let’s create an Aspire template for Cratis and also for Chronicle alone.

Build it with the assumption of the package described in this issue will exist:
Cratis/Chronicle#2798

The full template (cratis-aspire) should configure Chronicle, the backend and the frontend (vite based). Base it on the cratis template and if possible, actually just build on top of it - not recreate it.

The template should add the necessary NuGet packages in the same way as we already do. It should also introduce a Composition project for setting up everything and a Infrastructure project that typically holds the OpenTelemetry setup and more - the things that comes with the Aspire template.

If possible, we could build on top of / invoke the Aspire template and just add our things.
In many ways this is a composition of two templates and the additions mentioned here</issue_description>

Comments on the Issue (you are @copilot in this section)

  • Fixes #9

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.