Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ const app = await builder.addExecutable("api", "uvicorn", ".", ["main:app", "--r

### `withEnvironment` API unification in Aspire 13.3

Aspire 13.3 unified polyglot AppHost environment assignment behind a single `withEnvironment(name, value)` pattern. The public TypeScript API accepts plain strings, reference expressions, endpoint references, parameter resources, supported resources that expose connection strings, expression values, and awaitable forms of supported values.
Aspire 13.3 unified non-C# AppHost environment assignment behind a single `withEnvironment(name, value)` pattern. The public TypeScript API accepts plain strings, reference expressions, endpoint references, parameter resources, supported resources that expose connection strings, expression values, and awaitable forms of supported values.

When upgrading to Aspire 13.3, replace every earlier per-kind environment helper call with `withEnvironment(name, value)`. The 13.3 TypeScript SDK doesn't generate compatibility aliases for those helpers.

Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/content/docs/app-host/with-terminal.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ await builder.build().run();
```

<Aside type="note">
In TypeScript AppHosts, `withTerminal()` currently applies the default options shown above. Configurable options are coming to the polyglot API as `WithTerminal` is finalized (tracked by [microsoft/aspire#18105](https://github.com/microsoft/aspire/issues/18105)).
In TypeScript AppHosts, `withTerminal()` currently applies the default options shown above. Configurable options are coming to the non-C# API as `WithTerminal` is finalized (tracked by [microsoft/aspire#18105](https://github.com/microsoft/aspire/issues/18105)).
</Aside>

</TabItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ XML doc comments are the primary source for generated SDK API documentation. The

Use `ats-*` override tags when the standard C# XML documentation doesn't translate well to generated SDK docs — for example, when a `<summary>` references C#-specific types or language constructs that have no direct equivalent in TypeScript. The supported overrides are:

- `<ats-summary>` — overrides `<summary>` in polyglot docs
- `<ats-summary>` — overrides `<summary>` in [polyglot](/get-started/glossary/#polyglot) docs
- `<ats-param name="...">` — overrides `<param>` for a specific parameter
- `<ats-returns>` — overrides `<returns>`
- `<ats-remarks>` — overrides `<remarks>`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ The AppHost is the orchestration layer. Your choice here changes how you express

Aspire offers two C# AppHost styles:

**File-based AppHost** — a single `apphost.cs` file that uses `#:sdk` and `#:package` directives. No `.csproj`, no solution integration required. Best for polyglot repos or quick setups.
**File-based AppHost** — a single `apphost.cs` file that uses `#:sdk` and `#:package` directives. No `.csproj`, no solution integration required. Best for repos with [polyglot](/get-started/glossary/#polyglot) code or quick setups.

**Project-based AppHost** — a traditional `AppHost.csproj` that lives inside a `.sln` alongside your other C# projects. Uses `ProjectReference` items and the generated `Projects` namespace for strongly-typed `AddProject<T>()` calls. Best when your repo is already a .NET solution and you want IDE-integrated orchestration.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import debugSessions from '@assets/get-started/code-extension-debug.png';
import debugSessionsLight from '@assets/get-started/code-extension-debug-light.png';
import { Kbd } from 'starlight-kbd/components';

The official Aspire extension for [Visual Studio Code](https://code.visualstudio.com/) turns VS Code into a first-class environment for building, debugging, and shipping polyglot Aspire apps.
The official Aspire extension for [Visual Studio Code](https://code.visualstudio.com/) turns VS Code into a first-class environment for building, debugging, and shipping [polyglot](/get-started/glossary/#polyglot) Aspire apps.
Press <Kbd windows='F5' /> to build your AppHost, start your resources, and debug supported resource types — C#, TypeScript, Python, browser apps, and Azure Functions — alongside the Aspire dashboard.

:::note[Prerequisites]
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/content/docs/get-started/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This page answers common questions about what Aspire is, how it fits into your w

Aspire is an agent-ready, code-first tool to compose, debug, and deploy any distributed app. It makes it easier to build, run, debug, and deploy services across any language, stack, or cloud. It's free and open source at [github.com/microsoft/aspire](https://github.com/microsoft/aspire).

Its central idea is the **AppHost**: the place where you declare your services, resources, dependencies, endpoints, parameters, and relationships in code instead of scattering that information across many config files. AppHosts can be written in **C# or TypeScript**, which makes Aspire a strong fit for polyglot teams.
Its central idea is the **AppHost**: the place where you declare your services, resources, dependencies, endpoints, parameters, and relationships in code instead of scattering that information across many config files. AppHosts can be written in **C# or TypeScript**, which makes Aspire a strong fit for teams that use [polyglot](/get-started/glossary/#polyglot) code.

Learn more: [Build your first Aspire app](/get-started/first-app/)

Expand Down
101 changes: 92 additions & 9 deletions src/frontend/src/content/docs/get-started/glossary.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: Key terms and concepts used throughout Aspire documentation — App
---

import { Aside } from '@astrojs/starlight/components';
import PivotSelector from '@components/PivotSelector.astro';
import Pivot from '@components/Pivot.astro';

This glossary defines the key terms and concepts you'll encounter when working with Aspire. Bookmark this page as a quick reference.

Expand All @@ -13,16 +15,27 @@ These are the foundational concepts you need to understand when working with Asp

### AppHost

The **AppHost** is the orchestration project where you define your entire application's architecture in C# code. It's a special Aspire project that:
The **AppHost** is the orchestration project where you define your entire application's architecture. It's a special Aspire project that:

- Declares what services, databases, and containers make up your application
- Defines how resources depend on each other
- Configures how resources communicate
- Orchestrates startup order during local development
- Generates deployment artifacts for production
- Declares what services, databases, and containers make up your application.
- Defines how resources depend on each other.
- Configures how resources communicate.
- Orchestrates startup order during local development.
- Generates deployment artifacts for production.

Think of it as the "control tower" for your distributed application.

<PivotSelector
title="Select your programming language"
key="aspire-lang"
marginTop={1}
options={[
{ id: 'csharp', title: 'C#' },
{ id: 'typescript', title: 'TypeScript' },
]}
/>

<Pivot id="csharp">
```csharp title="AppHost.cs"
// This IS the AppHost - Program.cs in your AppHost project
var builder = DistributedApplication.CreateBuilder(args);
Expand All @@ -33,6 +46,21 @@ var api = builder.AddProject<Projects.Api>("api")

builder.Build().Run();
```
</Pivot>
<Pivot id="typescript">
```typescript title="apphost.mts"
import { createBuilder } from './.aspire/modules/aspire.mjs';

// This IS the AppHost in a TypeScript project
const builder = await createBuilder();

const db = await builder.addPostgres("db");
await builder.addProject("api", "../Api/Api.csproj")
.withReference(db);

await builder.build().run();
```
</Pivot>

### Resource

Expand Down Expand Up @@ -72,6 +100,10 @@ Aspire helps you orchestrate all these pieces together.

When you add `builder.AddServiceDefaults()` to a project, you get production-ready observability and resilience out of the box.

### Polyglot

In this repository, **polyglot** means relating to code and applications written in multiple languages, including TypeScript, C#, Python, Go, Java, and Rust. Aspire supports polyglot code in AppHosts, generated SDKs, others projects, and related tooling.

---

## APIs and patterns
Expand All @@ -86,50 +118,87 @@ These are the key APIs and patterns you'll use when building Aspire applications
2. Sets up service discovery so your code can find the other resource
3. Creates a dependency relationship for startup ordering

<Pivot id="csharp">
```csharp title="AppHost.cs"
var db = builder.AddPostgres("db");
var api = builder.AddProject<Projects.Api>("api")
.WithReference(db); // API now has DATABASE connection info injected
```
</Pivot>
<Pivot id="typescript">
```typescript title="apphost.mts"
const db = await builder.addPostgres("db");
await builder.addProject("api", "../Api/Api.csproj")
.withReference(db); // API now has DATABASE connection info injected

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we update the surrounding heading/prose to WithReference()/withReference() now that this adds a TypeScript pivot? WaitFor does this already, but WithReference, WaitForCompletion, and WaitForStart still describe only the C# casing.

```
</Pivot>

The API project will receive environment variables like:
- `ConnectionStrings__db` - The database connection string
- Service discovery configuration for the "db" resource

### WaitFor

`WaitFor()` tells Aspire to delay starting a resource until its dependency is ready:
`WaitFor()`/`waitFor()` tells Aspire to delay starting a resource until its dependency is ready:

<Pivot id="csharp">
```csharp title="AppHost.cs"
var db = builder.AddPostgres("db");
var api = builder.AddProject<Projects.Api>("api")
.WithReference(db)
.WaitFor(db); // Don't start API until database is healthy
```
</Pivot>
<Pivot id="typescript">
```typescript title="apphost.mts"
const db = await builder.addPostgres("db");
await builder.addProject("api", "../Api/Api.csproj")
.withReference(db)
.waitFor(db); // Don't start API until database is healthy
```
</Pivot>

<Aside type="tip">
Without `WaitFor()`, your API might start and immediately crash because the database isn't ready yet. This prevents race conditions during startup.
Without `WaitFor()`/`waitFor()`, your API might start and immediately crash because the database isn't ready yet. This prevents race conditions during startup.
</Aside>

### WaitForCompletion

`WaitForCompletion()` waits for a resource to finish and exit (not just start). Useful for setup scripts:

<Pivot id="csharp">
```csharp title="AppHost.cs"
var migrate = builder.AddProject<Projects.DbMigration>("migrate");
var api = builder.AddProject<Projects.Api>("api")
.WaitForCompletion(migrate); // Wait for migrations to complete
```
</Pivot>
<Pivot id="typescript">
```typescript title="apphost.mts"
const migrate = await builder.addProject("migrate", "../DbMigration/DbMigration.csproj");
await builder.addProject("api", "../Api/Api.csproj")
.waitForCompletion(migrate); // Wait for migrations to complete
```
</Pivot>

### WaitForStart

`WaitForStart()` waits only for a resource to reach the running state, without waiting for health checks to pass:

<Pivot id="csharp">
```csharp title="AppHost.cs"
var db = builder.AddPostgres("db");
var api = builder.AddProject<Projects.Api>("api")
.WaitForStart(db); // Start as soon as db is running, don't wait for healthy
```
</Pivot>
<Pivot id="typescript">
```typescript title="apphost.mts"
const db = await builder.addPostgres("db");
await builder.addProject("api", "../Api/Api.csproj")
.waitForStart(db); // Start as soon as db is running, don't wait for healthy
```
</Pivot>

<Aside type="tip">
Use `WaitForStart()` when you need looser coupling—your service can handle initial connection failures via retry policies. Use `WaitFor()` when you need strict dependency on health.
Expand Down Expand Up @@ -287,20 +356,35 @@ These patterns appear frequently in Aspire applications.

Many hosting integrations support running as an **emulator** for local development:

<Pivot id="csharp">
```csharp title="AppHost.cs"
var storage = builder.AddAzureStorage("storage")
.RunAsEmulator(); // Uses Azurite container locally
```
</Pivot>
<Pivot id="typescript">
```typescript title="apphost.mts"
const storage = await builder.addAzureStorage("storage");
await storage.runAsEmulator(); // Uses Azurite container locally
```
</Pivot>

This lets you develop against Azure, AWS, or other cloud services without needing actual cloud accounts during development.

### Existing resource pattern

Connect to resources that already exist (not managed by Aspire):

<Pivot id="csharp">
```csharp title="AppHost.cs"
var existingDb = builder.AddConnectionString("db");
```
</Pivot>
<Pivot id="typescript">
```typescript title="apphost.mts"
const existingDb = await builder.addConnectionString("db");
```
</Pivot>

Aspire resolves this from `ConnectionStrings:db` (or environment variable `ConnectionStrings__db`) in the AppHost configuration and passes it through as a single connection string value.

Expand Down Expand Up @@ -334,4 +418,3 @@ These terms appear frequently in API documentation and advanced usage:

- [What is Aspire?](/get-started/what-is-aspire/)
- [Create your first Aspire app](/get-started/first-app/)
- [AppHost overview](/get-started/app-host/)
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ builder.AddFoundry("foundry")
TypeScript AppHosts can use curated provisioning helper APIs when an
integration exposes them. This example directly customizes Azure.Provisioning
objects through `ConfigureInfrastructure`, which is currently C#-only unless
the integration wraps the scenario in a polyglot-friendly helper.
the integration wraps the scenario in a [polyglot](/get-started/glossary/#polyglot)-friendly helper.
</Aside>

The preceding code:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ var appInsights = builder.AddAzureApplicationInsights("app-insights", logAnalyti
TypeScript AppHosts can use curated provisioning helper APIs when an
integration exposes them. This example directly customizes Azure.Provisioning
objects through `ConfigureInfrastructure`, which is currently C#-only unless
the integration wraps the scenario in a polyglot-friendly helper.
the integration wraps the scenario in a [polyglot](/get-started/glossary/#polyglot)-friendly helper.
</Aside>

The preceding code:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ builder.Build().Run();
TypeScript AppHosts can use curated provisioning helper APIs when an
integration exposes them. This example directly customizes Azure.Provisioning
objects through `ConfigureInfrastructure`, which is currently C#-only unless
the integration wraps the scenario in a polyglot-friendly helper.
the integration wraps the scenario in a [polyglot](/get-started/glossary/#polyglot)-friendly helper.
</Aside>

The preceding code:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ builder.Build().Run();
TypeScript AppHosts can use curated provisioning helper APIs when an
integration exposes them. This example directly customizes Azure.Provisioning
objects through `ConfigureInfrastructure`, which is currently C#-only unless
the integration wraps the scenario in a polyglot-friendly helper.
the integration wraps the scenario in a [polyglot](/get-started/glossary/#polyglot)-friendly helper.
</Aside>

The preceding code:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ storage.ConfigureInfrastructure(infra =>
TypeScript AppHosts can use curated provisioning helper APIs when an
integration exposes them. This example directly customizes Azure.Provisioning
objects through `ConfigureInfrastructure`, which is currently C#-only unless
the integration wraps the scenario in a polyglot-friendly helper.
the integration wraps the scenario in a [polyglot](/get-started/glossary/#polyglot)-friendly helper.
</Aside>

#### Service-specific requirements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ builder.Build().Run();
</Aside>

<Aside type="note">
The `RavenDBServerSettings`-based overload of `AddRavenDB` is only available from C# AppHosts. It includes certificate and licensing configuration that is not compatible with the polyglot TypeScript AppHost.
The `RavenDBServerSettings`-based overload of `AddRavenDB` is only available from C# AppHosts. It includes certificate and licensing configuration that is not compatible with the non-C# TypeScript AppHost.
</Aside>

## Connection properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ await builder.build().run();
</TabItem>
</Tabs>

The `WithLogLevel` method enables verbose logging in the SurrealDB container, which is useful during development and debugging. The polyglot TypeScript AppHost accepts the log level as a string (for example, `"Trace"`, `"Debug"`, `"Information"`, `"Warning"`, `"Error"`, `"Critical"`, or `"None"`).
The `WithLogLevel` method enables verbose logging in the SurrealDB container, which is useful during development and debugging. The non-C# TypeScript AppHost accepts the log level as a string (for example, `"Trace"`, `"Debug"`, `"Information"`, `"Warning"`, `"Error"`, `"Critical"`, or `"None"`).

## Health checks

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ The `DevTunnelOptions` class provides several configuration options:
| `Region` | The `DevTunnelRegion` to create the tunnel in; automatic when unset |

<Aside type="note">
`Region` is only configurable in C# via `DevTunnelOptions`. The polyglot
`Region` is only configurable in C# via `DevTunnelOptions`. The non-C#
TypeScript `addDevTunnel` export doesn't surface a region parameter.
</Aside>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ For more information, see the [OpenFeature JavaScript SDK](https://openfeature.d

## Use OFREP provider

As an alternative to the native provider, you can connect to flagd using the [OFREP (OpenFeature Remote Evaluation Protocol)](https://openfeature.dev/specification/appendix-c/). OFREP is a standardized HTTP/REST-based protocol for remote feature flag evaluation, making it language-agnostic and well-suited for polyglot environments.
As an alternative to the native provider, you can connect to flagd using the [OFREP (OpenFeature Remote Evaluation Protocol)](https://openfeature.dev/specification/appendix-c/). OFREP is a standardized HTTP/REST-based protocol for remote feature flag evaluation, making it language-agnostic and well-suited for [polyglot](/get-started/glossary/#polyglot) environments.

### Install the OFREP provider

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Getting there is a two-step process: model the flagd resource in your AppHost, t

<Aside type="tip">

Flagd also supports the [OFREP (OpenFeature Remote Evaluation Protocol)](https://openfeature.dev/specification/appendix-c/), an HTTP/REST-based alternative to the gRPC provider shown above. OFREP is well-suited for polyglot environments since it uses a standardized protocol that works across any language. To learn more, see [Use OFREP provider](/integrations/devtools/flagd/flagd-connect/#use-ofrep-provider).
Flagd also supports the [OFREP (OpenFeature Remote Evaluation Protocol)](https://openfeature.dev/specification/appendix-c/), an HTTP/REST-based alternative to the gRPC provider shown above. OFREP is well-suited for [polyglot](/get-started/glossary/#polyglot) environments since it uses a standardized protocol that works across any language. To learn more, see [Use OFREP provider](/integrations/devtools/flagd/flagd-connect/#use-ofrep-provider).

</Aside>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ await builder.build().run();

## Experimental Go AppHost templates

The `Aspire.Hosting.Go` integration can be used from C# and TypeScript AppHosts. Aspire also includes experimental Go AppHost and Go starter template support in the Aspire CLI. The Go AppHost templates use experimental Go AppHost APIs instead of the `Aspire.Hosting.Go` package. To enable Go AppHost language support for CLI templates, enable the Go polyglot feature flag:
The `Aspire.Hosting.Go` integration can be used from C# and TypeScript AppHosts. Aspire also includes experimental Go AppHost and Go starter template support in the Aspire CLI. The Go AppHost templates use experimental Go AppHost APIs instead of the `Aspire.Hosting.Go` package. To enable Go AppHost language support for CLI templates, enable the Go [polyglot](/get-started/glossary/#polyglot) feature flag:

```bash title="Aspire CLI"
aspire config set features:experimentalPolyglot:go true --global
Expand Down
Loading
Loading