With .NET Aspire, you can spin up distributed applications and infrastructure components with almost no boilerplate.
Here’s a minimal example that uses YARP (Yet Another Reverse Proxy) to serve a static frontend:
var builder = DistributedApplication.CreateBuilder(args);
builder.AddYarp("frontend")
.WithStaticFiles("./web");
builder. Build().Run();
That’s all it takes to host a frontend inside an Aspire-managed app!
Let’s unpack what happens:
DistributedApplication.CreateBuilder(args)initializes the Aspire app host — the entry point for defining all components (APIs, databases, frontends, etc.).AddYarp("frontend")registers a YARP reverse proxy named frontend. Aspire automatically wires up service discovery and local routing between modules.WithStaticFiles("./web")tells YARP to serve static content directly from thewebfolder — perfect for a Blazor WASM, React, or Vue frontend build output.- Finally,
builder.Build().Run()starts everything — you can open the dashboard or browse directly to the proxy endpoint.
This small snippet demonstrates one of the nicest aspects of Aspire: you can go from idea to running distributed app infrastructure in a few lines of code.
It’s clean, declarative, and plays well with modern cloud-native patterns — all from inside your .NET solution.
That’s all folks!
Cheers!
Gašper Rupnik
{End.}

Leave a comment