Skip to content

feat: add an Aspire sample host for local testing and as a setup demo#68

Merged
andregoepel merged 7 commits into
mainfrom
feat/aspire-sample-host
Jul 5, 2026
Merged

feat: add an Aspire sample host for local testing and as a setup demo#68
andregoepel merged 7 commits into
mainfrom
feat/aspire-sample-host

Conversation

@andregoepel

Copy link
Copy Markdown
Owner

Adds a runnable example under samples/ so the foundation can be exercised end-to-end and so the host-side wiring is demonstrated in-repo (the real consumer lives in a separate repo).

What

Project Role
samples/AndreGoepel.AppFoundation.Sample Minimal Blazor Server host consuming the packages — the reference Program.cs, App.razor, Routes.razor, _Imports.razor, a / landing page, and wwwroot/app.css. Wires AddAppFoundation / UseAppFoundation, the router's additional assemblies, and MapAdditionalIdentityEndpoints.
samples/AndreGoepel.AppFoundation.AppHost .NET Aspire orchestrator — starts PostgreSQL (with a data volume) and the web app, wiring the appfoundation-database connection string and WaitFor-ing the DB.

Run it:

dotnet run --project samples/AndreGoepel.AppFoundation.AppHost

Open the Aspire dashboard, start the web resource; the first visit funnels to /Setup (create the admin), then sign in and explore the dashboard + Administration. A README "Try it locally" section documents this, and .aspire/settings.json now points at the in-repo AppHost.

Notes / decisions

  • In Development everything runs with zero extra configAutoCreate.All, no key-ring cert required (the fail-closed check is non-Dev only), forwarded-headers trust-all. So the demo just works against the Aspire-provided Postgres.
  • AppHost opts out of CPM and lock files. The Aspire.AppHost.Sdk injects RID-specific orchestration/dashboard packages, so a committed lock file would be win-x64/linux-x64 dependent and break CI's --locked-mode restore across OSes. The sample keeps a portable lock file; both projects are IsPackable=false, so nothing new is published.
  • Self-contained inline SVG logo so the sample ships no binary asset.

Verification

  • dotnet build -c Release (full solution incl. both new projects) — 0 errors.
  • dotnet restore --locked-mode — clean (AppHost correctly excluded).
  • dotnet test -c Release — 80/80 (unchanged).
  • The wiring was checked against the AndreGoepel.Marten.Identity.Blazor package's own README and public API (MapAdditionalIdentityEndpoints, RedirectToLogin, LoginLayout, Aspire 13.x AddPostgres/AddDatabase/AddProject<T>/WithReference/WaitFor).

⚠️ Not runtime-verified here: launching the full Aspire stack needs a container runtime and is a long-running orchestration, so I verified build + CI-parity + API conformance rather than a live dotnet run. Worth one manual dotnet run on your side to confirm the dashboard/web come up and /Setup flows.

Branched off main, so it's independent of the open feature PRs.

@andregoepel
andregoepel force-pushed the feat/aspire-sample-host branch from 09d34a0 to 6e902a2 Compare July 5, 2026 03:01
@andregoepel
andregoepel changed the base branch from main to feat/configurable-login-features July 5, 2026 03:01
@andregoepel

Copy link
Copy Markdown
Owner Author

Rebased this branch onto feat/configurable-login-features (#67) and retargeted the PR base to it, so the sample now demonstrates the Administration → Login Features admin page too (it lives in #67, which wasn't on main). The sample lock file was synced to AndreGoepel.Marten.Identity.Blazor 1.2.0-preview1 to match.

Merge order: #67 first, then this. Once #67 lands on main I'll rebase this onto main and retarget the base back to main.

Add a runnable example under samples/:

- AndreGoepel.AppFoundation.Sample — a minimal Blazor Server host that wires
  the packages exactly as the README describes (AddAppFoundation /
  UseAppFoundation, App.razor, Routes.razor, MapAdditionalIdentityEndpoints).
- AndreGoepel.AppFoundation.AppHost — a .NET Aspire orchestrator that starts
  PostgreSQL (with a data volume) and the web app, wiring the
  appfoundation-database connection string.

Run with: dotnet run --project samples/AndreGoepel.AppFoundation.AppHost.

The AppHost opts out of central package management and lock files because the
Aspire SDK injects RID-specific packages that aren't portable across OSes
(would break CI locked-mode restore); the sample keeps a portable lock file.
Both are IsPackable=false. Adds a "Try it locally" README section and points
.aspire/settings.json at the in-repo AppHost.
The management layout (MainLayout) carries interactive click handlers — the
sidebar toggle, profile menu, and the RadzenPanelMenu in NavMenu. A layout is
rendered statically under per-page interactivity, so those handlers never wired
up and the menus appeared dead ("js not working").

Apply the render mode globally on <Routes> and <HeadOutlet> so the layout is
interactive. Verified this does not conflict with the foundation's per-page
@rendermode InteractiveServer pages (a matching descendant render mode is
allowed).
@andregoepel
andregoepel force-pushed the feat/aspire-sample-host branch from 3732f81 to 6fb07a4 Compare July 5, 2026 03:21
@andregoepel
andregoepel changed the base branch from feat/configurable-login-features to main July 5, 2026 03:21
@andregoepel andregoepel closed this Jul 5, 2026
@andregoepel andregoepel reopened this Jul 5, 2026
@andregoepel
andregoepel merged commit 11a8161 into main Jul 5, 2026
3 checks passed
@andregoepel
andregoepel deleted the feat/aspire-sample-host branch July 5, 2026 07:31
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