Aspire + modular monolith · .NET 10

Portfolio

Intentionally overengineered.

View on GitHub ↗

This portfolio is intentionally overengineered: a working demonstration of Aspire and a modular monolith. Clear ownership, repeatable startup and visible request flow are the point.

Aspire / PodmanModular monolithBlazor WASMEF Core / SQLiteGitHub Actions / Docker

Two ideas, one working example

A small portfolio

Real page reads and contact submissions.

Aspire

Wire, run and observe the local stack.

Modular monolith

Separate ownership inside one API.

Aspire handles the running pieces. Module boundaries handle the code inside the API. Neither requires turning the modules into microservices.

Purpose

An architecture demo with real workloads.

Aspire

One startup definition; connected diagnostics.

Modular monolith

Explicit ownership without separate service deployments.

What the extra structure buys

Profiles, case studies and contact mail keep the examples small.

One place to wire the stack

AppHost centralizes endpoints, configuration and startup dependencies. One command starts the preview.

Ownership you can check

Three modules share an API, with implementation references checked by architecture tests.

A visible side effect

Local contact tests land in smtp4dev. Production sends real mail through Google Workspace, with credentials kept on the server.

Three modules. One API.

One API process avoids a separate deployment and network boundary for each feature.

API host

Composes the modules; rules stay inside them.

Profile

Biography, links, skills and career.

Projects

Listings, documents and content validation.

Contact

Message validation and SMTP delivery.

The five layers used by each module
LayerResponsibility

Public

DTOs and contracts another module may reference.

Domain

Framework-free models and invariants.

Application

HTTP endpoints, use cases and persistence/delivery ports.

Infrastructure

EF Core storage or SMTP adapters.

Tests

Behavior checks within that module.

Profile and Projects share a SQLite file, not tables or contexts. Contact stores no messages. Architecture tests reject foreign implementation references and cycles.

Aspire: run it, then inspect it

In development, AppHost supplies API addresses and SMTP settings, then waits for dependencies. That replaces separate launch commands and manually synchronized configuration.

Aspire

Service wiring, startup order and diagnostics.

localhost:5420

Frontend

API address supplied by AppHost.

localhost:5410

API

Module endpoints; waits for mail capture.

localhost:5430

smtp4dev

Capture mail without a live email account.

The local dashboard groups logs, HTTP traces and health by resource. SQLite uses a file; smtp4dev holds test mail. Production uses Docker and real SMTP, not the development stack.

Follow a page read

Open a case study and follow its frontend-to-API request in the dashboard. Projects owns the document.

Inspect a side effect

Submit the contact form and inspect its message in smtp4dev. The UI confirms local capture, not inbox delivery.

The frontend, in brief

The frontend demonstrates prerendered WASM, not a persistent server circuit.

  1. Prerender

    The site host reads the API and returns populated HTML.

  2. Hand off

    Public data and error state travel with the page. WASM starts without fetching them again.

  3. Interact

    Palette, expanders and loaded examples run in the browser. New documents and email still need the API.

Browser requests use /api on the site origin; YARP forwards them to the backend. No Server or Auto render mode.

Change, check, ship

Business changes stay in their module; UI stays in the frontend. GitHub Actions checks pull requests and main pushes; successful current-main builds deploy automatically.

Case studies are JSON documents with Markdown and typed blocks. Validation runs before import; stable IDs update records, while unlisted content is preserved.

Content changes
bash scripts/dev.sh validate
bash scripts/dev.sh import

Content updates are explicit, never startup seeds.

Preview and checks
bash scripts/dev.sh

# In another terminal:
PORTFOLIO_BROWSER_URL=http://127.0.0.1:5420 \
  bash scripts/verify.sh

Requires the pinned SDK and rootless Podman. Verify runs architecture/module/API tests, EF model checks and browser smoke. Use the same suite to check trimmed Release output.

  1. Verify

    Build and test the solution, validate content and check EF models against migrations. Browser smoke runs the published containers with fresh SQLite and disposable SMTP capture—not the live mailbox.

  2. Publish

    Reuse the tested publish outputs for three commit-tagged Docker images: frontend host, API and migration/import tool. Push them to GitHub Container Registry without rebuilding the application.

  3. Deploy

    A restricted SSH command serializes releases, snapshots SQLite, applies migrations and imports content. It starts the new containers, verifies populated HTTPS content and restores previous images/data if checks fail.

Nginx handles HTTPS. The non-root containers run the frontend and API; persistent data and secrets stay outside their images. Deployments briefly stop the site—they aren't zero-downtime switches.