Lewati ke konten
Docs Try Aspire
Docs Try

Samples

Konten ini belum tersedia dalam bahasa Anda.

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

Browse a product catalog served by the Catalog service and add items to a cart held by the Basket service. Built with Aspire.

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 TypeScript
Screenshot of the Integrating a Node.js app within an Aspire application sample

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.

C# JavaScript Node.js Redis
Screenshot of the Integrating a FastAPI (Python) app within an Aspire application sample

Integrating a FastAPI (Python) app within an Aspire application

This sample demonstrates integrating a FastAPI (Python) app and a JavaScript frontend using Aspire.

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
Screenshot of the Go API with In-Memory Storage sample

Go API with In-Memory Storage

REST API built with Go and chi router, using in-memory storage with thread-safe operations. Opening the running app in a browser lands on a themed Scalar API reference—a polished, Go-cyan developer portal generated from the service's OpenAPI 3.1 document—while API clients keep receiving JSON.

Docker Go Health Checks TypeScript
Screenshot of the Configuring health checks & running the ASP.NET Core HealthChecksUI container with Aspire sample

Configuring health checks & running the ASP.NET Core HealthChecksUI container with Aspire

This sample demonstrates configuring ASP.NET Core Health Checks and running the ASP.NET Core HealthChecksUI container with Aspire.

Azure C# Dashboard Databases Docker +2
Screenshot of the Image Gallery with Event-Triggered Azure Container Apps Jobs sample

Image Gallery with Event-Triggered Azure Container Apps Jobs

Lumina media library, light theme Lumina media library, dark theme

Azure Azure Storage C# Metrics Node.js +2
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 Aspire Orleans sample app sample

Aspire Orleans sample app

This is a simple .NET app that shows how to use Orleans with Aspire orchestration.

C# Orleans
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
Screenshot of the Python FastAPI + PostgreSQL Sample sample

Python FastAPI + PostgreSQL Sample

FastAPI REST API with PostgreSQL database using Aspire Python support.

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

Python OpenAI Agent Sample

[!NOTE] The screenshots above show a deterministic, stubbed conversation captured for documentation. Live OpenAI responses require your own API key (see below) and were not exercised when these images were generated.

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 RAG Document Q&A with Svelte sample

RAG Document Q&A with Svelte

The uploaded document list, answer, and cited passages shown above are illustrative — an OpenAI API key is required for live embeddings and answers. The empty-document and upload error states are captured against the real backend.

Databases Docker Node.js 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