I've been diving into using Express.js with server-side rendering (SSR) alongside EJS and Alpine.js. I've got to say, the SEO results are impressive when utilizing Express for SSR! But I've got mixed feelings about incorporating HTMX into my stack. I believe that if you find yourself relying on multiple micro-frontend libraries, it might be worth considering a full-fledged frontend framework like Svelte to streamline things.
Here's a quick overview of my current SSR setup:
1. Express
2. EJS
3. Alpine
4. Tailwind
5. Knex
6. Raw SQL
7. better-sqlite3 for MVPs only.
For my full-stack arrangement, I'm using Express on one server and Svelte as a separate SPA on another, with credential-based auth via sessions instead of JWT. I've also set up sessions with cookies and CORS for handling requests properly.
Adding a frontend framework can be a smoother transition than it seems, but I'm curious if HTMX would actually be beneficial in this setup, or if it's more of a distraction. What do you all think?
2 Answers
I see it differently! HTMX and Alpine address different challenges—Alpine focuses on client-side state and interactions, whereas HTMX is all about making server-driven updates without full page reloads. Adding HTMX to your Express and EJS setup doesn't force you into a full SPA, keeping your SEO-friendly approach intact, which is a big plus. You really reach for a full framework only when you need extensive client-side state management across views.
The decision to add HTMX really hinges on the type of interactivity your application needs. If it’s just form submissions or updating modals, HTMX can help maintain the SSR focus without having to switch to managing client-side state. Alpine can handle the UI aspects while HTMX manages server communication. But if your project requires a lot of complex interactions or state management, then moving to a SPA framework like Svelte could be the better option.

Thanks for your insights! I’ve really liked my SSR setup so far, especially seeing great SEO scores. It does seem that using HTMX could work well to maintain this efficiency without going the full SPA route.