Over the past few months, I’ve been reading a lot about .NET Aspire, a relatively new framework designed to simplify building cloud-native distributed applications. Aspire is available in preview with .NET 8 now and I thought I'd have a play with it with a view to evaluate it and possibly use it at our local Meetup event at .NET South West.
A Framework primarily for local development
One of the most interesting aspects of .NET Aspire is how well it supports local development environments. Features like service discovery and simplified configuration management make it easier to spin up a cluster of services on your local machine without needing a full cloud setup. You will need to have an OCI compliant container tool - either Docker Desktop or Podman, and you'll need the workload installed, but that's about it.
Observability Made Simple with Aspire’s Standalone Dashboard
One standout feature of .NET Aspire is its approach to observability, particularly for developers who haven't done much in this area before. The default project template, or even the standalons project both give you a fantastic dashboard which exposes Open Telemetry for Logging, Traces and Metrics.
Demo Repo
In support of the meetup events that I'll be talking at, I've got my experiments running on this repo at https://github.com/CarlSargunar/Aspire-Demo
There are 3 samples. The first, taking a API and hooking it up to standalone Aspire dashboard. This runs on Docker with the command below, and lets you configure any app to use the Aspire dashboard, arguably one of the best things about the whole platform. As a standalone logging, tracing and observability platform for developers it's a game changer.
docker run --rm -it -d -p 18888:18888 -p 4317:18889 --name aspire-dashboard mcr.microsoft.com/dotnet/aspire-dashboard:8
The second, is a basic Blazor app calling an API to illustrate the orchestration and dashboard integration, with a redis cache. This uses the redis cache server and client nuget integration, which relies on the Docker container for Redis
Finally I take a Docker Compose application consisting of a slightly larger app - there is a Docker sample and an Aspire sample, which takes the existing Docker app and translates it to use .NET Aspire. The sample uses an Umbraco website, which has a custom analytics middleware which acts as a a server-side analytics tool. Every request to CMS to a unique route sends a message on to a RabbitMQ queue.
There's then a listener which processes these messages and writes them to a database. Finally there's a reporting dashboard, which is a blazor app and an API, which shows the dashboard of all page views.
This sample exists as both a Docker Compose project, as well as an Aspire project in the relevant folder in the sample repo. You can clone this repo from https://github.com/CarlSargunar/Aspire-Demo
I'd love some feedback, so if you do have any after looking at my repo, please Let me Know 😄