Skip to content

Repository files navigation

Polyglot Aspire

Polyglot samples for Aspire — demonstrating service orchestration across Python, JavaScript/Vite, Go, Java, C#, and mixed-language applications.

Slides

The hosted slides for the related talk can be found at:
https://chris-ayers.com/aspire-polyglot/

The source deck for this presentation lives in slides/ and is built with Marp.

Quick Start:cd samples/<sample> && aspire run

Prerequisites:Aspire CLI, Docker

Samples

No AppHost required 📊

The Aspire dashboard is a standalone container — point any OpenTelemetry app at it for logs, traces, and metrics, with no AppHost and no .NET.

SampleEntry pointDescription
standalone-dashboarddocker-compose.ymlStandalone dashboard + polyglot OTEL emitters (Node.js + Python + Go) — traces, metrics, and logs from three languages in one dashboard

Single-file AppHost ⭐

The whole dev-time orchestrator is a single file — no AppHost project, no Program.cs.

SampleAppHostDescription
dotnet-react-postgresapphost.csC# single-file AppHost — ASP.NET Core Minimal API + PostgreSQL + Vite React quotes board
hono-redis-urlsapphost.tsTypeScript single-file AppHost — Hono API + Redis + Vite URL shortener

Containers, Compose & publishing

Single-file AppHosts focused on Docker images, aspire publish, and polyglot services.

SampleAppHostDescription
postgres-adminerapphost.csC# — adds two public Docker images directly (PostgreSQL + Adminer) with AddContainer; no Dockerfiles
go-redis-composeapphost.csC# + Goaspire publish generates a runnable docker-compose.yaml (Go hit-counter API + Redis)
python-fastapi-dockerapphost.csC# + Python — FastAPI runs natively (uvicorn) in dev; aspire publish auto-generates its Dockerfile
java-javalin-redisapphost.csC# + Java — Javalin leaderboard API (multi-stage Maven build) + Redis via AddDockerfile

JavaScript / Vite

SampleAppHostDescription
vite-react-apiapphost.tsVite + React + FastAPI + Redis — TODO app with caching

C# / .NET

SampleAppHostDescription
dotnet-angular-cosmosAppHost/ASP.NET Core + Angular 19 + CosmosDB emulator — recipe manager

Mixed / Polyglot

SampleAppHostDescription
polyglot-event-streamAppHost/C# producer + Python consumer + Node.js dashboard + Kafka — IoT sensor streaming

Preview

Experimental polyglot AppHosts (Python, Go, Java) live under samples/preview/. They rely on Aspire's preview polyglot AppHost support and may change as those languages stabilize.

SampleAppHostDescription
flask-markdown-wikiapphost.pyFlask + SQLite — Markdown wiki with create/edit/render pages
django-htmx-pollsapphost.pyDjango + HTMX — interactive voting polls with real-time bar charts
svelte-go-bookmarksapphost.goSvelte SPA + Go API via AddDockerfile — bookmark manager with tagging
spring-boot-postgresAppHost.javaSpring Boot + PostgreSQL + pgAdmin — notes REST API via AddDockerfile

Ways to use multiple languages with Aspire

Aspire is polyglot on two independent axes: the language you author the AppHost in, and the languages your workloads are written in. You mix and match freely — a C# AppHost can orchestrate Python and Go, a TypeScript AppHost can orchestrate .NET, and so on.

1. AppHost authoring languages

The orchestrator itself can be written in several languages. C# and TypeScript are generally available; Python, Go, and Java are experimental preview (enabled via the polyglotSupportEnabled feature — see aspire.config.json).

AppHost languageFileStatusSample(s)
C#apphost.cs (single-file) or AppHost.csprojGAdotnet-react-postgres, postgres-adminer, go-redis-compose, python-fastapi-docker, java-javalin-redis, dotnet-angular-cosmos, polyglot-event-stream
TypeScriptapphost.ts (legacy) / apphost.mtsGA (13.4)hono-redis-urls, vite-react-api, ts-starter
Pythonapphost.pyPreviewflask-markdown-wiki, django-htmx-polls
Goapphost.goPreviewsvelte-go-bookmarks
JavaAppHost.javaPreviewspring-boot-postgres
Rustapphost.rsPlanned (SDK codegen groundwork exists)

The same .NET hosting integrations are surfaced to every AppHost language through the Aspire Type System (ATS): the CLI auto-generates a typed SDK (into .aspire/modules/, or .modules/ for legacy apphost.ts) so guest-language AppHosts call the same integrations without hand-written bindings.

2. Adding a workload in any language

Inside the AppHost, each service is added with an Add* method. Some are language/runtime-specific; three are language-agnostic escape hatches that cover anything else.

MechanismAddsDemonstrated in
AddProject<T>()A .NET projectdotnet-react-postgres, dotnet-angular-cosmos, polyglot-event-stream
AddViteApp()Vite frontends (React, Vue, Svelte, Angular 17+, Astro)dotnet-react-postgres, ts-starter
AddNodeApp()A Node.js entry filets-starter
AddJavaScriptApp() + .WithYarn() / .WithPnpm() / .WithBun()Any JS/TS app, auto-detecting the package managerdiscussed — see JavaScript apps in the AppHost
AddUvicornApp() (+ .WithUv()) / AddPythonApp()Python ASGI / script appspython-fastapi-docker (AddUvicornApp), polyglot-event-stream (AddPythonApp)
AddGoApp() — first-class Aspire.Hosting.Go (new in 13.4; Community Toolkit Golang deprecated)A Go module (go run, auto-Dockerfile on publish)discussed — repo currently orchestrates Go via AddDockerfile/AddExecutable; see Go apps in the AppHost
AddBunApp()Aspire.Hosting.JavaScript (now core in 13.4)A Bun app/scriptdiscussed — see Bun integration
AddDenoApp() / AddDenoTask() — Community ToolkitA Deno run script or deno taskdiscussed — see Deno apps in the AppHost
AddBlazorWasmProject() + AddBlazorGateway() (13.4 preview)Blazor WebAssembly + browser-facing gatewaydiscussed — see Blazor hosting
AddSpringApp() — Community ToolkitA Java Spring Boot appdiscussed — spring-boot-postgres orchestrates Spring via AddDockerfile
AddDockerfile()Any language built from a Dockerfilego-redis-compose (Go), java-javalin-redis (Java), hono-redis-urls & vite-react-api (Node/Python)
AddContainer()Any prebuilt public imagepostgres-adminer, and Redis in java-javalin-redis / hono-redis-urls
AddExecutable()Any process/CLIsvelte-go-bookmarks (runs npm for the Svelte dev server)

3. The polyglot glue (works in every language, no SDK required)

These wire the services together regardless of language — every runtime reads plain environment variables:

  • Service discovery — Aspire injects services__<name>__<protocol>__<index> into each service.
  • Connection strings — resources publish ConnectionStrings__<resource> to their consumers (WithReference).
  • OpenTelemetry — any app that speaks OTLP shows up in the dashboard; the standalone dashboard needs no AppHost at all.
  • Publishingaspire publish targets Docker Compose (AddDockerComposeEnvironment), Kubernetes, or bakes SPAs into a container (PublishWithContainerFiles), independent of workload language.

Learn More

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages