This quickstart uses the starter template that generates a C# AppHost. You’ll create the solution, review the generated AppHost, and run it locally with Aspire.
Service defaults for shared configuration of observability and resilience
The following diagram shows the architecture of the sample app you’re creating:
This quickstart uses the JavaScript starter template, which generates a TypeScript AppHost in apphost.mts. You’ll create the solution, review the generated TypeScript AppHost, and run it locally with Aspire.
This starter template combines a modern JavaScript stack:
React for building user interfaces with JavaScript
TypeScript for type-safe development across the entire stack
The following diagram shows the architecture of the sample app you’re creating:
API serviceReact frontend
This quickstart uses the Go starter template, which generates a Go AppHost in apphost.go. You’ll create the solution, review the generated Go AppHost, and run it locally with Aspire.
This starter template combines a Go API with a modern JavaScript frontend:
net/http for building the API with the Go standard library
To create your first Aspire application, use the Aspire CLI to generate a new solution from a template. These template include multiple projects, such as an API service, a web frontend, and an Aspire AppHost.
Create a new Aspire solution from a template:
Create a new aspire solution
aspirenewaspire-starter-nAspireApp-oAspireApp
The template provides several projects, including an API service, web frontend, and AppHost.
For further CLI reference, see aspire new command information.
If prompted for additional selections, use the Up Arrow↑Up Arrow↑Up Arrow↑ and Down Arrow↓Down Arrow↓Down Arrow↓ keys to navigate the options. Press ReturnReturnEnterEnterEnterEnter to confirm your selection.
To create your first Aspire application, use the Aspire CLI to generate a new solution from a template. These template include multiple projects, such as an API service, a web frontend, and an Aspire AppHost.
The template provides several projects, including an API service, web frontend, and AppHost.
For further CLI reference, see aspire new command information.
If prompted for additional selections, use the Up Arrow↑Up Arrow↑Up Arrow↑ and Down Arrow↓Down Arrow↓Down Arrow↓ keys to navigate the options. Press ReturnReturnEnterEnterEnterEnter to confirm your selection.
To create your first Aspire application, use the Aspire CLI to generate a new solution from a template. The template includes a Go API, a React frontend, and an Aspire AppHost written in Go.
The template provides a Go API, a React web frontend, and a Go AppHost.
For further CLI reference, see aspire new command information.
If prompted for additional selections, use the Up Arrow↑Up Arrow↑Up Arrow↑ and Down Arrow↓Down Arrow↓Down Arrow↓ keys to navigate the options. Press ReturnReturnEnterEnterEnterEnter to confirm your selection. The prompts include whether to add a Redis cache for the API.
Examine the created template structure. The Aspire CLI creates a new folder with the name you provided in the current directory. This folder contains the solution file and several projects, including:
AspireApp.slnx
DirectoryAspireApp.ApiService mock weather data API
DirectoryProperties/
…
appsettings.Development.json
appsettings.json
AspireApp.ApiService.csproj
Program.cs
DirectoryAspireApp.AppHost dev-time orchestrator
DirectoryProperties/
…
appsettings.Development.json
appsettings.json
AspireApp.AppHost.csproj
AppHost.cs
DirectoryAspireApp.ServiceDefaults
Extensions.cs
AspireApp.ServiceDefaults.csproj
DirectoryAspireApp.Web ASP.NET Core Blazor frontend
DirectoryProperties/
…
Directorywwwroot/
…
appsettings.Development.json
appsettings.json
AspireApp.Web.csproj
Program.cs
WeatherApiClient.cs
This solution structure is based on the Aspire templates. If they’re not installed already, the CLI will install them for you.
Explore the AppHost code that orchestrates your app.
The AppHost is the heart of your Aspire application. It defines which services run, how they connect, and in what order they start. Let’s look at the generated code:
AppHost.cs project-based orchestrator
var builder =DistributedApplication.CreateBuilder(args);
var apiService =builder.AddDotnetProject("apiservice","../AspireApp.ApiService/AspireApp.ApiService.csproj")
WithReferencewithReferenceWithReference connects services. It injects the API’s URL as an environment variable and sets up service discovery so you can use service names instead of hardcoded URLs
WaitForwaitForWaitFor ensures the API is healthy before starting the frontend, preventing connection errors from race conditions
Examine the created template structure. The Aspire CLI creates a new folder with the name you provided in the current directory. This folder contains the solution file and several projects, including:
Directoryaspire-app/
Directoryapi/ Express mock weather data API
Directorysrc/
index.ts
instrumentation.ts
package.json
tsconfig.json
Directoryfrontend/ Vite + React web frontend
Directorypublic/
Aspire.png
github.svg
Directorysrc/
App.css
App.tsx
index.css
main.tsx
vite-env.d.ts
.dockerignore
eslint.config.js
index.html
package.json
tsconfig.json
vite.config.ts
apphost.mts dev-time orchestrator
Directory.aspire/
Directorymodules/ generated TypeScript SDK
…
aspire.config.json
package.json
tsconfig.apphost.json
This solution structure is based on the Aspire templates. If they’re not installed already, the CLI will install them for you.
Explore the AppHost code that orchestrates your app.
The AppHost is the heart of your Aspire application. It defines which services run, how they connect, and in what order they start. Let’s look at the generated code:
This template uses a TypeScript AppHost. To learn more about how multi-language AppHosts work, see Multi-language architecture.
Examine the created template structure. The Aspire CLI creates a new folder with the name you provided in the current directory. This folder contains the AppHost and the projects that it runs:
Directoryaspire-app/
Directoryapi/ Go weather API
go.mod
main.go
telemetry.go
Directoryfrontend/ Vite + React web frontend
Directorypublic/
Aspire.png
github.svg
Directorysrc/
App.css
App.tsx
index.css
main.tsx
vite-env.d.ts
.dockerignore
eslint.config.js
index.html
package.json
tsconfig.json
vite.config.ts
apphost.go dev-time orchestrator
Directory.aspire/
Directorymodules/ generated Go SDK
…
aspire.config.json
go.mod
This solution structure is based on the Aspire templates. If they’re not installed already, the CLI will install them for you.
Explore the AppHost code that orchestrates your app.
The AppHost is the heart of your Aspire application. It defines which services run, how they connect, and in what order they start. Let’s look at the generated code:
apphost.go
packagemain
import(
"log"
"apphost/modules/aspire"
)
funcmain(){
builder,err:=aspire.CreateBuilder()
iferr!=nil{
log.Fatal(aspire.FormatError(err))
}
// Keep Go modules current and send traces, metrics, and logs to the dashboard.
Once the dashboard is ready, its URL (with a login token highlighted in the example output below) appears in your terminal. The dashboard provides a live, real-time view of your running resources and their current states.
Once the dashboard is ready, its URL (with a login token highlighted in the example output below) appears in your terminal. The dashboard provides a live, real-time view of your running resources and their current states.
Generates the Go SDK from the integrations listed in aspire.config.json
Starts the AppHost with go run . and launches dev-time orchestration
Once the dashboard is ready, its URL (with a login token highlighted in the example output below) appears in your terminal. The dashboard provides a live, real-time view of your running resources and their current states.
For further CLI reference, see aspire run command information.
Explore the running distributed application. From the dashboard, open the HTTPS endpoint from each resource. The app and frontend resources appear with their logs, traces, and metrics, and cache appears too if you added Redis.
Stop the AppHost and close the dashboard by pressing ⌃+C⌃+CControl + CCtrlCControl + CCtrlC in your terminal.
Stop dev-time orchestration
🛑StoppingAspire.
🥳 Congratulations! You’ve created your first Aspire app.
You might be eager to deploy this app next and we’ll show you how Aspire handles that, but you’re probably also wondering: “How do I test all this?” Aspire doesn’t just orchestrate locally and deploy, it also helps you test service and resource integrations too. Ready to dive in? Write your first test 💜
Stop the AppHost and close the dashboard by pressing ⌃+C⌃+CControl + CCtrlCControl + CCtrlC in your terminal.
Stop dev-time orchestration
🛑StoppingAspire.
🥳 Congratulations! You’ve created your first Aspire app.
Stop the AppHost and close the dashboard by pressing ⌃+C⌃+CControl + CCtrlCControl + CCtrlC in your terminal.
Stop dev-time orchestration
🛑StoppingAspire.
🥳 Congratulations! You’ve created your first Aspire app.
Ready to deploy? Follow the Deploy your first Aspire app — Go AppHost tutorial to ship your app to Docker Compose or Azure. Or, if you’re wondering “How do I test all this?” Aspire helps you test service and resource integrations too. Write your first test 💜