Why you should choose HTMX for your next web-based side project - and ditch the crufty MPA and complex SPA
Essay - Published: 2024.02.23 | 2 min read (743 words)
create | hamstack | htmx | mpa | spa | tech
DISCLOSURE: If you buy through affiliate links, I may earn a small commission. (disclosures)
I build a lot of side projects so I'm always on the lookout for technologies and paradigms that allow me to build them faster and cheaper at a similar quality. For the last several months I've been experimenting with building web apps with low-js tools like HTMX and Alpine.
In this post I'll share why I think HTMX is a great choice for building web apps faster and cheaper and why it's now a core part of my tech stack - The HAM Stack.
MPA vs SPA

Multi-Page Apps (MPA)
In the beginning we had Multi-Page Apps (MPA).
- Each URL goes to a web page
- This web-page is rendered server-side and sent back to the user
- If you need to update something on the page (because a user changes something or it needs to refresh) then the full page needs to reload
This works fine but it gives a very slow / clunky feel because you need to reload EVERYTHING any time one thing on the page changes. For an example of this - think of a State government website, most of those are still old-school MPAs and they feel old and clunky compared to most modern apps.
MPA Pros and Cons
- Pros: Simple to build
- Cons: Feels slow and clunky due to refreshes
Single-Page Apps (SPA)
To solve this, Single-Page Apps (SPA) were created.
- A URL loads a large JS payload containing a bunch of app logic
- This JS takes over page rendering
- It uses internal state to determine what the page should look like and does data transfers behind the scenes so it only needs to update the parts of the page that need to change
This feels better to the user because changes feel faster. The page only updates where it needs to and we don't need a full page refresh to change data. Most apps / websites today feel like this because it generally provides a better user experience.
- Pros: Rich "modern" user experiences
- Cons: Complex at scale - dealing w data transfers (graphQL was built for this), abstractions, and app logic payload sizes
So in general:
- Multi-Page Apps (MPA) - Simple to build but hard to get rich "modern" user experiences
- Single-Page Apps (SPA) - Complex to build but can achieve rich "modern" user experiences
MPA vs HTMX vs SPA

Image inspiration from u/Abhilash26 on r/htmx.
HTMX has been around for several years but has really gained mass hype in the past year or so. The hype is not unfounded - it often allows you to build modern web apps faster and cheaper than a SPA.
HTMX essentially extends HTML so that it can do partial page reloads.
- Any element can specify how it can retrieve up-to-date data and when it should do that
- The element can then specify what to do with the new data - replacing itself or other elements on the page
If we look back at the MPA vs SPA comparison, we can see that the lack of partial page reloads is really the main thing holding MPAs back. So adding this capability into an MPA largely allows you to get most of the rich "modern" user experiences of a SPA with the complexity level of an MPA.
HTMX for Side Projects
The goal of a side project is often just to build the thing. You likely don't have a team of engineers or warchest of VC-money to do so - it's just you and your computer.
So lowering the cost of building - in time and money - is crucial to making a side project successful.
From my perspective, HTMX provides a great balance between allowing you to build modern apps with very low complexity (and thus time and money cost). Thus it's become a core part of my tech stack - the HAM Stack.
Next
If you liked this post you might also like:
- HTMX > SPA - How HTMX allows you to build modern web apps faster and cheaper than bloated client-side SPA Frameworks
- HTMX + F# - Simple Interactive Islands with F# and HTMX
- Faster, cheaper side projects - 3 Areas I'm exploring to build more side projects faster and cheaper in 2024
Want more like this?
The best way to support my work is to like / comment / share this post on your favorite socials.
Inbound Links
- Sponsor HAMY LABS
- Is HTMX Dying?
- HAMY LABS - 2024 Review
- The State of HTMX (2024)
- 1 Simple Reason to Build your Next Web App with HTMX
- How to Validate Side Project Ideas - and Build Projects You’re Proud Of
- How to Build Simple Web Polling with HTMX (with Examples)
- Introducing 1000checkboxes.xyz - a Real-Time, Globally Synced Display of 1000 Checkboxes
- 2024.H1 Review
- How to Build a Fullstack Webapp with F#
- How I style HTMX apps with Tailwind CSS
- How HTMX Unlocks Faster Webpage Reloads vs MPAs (Multi-Page Applications)
- Comparing HTMX vs MPA (Multi-Page Application) Page Load Performance
- Generating Fullstack Project Ideas with F#
- Does Digital Ocean App Platform Support Scale-to-zero Autoscaling?
- How to style HTMX apps with CSS
- What it’s like to run HTMX in Production - Stories from Experienced Software Engineers
- Top 10 Posts from 2024.Q1
- 2024.Q1 Review
- How much money my 2k subscriber YouTube channel made in its first month of monetization
- Simple Scalable Systems - How to find 80/20 Silver Bullet Solutions for any domain
- Why Type-safe Programming Languages are better than Dynamic and Lead to Faster, Safer Software at Scale
- 2024.02: Release Notes
Outbound Links
- HTMX vs AlpineJS - Which should you use for your web app?
- The HAM Stack - A Simple Scalable Tech Stack for building modern web apps fast and cheap
- How HTMX allows you to build modern web apps faster and cheaper than bloated client-side SPA Frameworks
- Simple Interactive Islands with F# and HTMX
- 3 Areas I'm exploring to build more side projects faster and cheaper in 2024
