Building cloud-native applications can be challenging due to their complexity and the need for scalability, resilience, and manageability.
There are lots of ways to build cloud-native applications and the overwhelming number of choices can make it difficult to know where to start.
Figure: Too many lego pieces - Where do you start?
Also, the complexity of modern cloud-native applications can make them difficult to manage and maintain.
.NET Aspire is a powerful set of tools, templates, and integrations designed to streamline cloud-native app development with .NET. It offers a consistent approach to orchestration, standardized integrations, and developer-friendly tooling to help you build robust, production-ready applications.
Figure: Aspire makes common time-consuming developer chores a breeze
.NET Aspire addresses common pain points in cloud-native development:
.NET Aspire helps you manage interconnected services and resources in your application by:
.NET Aspire integrations make it easy to connect to essential services:
AddRedis or AddAzureServiceBusClient streamline configuration and health checksLeverage predefined templates and tooling to:
version: '3.9'services:redis:image: redis:latestcontainer_name: redis-cacheports:- "6379:6379"environment:REDIS_PASSWORD: examplepassword # Optional, for enabling authenticationcommand: ["redis-server", "--requirepass", "examplepassword"] # Optional, for setting up a passwordvolumes:- redis_data:/data # Persist data locallyvolumes:redis_data:driver: local
var redisConnection = Environment.GetEnvironmentVariable("REDIS_CONNECTION_STRING") ?? "localhost:6379";services.AddStackExchangeRedisCache(options =>{options.Configuration = redisConnection;options.InstanceName = "SampleInstance";});
❌ Figure: Bad Example - Manually setting up Redis cache 🥱
Aspire handles Redis setup and connection string injection for you:
var builder = DistributedApplication.CreateBuilder(args);var cache = builder.AddRedis("cache");builder.AddProject<Projects.MyApp>("app").WithReference(cache).WaitFor(cache);
public static class DependencyInjection{public static void AddInfrastructure(this IHostApplicationBuilder builder){builder.AddRedisClient("my-redis-connection-string");}}
✅ Figure: Good Example - Simple Redis setup with .NET Aspire 🚀
No need to write Docker Compose files. No need for yaml 🤮. Connection string is automatically injected.
You can test out Aspire by running the SSW.CleanArchitecture template - Let us know what you think!