Skip to content

chore: derive AppHost resource names from the app namespace#1261

Merged
iammukeshm merged 1 commit into
mainfrom
chore/apphost-dynamic-resource-names
May 27, 2026
Merged

chore: derive AppHost resource names from the app namespace#1261
iammukeshm merged 1 commit into
mainfrom
chore/apphost-dynamic-resource-names

Conversation

@iammukeshm
Copy link
Copy Markdown
Member

Why

The .NET Aspire resource names in the AppHost were hardcoded (fsh-api, fsh-db-migrator, …). For a CLI-scaffolded app (fsh new Acme.Store) those should carry the app's own namespace, not the kit's — exactly like the per-app Docker volume prefix already does. Otherwise every scaffolded app's Aspire dashboard / container names read fsh-*.

What changed (AppHost.cs only)

  • Reused the existing namespace-derived prefix (renamed volumePrefixappPrefix, since it now namespaces both volumes and resource/container names) and built each FSH app resource name as $"{appPrefix}-…".
Resource This repo Scaffolded Acme.Store
API fsh-starter-api acme-store-api
Migrator fsh-starter-db-migrator acme-store-db-migrator
Demo seeder fsh-starter-demo-seeder acme-store-demo-seeder
Admin fsh-starter-admin acme-store-admin
Dashboard fsh-starter-dashboard acme-store-dashboard

Left literal: third-party infra (postgres, redis, minio, minio-init) and the fsh-db database resource — the DB name flows into connection strings and the persistent data volume, so renaming it would orphan existing local data.

Safe: resource cross-refs use C# variables (not name strings), and the React apps get the API URL via api.GetEndpoint(...) (object ref), so service discovery is unaffected. Build is clean.

Docs updated separately in fullstackhero/docs (the open template-fixes PR).

🤖 Generated with Claude Code

The Aspire resource names were hardcoded `fsh-*`. Derive them from the
AppHost assembly name — the same prefix already used for the Docker volume
names — so a CLI-scaffolded app gets resources under its OWN namespace (e.g.
`acme-store-api`) instead of the kit's. Renamed `volumePrefix` -> `appPrefix`
since the one prefix now namespaces both volumes and resource/container names.

Affected resources: api, db-migrator, demo-seeder, admin, dashboard (this repo
resolves them to `fsh-starter-*`). Third-party infra (postgres/redis/minio) and
the `fsh-db` database resource are intentionally left literal — the DB name
flows into connection strings and the persistent data volume.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@iammukeshm iammukeshm merged commit 130acd7 into main May 27, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant