Server-driven web apps, made simple.
Build interactive ASP.NET Core applications without JavaScript framework complexity.
One event, multiple UI updates, zero client-side state.
A server-driven UI toolkit for ASP.NET Core
Swap.Htmx is a small .NET library that helps you build interactive ASP.NET Core MVC apps using server-rendered HTML. It pairs naturally with HTMX so your UI stays “just HTML” while still feeling modern and dynamic.
Instead of pushing JSON into a client framework, you return HTML from your controllers. Swap.Htmx makes it easy to return full pages or partial updates, coordinate multi-part UI updates, and keep UI state on the server (without maintaining a big client-side state store).
See how simple it is
Update multiple UI components with one event
return SwapResponse()
.WithView("_ProductCard", product)
.AlsoUpdate("cart-count", "_CartCount", count)
.WithSuccessToast("Added to cart!")
.Build();
One controller action, multiple UI updates. No client-side state management. No context switching.
The Problem
Modern web development shouldn't require learning an entirely new paradigm.
HTML was designed to be stateless. Forms submit. Servers respond. The web was simple, fast, and accessible to everyone.
Then we added JavaScript frameworks to make things "interactive" — and lost that simplicity. State management, build pipelines, hydration... all for a dashboard or form-heavy app?
The Solution
Swap.Htmx brings the simplicity back.
Write C# on the server. Return HTML. Let HTMX handle the interactivity. HTML is stateless again. No client-side state synchronization. No context switching between languages.
Just the web, the way it was meant to be.
Why Server-Driven?
Discover why teams are moving away from complex JavaScript frameworks and embracing the simplicity of server-driven architecture with HTMX.
Everything you need
SwapView
Auto-detects HTMX requests and returns partials or full pages automatically. Write once, works everywhere.
SwapResponse
Fluent API for multi-target updates. Toasts, triggers, and OOB swaps in one call. Coordinate complex UIs simply.
SwapState
Server-side state management without sessions. Hidden field persistence. State that travels with your forms.
Event System
Decouple controllers from UI updates with handler-based architecture. Publish once, update everywhere.
Real-time Support
SSE and WebSocket support with Redis backplane for scaling. Push updates to connected browsers.
Source Generators
Type-safe view names and compile-time element IDs. No more magic strings. Zero configuration required.
Stay in the Loop
Get tutorials, release updates, and exclusive discounts. No spam, unsubscribe anytime.
Ready to simplify your .NET web development?
Open source. MIT Licensed. Production ready.