From ee994e3d2794a0bafcf9b786dd0ec15b1aa06fbf Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 13 Jan 2026 02:50:15 +0000
Subject: [PATCH 1/4] Initial plan
From dcc3196f8f652782f26dc6ffcf63dc737e220ff4 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 13 Jan 2026 02:57:47 +0000
Subject: [PATCH 2/4] Add Go, Java, and Node.js updates to
add-aspire-existing-app.mdx
Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
---
.../get-started/add-aspire-existing-app.mdx | 533 +++++++++++++++++-
1 file changed, 504 insertions(+), 29 deletions(-)
diff --git a/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx b/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx
index 6721c9d6..d69c71d7 100644
--- a/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx
+++ b/src/frontend/src/content/docs/get-started/add-aspire-existing-app.mdx
@@ -16,11 +16,13 @@ import Pivot from '@components/Pivot.astro';
options={[
{ id: "csharp", title: "C#" },
{ id: "python", title: "Python" },
- { id: "javascript", title: "JavaScript" },
+ { id: "nodejs", title: "Node.js" },
+ { id: "go", title: "Go" },
+ { id: "java", title: "Java" },
]}
/>
-This guide shows you how to add Aspire orchestration to an existing application, whether it's written in C#, Python, JavaScript, or a mix of these languages. Instead of starting from scratch, you'll use the `aspire init` command to incrementally adopt Aspire in your current project.
+This guide shows you how to add Aspire orchestration to an existing application, whether it's written in C#, Python, Node.js, Go, Java, or a mix of these languages. Instead of starting from scratch, you'll use the `aspire init` command to incrementally adopt Aspire in your current project.
:::note[Definition]{icon="approve-check-circle"}
**Aspireify** (verb): To transform an existing application into a distributed, observable, and orchestrated system by adding Aspire—no cape required, just a few commands!
@@ -30,7 +32,7 @@ This guide shows you how to add Aspire orchestration to an existing application,
As distributed applications grow, coordinating multiple services becomes a tangled web of configuration files, hard-coded URLs, and fragile startup scripts. You're juggling connection strings across environments, manually wiring service dependencies, and struggling to trace issues across your microservices. Development setup becomes a ritual of precision—start the database, then the cache, then service A before service B—and any misstep sends you back to square one.
-Aspire cuts through this complexity with a unified orchestration layer that treats your entire application as a cohesive system. Define your services and their relationships once in code ([the AppHost](/get-started/app-host/)), and Aspire handles service discovery, injects configuration automatically, and provides a dashboard with logs, traces, and metrics out of the box. Whether you're orchestrating C#, Python, or JavaScript services—or all three together—you get the same consistent experience from development through deployment.
+Aspire cuts through this complexity with a unified orchestration layer that treats your entire application as a cohesive system. Define your services and their relationships once in code ([the AppHost](/get-started/app-host/)), and Aspire handles service discovery, injects configuration automatically, and provides a dashboard with logs, traces, and metrics out of the box. Whether you're orchestrating C#, Python, Node.js, Go, Java services—or all of them together—you get the same consistent experience from development through deployment.
The best part? You can adopt Aspire incrementally. Start with orchestration, add observability when you're ready, integrate external services as needed. Your existing codebase stays largely unchanged, and you can reverse course if Aspire isn't the right fit.
@@ -78,13 +80,13 @@ Before you begin, ensure you have the following prerequisites installed based on
- Streamlit or other Python web frameworks
-
+
-**For JavaScript/TypeScript applications:**
+**For Node.js/TypeScript applications:**
- [Node.js 22 or later](https://nodejs.org/) installed
- npm, yarn, or pnpm for package management
-- An existing JavaScript/TypeScript application
+- An existing Node.js/TypeScript application
**Example application types:**
- React, Vue, or Svelte applications (especially Vite-based)
@@ -93,6 +95,37 @@ Before you begin, ensure you have the following prerequisites installed based on
- Angular applications
- TypeScript backend services
+
+
+
+**For Go applications:**
+
+- [Go 1.21 or later](https://go.dev/dl/) installed
+- An existing Go application
+
+**Example application types:**
+- HTTP servers using net/http, Gin, or Echo
+- gRPC services
+- CLI applications
+- Microservices
+- API backends
+
+
+
+
+**For Java applications:**
+
+- [Java 17 or later](https://adoptium.net/) installed
+- Maven or Gradle for dependency management
+- An existing Java application
+
+**Example application types:**
+- Spring Boot applications
+- Jakarta EE applications
+- Micronaut applications
+- Quarkus applications
+- Java microservices
+
-
+
```bash title="Navigate to your workspace root"
cd /path/to/your-workspace
```
+
+ ```bash title="Navigate to your Go module root"
+ cd /path/to/your-go-module
+ ```
+
+
+ ```bash title="Navigate to your project root"
+ cd /path/to/your-project
+ ```
+
2. Run `aspire init` to initialize Aspire support:
@@ -157,10 +200,22 @@ The `aspire init` command is the starting point for adding Aspire to your existi
- Analyze your Python applications and suggest which ones to add to the orchestration
- Install necessary Aspire packages
-
+
- Detect your existing workspace structure
- Create a file-based AppHost (`apphost.cs`)
- - Analyze your JavaScript/Node.js applications and suggest which ones to add to the orchestration
+ - Analyze your Node.js/JavaScript applications and suggest which ones to add to the orchestration
+ - Install necessary Aspire packages
+
+
+ - Detect your existing Go module structure
+ - Create a file-based AppHost (`apphost.cs`)
+ - Analyze your Go applications and suggest which ones to add to the orchestration
+ - Install necessary Aspire packages
+
+
+ - Detect your existing project structure
+ - Create a file-based AppHost (`apphost.cs`)
+ - Analyze your Java applications and suggest which ones to add to the orchestration
- Install necessary Aspire packages
@@ -221,7 +276,7 @@ After running `aspire init`, your project will have a file-based AppHost:
A typical SaaS application with FastAPI backend, Flask frontend, and Celery worker.
-
+
After running `aspire init`, your project will have a file-based AppHost:
@@ -250,6 +305,61 @@ After running `aspire init`, your project will have a file-based AppHost:
A typical monorepo with Node.js API, React storefront, and admin dashboard.
+
+After running `aspire init`, your project will have a file-based AppHost:
+
+
+- my-service/
+ - **apphost.cs** (new) orchestration code
+ - **apphost.run.json** (new) configuration
+ - api/
+ - main.go
+ - handlers/
+ - models/
+ - go.mod
+ - web/
+ - src/
+ - App.tsx
+ - components/
+ - package.json
+ - vite.config.ts
+ - worker/
+ - main.go
+ - tasks/
+ - go.mod
+ - go.work (workspace file)
+
+
+A typical Go workspace with HTTP API, React frontend, and background worker.
+
+
+After running `aspire init`, your project will have a file-based AppHost:
+
+
+- my-app/
+ - **apphost.cs** (new) orchestration code
+ - **apphost.run.json** (new) configuration
+ - api/
+ - src/
+ - main/
+ - java/
+ - com/example/api/
+ - Application.java
+ - controllers/
+ - resources/
+ - application.properties
+ - pom.xml
+ - web/
+ - src/
+ - App.tsx
+ - components/
+ - package.json
+ - vite.config.ts
+ - pom.xml (parent POM)
+
+
+A typical Spring Boot application with REST API and React frontend.
+
The `AppHost.cs` file in your new AppHost project initially contains a minimal starter:
@@ -277,7 +387,35 @@ builder.Build().Run();
```
-
+
+The `apphost.cs` file initially contains a minimal starter:
+
+```csharp title="apphost.cs — Initial state after aspire init"
+#:sdk Aspire.AppHost.Sdk@13.1.0
+
+var builder = DistributedApplication.CreateBuilder(args);
+
+// TODO: Add resources here
+
+builder.Build().Run();
+```
+
+
+
+The `apphost.cs` file initially contains a minimal starter:
+
+```csharp title="apphost.cs — Initial state after aspire init"
+#:sdk Aspire.AppHost.Sdk@13.1.0
+
+var builder = DistributedApplication.CreateBuilder(args);
+
+// TODO: Add resources here
+
+builder.Build().Run();
+```
+
+
+
The `apphost.cs` file initially contains a minimal starter:
```csharp title="apphost.cs — Initial state after aspire init"
@@ -314,14 +452,32 @@ For Python applications, install the Python hosting package:
This package provides methods like `AddUvicornApp`, `AddPythonApp`, and `AddPythonModule`.
-
+
-For JavaScript/TypeScript applications, install the JavaScript hosting package:
+For Node.js/JavaScript applications, install the JavaScript hosting package:
This package provides methods like `AddViteApp`, `AddNodeApp`, and `AddJavaScriptApp`.
+
+
+
+For Go applications, install the Go hosting package from the Community Toolkit:
+
+
+
+This package provides methods like `AddGolangApp` and `AddGolangExecutable`.
+
+
+
+
+For Java applications, install the Java hosting package from the Community Toolkit:
+
+
+
+This package provides methods like `AddSpringApp`, `AddMavenApp`, and `AddJavaApp`.
+
### Model your resources in the AppHost
@@ -329,7 +485,7 @@ This package provides methods like `AddViteApp`, `AddNodeApp`, and `AddJavaScrip
Now update your `AppHost.cs` file in the AppHost project to register your applications as resources. Resources are the building blocks of your distributed application—each service, container, or infrastructure resource becomes something Aspire can orchestrate.
-
+
Now update your `apphost.cs` file to register your applications as resources. Resources are the building blocks of your distributed application—each service, container, or infrastructure resource becomes something Aspire can orchestrate.
@@ -399,9 +555,9 @@ builder.Build().Run();
- `WithPip()` - Use traditional pip for package management
-
+
-For JavaScript applications, use the appropriate method based on your application type:
+For Node.js applications, use the appropriate method based on your application type:
```csharp title="apphost.cs — Complete monorepo example"
#:sdk Aspire.AppHost.Sdk@13.1.0
@@ -465,10 +621,109 @@ builder.AddViteApp("frontend", "./frontend")
Option 2 keeps all script configuration in `package.json`, making your scripts more discoverable and easier to run outside of Aspire (e.g., `npm run dev:no-open`).
:::
+
+
+
+For Go applications, use the Go hosting methods:
+
+```csharp title="apphost.cs — Complete Go microservices example"
+#:sdk Aspire.AppHost.Sdk@13.1.0
+#:package CommunityToolkit.Aspire.Hosting.Golang@13.1.0
+
+var builder = DistributedApplication.CreateBuilder(args);
+
+// Go API service
+var api = builder.AddGolangApp("api", "./api")
+ .WithHttpEndpoint(env: "PORT")
+ .WithHttpHealthCheck("/health");
+
+// Go worker service
+var worker = builder.AddGolangApp("worker", "./worker")
+ .WithReference(api);
+
+// React frontend
+var web = builder.AddViteApp("web", "./web")
+ .WithExternalHttpEndpoints()
+ .WithReference(api)
+ .WaitFor(api);
+
+builder.Build().Run();
+```
+
+**Key methods:**
+- `AddGolangApp` - For Go applications with go.mod
+- `AddGolangExecutable` - For pre-built Go binaries
+- `WithHttpEndpoint` - Configure HTTP endpoint with PORT environment variable
+- `WithReference` - Pass connection info to dependent services
+- `WaitFor` - Ensure proper startup order
+
+
+
+
+For Java applications, use the Java hosting methods:
+
+```csharp title="apphost.cs — Complete Spring Boot example"
+#:sdk Aspire.AppHost.Sdk@13.1.0
+#:package CommunityToolkit.Aspire.Hosting.Java@13.1.0
+
+var builder = DistributedApplication.CreateBuilder(args);
+
+// Spring Boot API
+var api = builder.AddSpringApp("api", "./api")
+ .WithHttpEndpoint(port: 8080)
+ .WithHttpHealthCheck("/actuator/health");
+
+// Spring Boot admin service
+var admin = builder.AddSpringApp("admin", "./admin")
+ .WithHttpEndpoint(port: 8081)
+ .WithReference(api)
+ .WaitFor(api);
+
+// React frontend
+var web = builder.AddViteApp("web", "./web")
+ .WithExternalHttpEndpoints()
+ .WithReference(api)
+ .WaitFor(api);
+
+builder.Build().Run();
+```
+
+**Key methods:**
+- `AddSpringApp` - For Spring Boot applications
+- `AddMavenApp` - For Maven-based Java applications
+- `AddJavaApp` - For generic Java applications
+- `WithHttpEndpoint` - Configure HTTP endpoint with specific port
+- `WithReference` - Pass connection info to dependent services
+- `WaitFor` - Ensure proper startup order
+
+
+builder.AddViteApp("frontend", "./frontend")
+ .WithArgs("--no-open");
+```
+
+**Option 2: Define custom scripts in `package.json` with arguments**
+
+```json title="package.json"
+{
+ "scripts": {
+ "dev": "vite",
+ "dev:no-open": "vite --no-open"
+ }
+}
+```
+
+```csharp title="apphost.cs — Reference custom script"
+builder.AddViteApp("frontend", "./frontend")
+ .WithRunScript("dev:no-open");
+```
+
+Option 2 keeps all script configuration in `package.json`, making your scripts more discoverable and easier to run outside of Aspire (e.g., `npm run dev:no-open`).
+:::
+
### Connect services
@@ -507,9 +762,9 @@ var worker = builder.AddPythonApp("worker", "../python-worker", "worker.py")
```
-
+
-```csharp title="apphost.cs — Connect JavaScript services" ".WithReference"
+```csharp title="apphost.cs — Connect Node.js services" ".WithReference"
// Omitted for brevity...
var api = builder.AddNodeApp("api", "../node-api", "server.js")
@@ -521,6 +776,36 @@ var frontend = builder.AddViteApp("frontend", "../react-frontend")
// Omitted for brevity...
```
+
+
+
+```csharp title="apphost.cs — Connect Go services" ".WithReference"
+// Omitted for brevity...
+
+var api = builder.AddGolangApp("api", "../go-api")
+ .WithHttpEndpoint(env: "PORT");
+
+var frontend = builder.AddViteApp("frontend", "../react-frontend")
+ .WithReference(api); // Frontend gets API_HTTP and API_HTTPS env vars
+
+// Omitted for brevity...
+```
+
+
+
+
+```csharp title="apphost.cs — Connect Java services" ".WithReference"
+// Omitted for brevity...
+
+var api = builder.AddSpringApp("api", "../spring-api")
+ .WithHttpEndpoint(port: 8080);
+
+var frontend = builder.AddViteApp("frontend", "../react-frontend")
+ .WithReference(api); // Frontend gets API_HTTP and API_HTTPS env vars
+
+// Omitted for brevity...
+```
+
When you call `WithReference`, you're declaring a dependency between resources. Aspire handles the rest—automatically injecting configuration at runtime and during deployment so your services can communicate seamlessly, whether running locally or in production.
@@ -612,9 +897,9 @@ Python applications can send telemetry to the Aspire dashboard using OpenTelemet
-
+
-JavaScript/Node.js applications can also send telemetry using OpenTelemetry:
+Node.js applications can also send telemetry using OpenTelemetry:
@@ -629,7 +914,7 @@ JavaScript/Node.js applications can also send telemetry using OpenTelemetry:
2. Create a telemetry configuration file:
- ```javascript title="JavaScript — telemetry.js"
+ ```javascript title="Node.js — telemetry.js"
const { NodeSDK } = require('@opentelemetry/sdk-node');
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-grpc');
@@ -653,7 +938,7 @@ JavaScript/Node.js applications can also send telemetry using OpenTelemetry:
3. Import the telemetry configuration at the top of your application entry point:
- ```javascript title="JavaScript — app.js"
+ ```javascript title="Node.js — app.js"
// This must be first!
require('./telemetry');
@@ -663,6 +948,134 @@ JavaScript/Node.js applications can also send telemetry using OpenTelemetry:
+
+
+
+Go applications can send telemetry using OpenTelemetry:
+
+
+
+1. Install OpenTelemetry packages:
+
+ ```bash title="Install OpenTelemetry packages for Go"
+ go get go.opentelemetry.io/otel
+ go get go.opentelemetry.io/otel/sdk
+ go get go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc
+ go get go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc
+ go get go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp
+ ```
+
+2. Configure OpenTelemetry in your Go application:
+
+ ```go title="Go — main.go telemetry setup"
+ package main
+
+ import (
+ "context"
+ "log"
+ "os"
+
+ "go.opentelemetry.io/otel"
+ "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
+ "go.opentelemetry.io/otel/sdk/resource"
+ "go.opentelemetry.io/otel/sdk/trace"
+ semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
+ )
+
+ func initTracer() func() {
+ ctx := context.Background()
+
+ // Get OTLP endpoint from environment
+ endpoint := os.Getenv("OTEL_EXPORTER_OTLP_ENDPOINT")
+ if endpoint == "" {
+ endpoint = "localhost:4317"
+ }
+
+ exporter, err := otlptracegrpc.New(ctx,
+ otlptracegrpc.WithEndpoint(endpoint),
+ otlptracegrpc.WithInsecure(),
+ )
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ res := resource.NewWithAttributes(
+ semconv.SchemaURL,
+ semconv.ServiceNameKey.String("api"),
+ )
+
+ tp := trace.NewTracerProvider(
+ trace.WithBatcher(exporter),
+ trace.WithResource(res),
+ )
+ otel.SetTracerProvider(tp)
+
+ return func() { tp.Shutdown(ctx) }
+ }
+ ```
+
+3. Initialize telemetry at application startup:
+
+ ```go title="Go — Initialize telemetry"
+ func main() {
+ cleanup := initTracer()
+ defer cleanup()
+
+ // ... rest of your application
+ }
+ ```
+
+
+
+
+
+
+Java applications can send telemetry using OpenTelemetry:
+
+
+
+1. Add OpenTelemetry dependencies to your `pom.xml` (Maven) or `build.gradle` (Gradle):
+
+ ```xml title="Maven — pom.xml"
+
+
+ io.opentelemetry
+ opentelemetry-api
+ 1.32.0
+
+
+ io.opentelemetry
+ opentelemetry-sdk
+ 1.32.0
+
+
+ io.opentelemetry
+ opentelemetry-exporter-otlp
+ 1.32.0
+
+
+ ```
+
+2. For Spring Boot applications, the easiest approach is to use the OpenTelemetry Java agent:
+
+ Download the agent and add it to your application startup:
+
+ ```bash title="Run with OpenTelemetry Java agent"
+ java -javaagent:path/to/opentelemetry-javaagent.jar \
+ -Dotel.service.name=api \
+ -Dotel.exporter.otlp.endpoint=http://localhost:4317 \
+ -jar your-app.jar
+ ```
+
+3. In the AppHost, specify the agent path when adding your Spring application:
+
+ ```csharp title="apphost.cs — Configure Spring Boot with OTel agent"
+ var api = builder.AddSpringApp("api", "./api", "opentelemetry-javaagent.jar")
+ .WithHttpEndpoint(port: 8080);
+ ```
+
+
+
## Add integrations (optional)
@@ -745,13 +1158,13 @@ When you add a hosting integration (like Redis) to your AppHost and reference it
```
-
+
```bash title="Add Redis client to Node.js project"
npm install redis
```
- ```javascript title="JavaScript — Configure Redis client"
+ ```javascript title="Node.js — Configure Redis client"
const redis = require('redis');
// Aspire injects CACHE_HOST and CACHE_PORT
@@ -764,6 +1177,60 @@ When you add a hosting integration (like Redis) to your AppHost and reference it
```
+
+
+ ```bash title="Add Redis client to Go project"
+ go get github.com/redis/go-redis/v9
+ ```
+
+ ```go title="Go — Configure Redis client"
+ package main
+
+ import (
+ "context"
+ "os"
+ "strconv"
+
+ "github.com/redis/go-redis/v9"
+ )
+
+ func newRedisClient() *redis.Client {
+ // Aspire injects CACHE_HOST and CACHE_PORT
+ host := os.Getenv("CACHE_HOST")
+ port := os.Getenv("CACHE_PORT")
+
+ return redis.NewClient(&redis.Options{
+ Addr: host + ":" + port,
+ })
+ }
+ ```
+
+
+
+
+ ```xml title="Maven — Add Jedis Redis client to pom.xml"
+
+ redis.clients
+ jedis
+ 5.1.0
+
+ ```
+
+ ```java title="Java — Configure Redis client"
+ import redis.clients.jedis.Jedis;
+
+ public class RedisConfig {
+ public static Jedis createRedisClient() {
+ // Aspire injects CACHE_HOST and CACHE_PORT
+ String host = System.getenv("CACHE_HOST");
+ String port = System.getenv("CACHE_PORT");
+
+ return new Jedis(host, Integer.parseInt(port));
+ }
+ }
+ ```
+
+
@@ -886,7 +1353,7 @@ builder.Build().Run();
- **Built-in dashboard** — Observability without additional tools like Prometheus/Grafana.
- **Development and deployment** — Same orchestration code works locally and can generate Docker Compose or deploy anywhere.
- **Integration libraries** — Pre-built support for databases, caches, message queues with best practices.
-- **Language-agnostic** — Works with C#, Python, JavaScript, many more, and containerized services.
+- **Language-agnostic** — Works with C#, Python, Node.js, Go, Java, many more, and containerized services.