Instruction file imported from johnspence0212/vue-shadcn-template (
.cursor/rules/aspire-orchestration.mdc). Copyright stays with the author.
Aspire Orchestration
AppHost (aspire/AppHost/Program.cs)
var api = builder.AddProject<Projects.Api>("api")
.WithHttpHealthCheck("/health");
var web = builder.AddNpmApp("web", "../../apps/web", "dev")
.WithReference(api)
.WithEnvironment("VITE_API_BASE_URL", api.GetEndpoint("http") + "/api")
.WithHttpEndpoint(env: "PORT")
.WithExternalHttpEndpoints();
ServiceDefaults
aspire/ServiceDefaults/Extensions.cs — OpenTelemetry, health checks (/health, /alive), service discovery, HTTP resilience.
API calls builder.AddServiceDefaults() and app.MapDefaultEndpoints().
Run
dotnet run --project aspire/AppHost
Dashboard shows api + web URLs. Web receives injected VITE_API_BASE_URL.
Docker vs Aspire
| Aspire AppHost | Docker Compose | |
|---|---|---|
| Purpose | Local dev orchestration | Optional deployment |
| Web | Vite dev server (HMR) | nginx + static dist |
| Run | dotnet run --project aspire/AppHost |
docker compose up --build |
Do not replace Aspire with Docker for day-to-day development. Skill: run-docker-deploy.
Adding resources
Use skill add-aspire-resource for databases, caches, or additional projects.
// ❌ BAD — hardcoding web URL in AppHost without WithReference
// ✅ GOOD — WithReference(api) + GetEndpoint for service discovery