Skip to content
Purview Dev logo

AspireC4

Stable

Live LikeC4 architecture diagrams from the Aspire resource graph.

architecture architecture-as-code architecture-diagrams aspire aspire-dashboard aspire-dotnet aspire-hosting aspnetcore c4 c4-model developer-experience devex diagram diagrams dotnet likec4 roslyn source-generator visualization

The problem

An Aspire extension that generates live LikeC4 architectural diagrams from the Aspire resource graph, with a Roslyn source generator for compile-time validation of tags, kinds, groups, and metadata.

From the repository

Aspire extension that generates live LikeC4 C4 architecture diagrams from the Aspire resource graph, with a Roslyn source generator for compile-time validation of tags, kinds, groups, and metadata.

Why it became a project

Aspire already holds a useful model of a distributed application, so manually maintaining a separate architecture diagram was repetition that could be removed.

Where it fits

Use it when

You use .NET Aspire and want live LikeC4 diagrams derived from the resource graph, with compile-time checks for architectural metadata.

It may not fit when

You do not use Aspire, need a manually curated architecture model, or require diagrams that intentionally differ from the running application topology.

Use cases

Concrete examples of what AspireC4 does, and who each one is for.

Developer

A live architecture diagram with three lines of code

You already describe your distributed application in Aspire and do not want to maintain a separate architecture diagram that drifts from reality.

csharp
var builder = DistributedApplication.CreateBuilder(args);

builder.AddAspireC4();

builder.Build().Run();

What you get: AspireC4 writes the generated LikeC4 model, starts the LikeC4 sidecar, and refreshes the diagram whenever the Aspire application changes.

The diagram is derived from the running resource graph, so it cannot silently fall out of date the way a hand-drawn one can.

Read the guide →
Architect

Validate architectural metadata at compile time

You want tags, kinds, groups, and metadata in your architecture model checked before the application even runs.

What you get: A Roslyn source generator validates the architectural metadata while the AppHost compiles.

Architectural metadata mistakes fail the build instead of surfacing in a diagram nobody reads.

Read the guide →

Packages

1 package

AspireC4.HostingInstall ↓13.5.3.1113.6.4-preview.13,321

Install

.NET CLI
dotnet add package AspireC4.Hosting