Aspire

Build your first Aspire app

Select your programming language

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.

This starter template uses modern C#:

The following diagram shows the architecture of the sample app you’re creating:

API serviceBlazor frontend

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:

  • Express for building APIs with Node.js
  • 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
  • React and Vite for building the user interface
  • OpenTelemetry for Go to send traces, metrics, and logs to the Aspire dashboard
  • An optional Redis cache that the API uses for the weather forecast

The following diagram shows the architecture of the sample app you’re creating:

API serviceReact frontend

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.

  1. Create a new Aspire solution from a template:

    Create a new aspire solution
    aspire new aspire-starter -n AspireApp -o AspireApp

    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 ArrowUp ArrowUp Arrow and Down ArrowDown ArrowDown Arrow keys to navigate the options. Press ReturnEnterEnter 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.

  1. Create a new Aspire solution from a template:

    Create a new aspire solution
    aspire new aspire-ts-starter -n aspire-app -o aspire-app

    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 ArrowUp ArrowUp Arrow and Down ArrowDown ArrowDown Arrow keys to navigate the options. Press ReturnEnterEnter 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.

  1. Create a new Aspire solution from a template:

    Create a new aspire solution
    aspire new aspire-go-starter -n aspire-app -o aspire-app

    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 ArrowUp ArrowUp Arrow and Down ArrowDown ArrowDown Arrow keys to navigate the options. Press ReturnEnterEnter to confirm your selection. The prompts include whether to add a Redis cache for the API.

All templates start with CreateBuildercreateBuilderCreateBuilder to create the AppHost builder. They use WithReferencewithReferenceWithReference to connect resources and WaitForwaitForWaitFor to wait for dependencies before starting dependent resources.

  1. 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.

  2. 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")
    .WithHttpHealthCheck("/health");
    builder.AddDotnetProject("webfrontend", "../AspireApp.Web/AspireApp.Web.csproj")
    .WithExternalHttpEndpoints()
    .WithHttpHealthCheck("/health")
    .WithReference(apiService)
    .WaitFor(apiService);
    builder.Build().Run();

    What’s happening here?

  1. 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.

  2. 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.mts
    import {
    function createBuilder(): IDistributedApplicationBuilder

    Creates a new distributed application builder

    createBuilder
    } from './.aspire/modules/aspire.mjs';
    const
    const builder: IDistributedApplicationBuilder
    builder
    = await
    function createBuilder(): IDistributedApplicationBuilder

    Creates a new distributed application builder

    createBuilder
    ();
    // Run the Express API and expose its HTTP endpoint externally.
    const
    const app: NodeAppResource
    app
    = await
    const builder: IDistributedApplicationBuilder
    builder
    .
    IDistributedApplicationBuilder.addNodeApp(name: string, appDirectory: string, scriptPath: string): NodeAppResource

    Adds a node application to the application model. Node should be available on the PATH.

    addNodeApp
    ("app", "./api", "src/index.ts")
    .
    ExecutableResource.withHttpEndpoint(options?: {
    port?: number;
    targetPort?: number;
    name?: string;
    env?: string;
    isProxied?: boolean;
    } | undefined): NodeAppResource (+1 overload)

    Adds an HTTP endpoint

    withHttpEndpoint
    ({
    env?: string | undefined
    env
    : "PORT" })
    .
    ExecutableResource.withExternalHttpEndpoints(): NodeAppResource

    Marks existing http or https endpoints on a resource as external.

    withExternalHttpEndpoints
    ();
    // Run the Vite frontend after the API and inject the API URL for local proxying.
    const
    const frontend: ViteAppResource
    frontend
    = await
    const builder: IDistributedApplicationBuilder
    builder
    .
    IDistributedApplicationBuilder.addViteApp(name: string, appDirectory: string, options?: {
    runScriptName?: string;
    }): ViteAppResource (+1 overload)

    Adds a Vite app to the distributed application builder.

    addViteApp
    ("frontend", "./frontend")
    .
    ExecutableResource.withReference(source: IResource | EndpointReference | string | uri, options?: {
    connectionName?: string;
    optional?: boolean;
    name?: string;
    } | undefined): ViteAppResource (+1 overload)

    Adds a reference to another resource

    withReference
    (
    const app: NodeAppResource
    app
    )
    .
    ExecutableResource.waitFor(dependency: IResource | IResourceWithConnectionString, waitBehavior?: WaitBehavior): ViteAppResource

    Waits for another resource to be ready

    waitFor
    (
    const app: NodeAppResource
    app
    );
    // Bundle the frontend build output into the API container for publish/deploy.
    await
    const app: NodeAppResource
    app
    .
    IContainerFilesDestinationResource.publishWithContainerFiles(source: IResourceWithContainerFiles, destinationPath: string): NodeAppResource

    Configures the resource to copy container files from the specified source resource during publishing.

    publishWithContainerFiles
    (
    const frontend: ViteAppResource
    frontend
    , "./static");
    await
    const builder: IDistributedApplicationBuilder
    builder
    .
    IDistributedApplicationBuilder.build(): DistributedApplication

    Builds the distributed application

    build
    ().
    DistributedApplication.run(cancellationToken?: cancellationToken): void

    Runs the distributed application

    run
    ();

    What’s happening here?

    This template uses a TypeScript AppHost. To learn more about how multi-language AppHosts work, see Multi-language architecture.

  1. 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.

  2. 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
    package main
    import (
    "log"
    "apphost/modules/aspire"
    )
    func main() {
    builder, err := aspire.CreateBuilder()
    if err != nil {
    log.Fatal(aspire.FormatError(err))
    }
    // Keep Go modules current and send traces, metrics, and logs to the dashboard.
    app := builder.AddGoApp("app", "./api").
    WithModTidy().
    WithHttpEndpoint(aspire.HttpEndpointEnv("PORT")).
    WithHttpHealthCheck(aspire.HttpHealthCheckPath("/health")).
    WithExternalHttpEndpoints().
    WithOtlpExporter()
    // Reference the app for Vite proxying and wait until it is healthy.
    frontend := builder.AddViteApp("frontend", "./frontend", nil).
    WithReference(app).
    WaitFor(app)
    // Bundle the frontend into the app container for same-origin production serving.
    app.PublishWithContainerFiles(frontend, "./static")
    application, err := builder.Build()
    if err != nil {
    log.Fatal(aspire.FormatError(err))
    }
    if err := application.Run(); err != nil {
    log.Fatal(aspire.FormatError(err))
    }
    }

    If you chose the Redis cache, the template also adds the following lines before builder.Build():

    apphost.go
    cache := builder.AddRedis("cache")
    app.WithReference(cache).WaitFor(cache)

    What’s happening here?

    This template uses a Go AppHost. To learn more about the project layout and generated SDK, see Get started with the Go AppHost and Multi-language architecture.

  1. Change to the output directory:

    Change directories
    cd ./AspireApp
  2. Call aspire run to start dev-time orchestration:

    Run dev-time orchestration
    aspire run

    When you run this command, the Aspire CLI:

    • Automatically finds the AppHost
    • Builds your solution
    • 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.

    Example output
    🔍 Finding apphosts...
    AspireApp.AppHost/AspireApp.AppHost.csproj
    🗄 Created settings file at 'aspire.config.json'.
    AppHost: AspireApp.AppHost/AspireApp.AppHost.csproj
    Dashboard: https://localhost:17068/login?t=ea559845d54cea66b837dc0ff33c3bd3
    Logs: %USERPROFILE%/.aspire/cli/logs/apphost-13024-2025-10-31-19-40-58.log
    Press CTRL+C to stop the apphost and exit.

    For further CLI reference, see aspire run command information.

  3. Explore the running distributed application. From the dashboard, open the HTTPS endpoint from each resource.

    Aspire dashboard Resources page displaying two running resources: apiservice and webfrontend. Both are marked as Running with green check icons. The table lists columns for Name, State, Start time, Source, URLs, and Actions.

    To learn more, see Aspire dashboard overview.

  1. Change to the output directory:

    Change directories
    cd ./aspire-app
  2. Call aspire run to start dev-time orchestration:

    Run dev-time orchestration
    aspire run

    When you run this command, the Aspire CLI:

    • Automatically finds the AppHost
    • Builds your solution
    • 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.

    Example output
    🔍 Finding apphosts...
    apphost.mts
    AppHost: apphost.mts
    Dashboard: https://localhost:17174/login?t=afb274c630f48b1c4ddfe139011c1cb7
    Logs: %USERPROFILE%/.aspire/logs/cli_20260318T134627_f31ad598.log
    Press CTRL+C to stop the apphost and exit.

    For further CLI reference, see aspire run command information.

  3. Explore the running distributed application. From the dashboard, open the HTTPS endpoint from each resource.

    Aspire dashboard Resources page displaying two running and two finished resources: app and frontend. Both app and frontend are marked as Running with green check icons while their installer resources show as Finished. The table lists columns for Name, State, Start time, Source, URLs, and Actions.

    To learn more, see Aspire dashboard overview.

  1. Change to the output directory:

    Change directories
    cd ./aspire-app
  2. Call aspire run to start dev-time orchestration:

    Run dev-time orchestration
    aspire run

    When you run this command, the Aspire CLI:

    • Automatically finds the AppHost
    • 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.

    Example output
    ⚙️ Preparing Aspire server...
    Connecting to AppHost...
    Starting dashboard...
    AppHost: apphost.go
    Dashboard: https://localhost:17254/login?t=f4783244cd69d310c2e0dd65387e5b38
    Logs: %USERPROFILE%/.aspire/logs/cli_20261112T213427_e96878d7.log
    Press CTRL+C to stop the AppHost and exit.

    For further CLI reference, see aspire run command information.

  3. 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.

    Aspire dashboard Resources page displaying the running Go app and Vite frontend resources, plus the finished app-mod-tidy and frontend-installer resources. The app and frontend resources are marked as Started with green health indicators and each has an HTTP endpoint URL. The table lists columns for Name, State, Start time, Source, URLs, and Actions.

    To learn more, see Aspire dashboard overview.

  1. Stop the AppHost and close the dashboard by pressing ⌃+CControl + CControl + C in your terminal.

    Stop dev-time orchestration
    🛑 Stopping Aspire.

    🥳 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 💜

  1. Stop the AppHost and close the dashboard by pressing ⌃+CControl + CControl + C in your terminal.

    Stop dev-time orchestration
    🛑 Stopping Aspire.

    🥳 Congratulations! You’ve created your first Aspire app.

Ready to deploy? Follow the Deploy your first Aspire app — TypeScript 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 💜

  1. Stop the AppHost and close the dashboard by pressing ⌃+CControl + CControl + C in your terminal.

    Stop dev-time orchestration
    🛑 Stopping Aspire.

    🥳 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 💜