chore: derive AppHost resource names from the app namespace#1261
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 readfsh-*.What changed (
AppHost.csonly)volumePrefix→appPrefix, since it now namespaces both volumes and resource/container names) and built each FSH app resource name as$"{appPrefix}-…".Acme.Storefsh-starter-apiacme-store-apifsh-starter-db-migratoracme-store-db-migratorfsh-starter-demo-seederacme-store-demo-seederfsh-starter-adminacme-store-adminfsh-starter-dashboardacme-store-dashboardLeft literal: third-party infra (
postgres,redis,minio,minio-init) and thefsh-dbdatabase 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