Project templates for Swap.Htmx - The Reactive UI Orchestration library for ASP.NET Core. Includes MVC starter and modular monolith templates with pre-configured HTMX, DaisyUI 5, Tailwind CSS v4, LibMan, EF Core, and Source Generators.
$ dotnet add package Swap.TemplatesThis package contains project templates for building Swap.Htmx applications.
Install the templates from NuGet:
dotnet new install Swap.Templates
The Modular Monolith template is the best way to start a new Swap.Htmx project. It provides a well-structured foundation that scales from prototypes to production applications.
dotnet new swap-modular -n MyApp
cd MyApp/src
libman restore
dotnet run
Open https://localhost:5001 and you have a working application with:
| Template Name | Short Name | Description |
|---|---|---|
| Swap.Htmx Modular Monolith | swap-modular | Recommended. Full-featured modular monolith with SQLite, EF Core, Docker, and a sample Notes module. |
| Swap.Htmx MVC App | swap-mvc | A clean, minimal MVC project with Swap.Htmx pre-configured. |
dotnet new swap-modular -n MyApp
cd MyApp/src
libman restore
dotnet run
dotnet new swap-mvc -n MyProject
cd MyProject
libman restore
dotnet run
Notes:
libman restore is required to download client libraries (htmx and, if enabled, the htmx SSE extension).--IncludeSse, the template also wires up the server-side SSE event bridge.| Option | Description | Default |
|---|---|---|
--IncludeSse | Include SSE real-time support. | false |
--SkipSampleModule | Skip the sample Notes module. | false |
--UseLocalRef | Use local project references (for Swap development). | false |
| Option | Description | Default |
|---|---|---|
--IncludeSse | Include HTMX SSE extension for real-time updates. | false |
--UseLocalRef | Use local project references (for Swap development). | false |
# Modular monolith with SSE real-time support
dotnet new swap-modular -n RealtimeApp --IncludeSse
# Modular monolith without sample module (clean slate)
dotnet new swap-modular -n CleanStart --SkipSampleModule
# Minimal MVC with SSE
dotnet new swap-mvc -n SimpleApp --IncludeSse
A production-ready foundation with best practices built in:
Architecture
Modules/ — Self-contained feature modules with their own Controllers, Models, Views, and EventsInfrastructure/ — Cross-cutting concerns (compression, data protection, health checks)Data/ — EF Core DbContext with audit fields and configurationsFeatures
<swap-nav> Tag Helper — Clean navigation links without verbose HTMX attributesSwapViews and SwapElements auto-generated (no .csproj setup needed)/health endpoint for container orchestrationSample Module
Testing