Skip to content
Docs Try Aspire
Docs Try

Samples

Explore a curated collection of official Aspire sample projects. Each sample is a fully functional application you can clone and run to learn patterns for databases, messaging, cloud services, and more.

26 samples
Screenshot of the Aspire Shop sample

Aspire Shop

The app consists of four .NET services: AspireShop.Frontend: This is an ASP.NET Core Blazor app that displays a paginated catalog of products and allows users to add products to a shopping cart. AspireShop.CatalogService: This is an HTTP API that provides access to the catalog of products stored in a PostgreSQL database. AspireShop.CatalogDbManager: This is an HTTP API that manages the initialization and updating of the catalog database. AspireShop.BasketService: This is a gRPC service that provides access to the shopping cart stored in Redis.

Blazor C# Databases gRPC PostgreSQL +1
Screenshot of the Image Gallery sample

Image Gallery

The app consists of two services: ImageGallery.Frontend: This is a Blazor app that displays a for uploading of images, showing thumbnails of images in a grid. ImageGallery.Functions: This is an Azure Function triggered by the arrival of a new blob using a Functions Blob Trigger.

Azure Azure Functions Blazor C#
Screenshot of the Integrating Angular, React, and Vue with Aspire sample

Integrating Angular, React, and Vue with Aspire

This sample demonstrates using the Aspire JavaScript hosting integration to configure and run client-side applications.

C# Dashboard JavaScript Node.js

Integrating a Node.js app within an Aspire application

This sample demonstrates integrating a Node.js app and an ASP.NET Core HTTP API using Aspire. The sample consists of two apps: NodeFrontend: This is a simple Express-based Node.js app that renders a table of weather forecasts retrieved from a backend API and utilizes a Redis cache. AspireWithNode.AspNetCoreApi: This is an ASP.NET Core HTTP API that returns randomly generated weather forecast data.

C# JavaScript Node.js Redis

Integrating a FastAPI (Python) app within an Aspire application

This sample demonstrates integrating a FastAPI (Python) app and a JavaScript frontend using Aspire. The sample consists of two apps: app: This is a simple FastAPI-based Python app that returns randomly generated weather forecast data. frontend: This is a Vite-based React app that renders the weather forecast data.

C# JavaScript Node.js Python
Screenshot of the Working with client apps in an Aspire application sample

Working with client apps in an Aspire application

This sample demonstrates working with client apps such as WinForms, WPF, etc., in an Aspire app, such that the client app is launched along with the AppHost project, can resolve services via service discovery, and logs, traces, and metrics are sent via OpenTelemetry to the dashboard.

C# Dashboard Metrics
Screenshot of the Working with container-built resources in an Aspire application sample

Working with container-built resources in an Aspire application

This sample demonstrates integrating applications into an Aspire app via Dockerfiles and container-based builds. This is especially helpful to integrate applications written in languages that Aspire does not have a native integration for, or to reduce the prerequisites required to run the application.

C# Dashboard Docker Go Metrics

Writing custom resources for Aspire hosting integrations

This sample demonstrates how to write custom resources for Aspire hosting integrations. This is useful when you want to integrate something into the Aspire development experience as a resource that isn't an executable or container. Custom resources can particpate in the Aspire development experience, including the dashboard, and can be used to integrate with other tools or services. Custom resources are defined using C# and generally consist of a class that implements the IResource interface and some extension methods to enable adding them to an IDistributedApplicationBuilder. Custom resources can publish and respond to events to give them "life" and allow them to interact with the rest of the Aspire application. In this sample, we define a TalkingClock custom resource that spawns child ClockHand resources that tick on and off every second. We also define a TestResource custom resource that simply cycles through a set of states. Read more about the Aspire resource model here.

C# Dashboard
Screenshot of the Working with database containers in an Aspire application sample

Working with database containers in an Aspire application

This sample demonstrates working with database containers in an Aspire app, using the features of the underlying container image to modify the default database created during container startup. This is especially helpful when not using an ORM like Entity Framework Core that can run migrations on application startup (e.g., as in the Aspire Shop sample) and handle cases when the database configured in the AppHost is not yet created.

C# Dashboard Databases Docker EF Core +4

Database migrations with Entity Framework Core sample app

This sample demonstrates how to use Entity Framework Core's migrations feature with Aspire. The sample has three important projects: DatabaseMigrations.ApiService - A web app that uses the database. DatabaseMigrations.MigrationService - A background worker app that applies migrations when it starts up. DatabaseMigrations.ApiModel - The EF Core context and entity types. This project is used by both the API and migration service. DatabaseMigrations.ApiService and DatabaseMigrations.MigrationService reference a SQL Server resource. During local development the SQL Server resource is launched in a container.

C# Databases EF Core Migrations PostgreSQL +1

Go API with In-Memory Storage

REST API built with Go and chi router, using in-memory storage with thread-safe operations. This sample demonstrates a TypeScript AppHost that runs the Go API directly during local development and switches to a checked-in Dockerfile for Docker Compose publishing.

Docker Go Health Checks TypeScript

Image Gallery with Event-Triggered Azure Container Apps Jobs

Upload images to Azure Blob Storage with queue-triggered thumbnail generation. Demonstrates event-driven Container Apps Jobs with queue-based autoscaling, managed identity authentication, and Azure SQL free tier - can run entirely within Azure free tier limits.

Azure Azure Storage C# Metrics Node.js +1
Screenshot of the Aspire metrics sample app sample

Aspire metrics sample app

This is a simple .NET app that shows off collecting metrics with OpenTelemetry and exporting them to Prometheus and Grafana for reporting.

C# Dashboard Grafana Metrics Prometheus
Screenshot of the Polyglot Task Queue sample

Polyglot Task Queue

Distributed task processing with Python, C#, and Node.js workers using RabbitMQ and end-to-end OpenTelemetry tracing.

Dashboard Docker JavaScript Metrics Node.js +3

Python FastAPI + PostgreSQL Sample

FastAPI REST API with PostgreSQL database using Aspire Python support. This sample demonstrates Aspire 13's polyglot platform support for Python applications, showcasing a simple CRUD API built with FastAPI and PostgreSQL.

Containers C# Databases Docker Health Checks +3
Screenshot of the Python OpenAI Agent Sample sample

Python OpenAI Agent Sample

Python FastAPI AI agent with OpenAI integration demonstrating AI workloads with Aspire.

Dashboard Docker Health Checks Python TypeScript

Python Script Sample

Simple Python script demonstrating Aspire's Python integration with automatic virtual environment management. This sample shows how Aspire 13's Python support automatically manages Python applications, including virtual environment creation and dependency installation.

Dashboard Python TypeScript
Screenshot of the Standalone Aspire dashboard sample app sample

Standalone Aspire dashboard sample app

View telemetry from any app in the Aspire dashboard. The dashboard supports running standalone, and apps configured with an OpenTelemetry SDK can send it data.

C# Dashboard Docker gRPC Metrics
Screenshot of the Persistent Volume sample

Persistent Volume

This sample demonstrates how to configure a SQL Server container to use a persistent volume in Aspire, so that the data is persisted across app launches. This method can be used to persist data across instances of other container types configured in Aspire apps too, e.g. PostgreSQL, Redis, etc.

Azure Azure Storage Blazor C# Dashboard +8