The AHA Stack: MPA / Web Development, Simplified

Published on May 27, 2025by Claudio Teixeira

Explore the AHA Stack (Astro, HTMX, Alpine.js) – a powerful trio for building fast, server-rendered web applications with minimal client-side JavaScript.

Unveiling the AHA Stack

In the quest for simpler, yet powerful web development paradigms, the AHA Stack emerges as a compelling choice. Coined to represent the synergy of Astro, HTMX, and Alpine.js, this stack champions a return to server rendered HTML, enhanced with precise, minimal JavaScript for a rich user experience. It's about leveraging the strengths of the web platform, driven by URLs and HTTP requests, with full stack TypeScript capabilities.

The philosophy? Build robust, fast websites by reducing client side complexity, leading to more maintainable and understandable codebases.

The Core Components

The AHA Stack isn't about reinventing the wheel but rather about intelligently combining mature, well-loved tools.

Astro

Server-side rendering, templating, and routing with islands of interactivity

HTMX

Dynamic interactions with "HTML over the wire"

Alpine.js

Lightweight client-side interactivity for UI elements

PocketBase

Optional: SQLite-based backend with auth & real-time

Why Consider the AHA Stack?

  1. Simplicity & Reduced Complexity: By minimizing client-side JavaScript and relying on server-rendered HTML, the cognitive load and potential for bugs are often reduced.
  2. Performance: Sending HTML over the wire can be faster to render than large JavaScript bundles, especially on less capable devices or slower networks. Astro's partial hydration further optimizes this.
  3. Developer Experience: For those who appreciate the directness of HTML and server-side logic, AHA offers a refreshing alternative to SPA complexities. TypeScript provides type safety across the stack.
  4. Stability & Maturity: The individual tools (Astro, HTMX, Alpine.js) are well established, actively maintained, and have strong communities.
  5. Progressive Enhancement: HTMX and Alpine.js are designed to enhance existing HTML, aligning well with progressive enhancement principles.

The Sweet Spot

The AHA Stack shines for content rich sites, blogs, e-commerce platforms, and many SaaS applications where extreme client side rendering isn't a strict necessity. It offers a pragmatic balance between modern interactivity and the robustness of traditional web architecture.

While it might not replace React or Next.js for every use case, the AHA Stack provides a compelling new perspective or perhaps, a return to a time-tested one, now augmented with modern tooling. It's certainly a stack worth exploring for your next project.

Getting Started with the AHA Stack

If you're ready to dive into the AHA Stack, here are some resources to help you get started:

Example Repository

Add this repo as jumpstart: example-trellix on GitHub

Example File Structure

│
├── src/
│   ├── components/       # Contains reusable components
│   │   ├── Wordle.astro      # Main game UI component
│   │   └── AvailableLetters.astro  # Component to display available letters
│   │
│   ├── engine/           # Game logic and utilities
│   │   ├── game.ts           # Core game functions and state management
│   │   └── wordle.ts         # Utility functions for the game logic
│   │
│   ├── pages/            # Astro pages (entry points)
│   │   ├── index.astro      # The main page that renders the NewGame component
│   │   └── newgame.astro    # Sets up a new game instance and renders Wordle component
│   │
│   └── words.json        # A list of words used in the game (optional, based on implementation)
│
├── public/               # Static assets like images and styles
│   └── styles.css        # Custom styles for the game (optional)
│
├── games.json            # Stores game instances and states (suggested by the engine code)
│
├── astro.config.mjs      # Astro configuration file
├── package.json          # Project metadata and dependencies
└── README.md             # Project documentation

Comparing Modern Web Stacks

Stack ParadigmPrimary StrengthsIdeal Destination Applications
ME(R/A/V)N (SPA - NoSQL)
  • Rich, highly interactive UIs (desktop-like feel)
  • Flexible schema (MongoDB)
  • Rapid prototyping with document DB
  • Large ecosystems & talent pools
  • Complex SaaS platforms
  • Real-time data dashboards
  • Social networks, content management systems
  • Applications benefiting from schema flexibility
PERN (SPA - SQL)
  • Rich, highly interactive UIs
  • Strong data integrity & consistency (PostgreSQL)
  • Complex queries & relational data modeling
  • ACID compliance for transactions
  • Enterprise applications
  • Financial systems, E-commerce platforms
  • Applications requiring structured data & transactional reliability
Next.js (Hybrid SSR/SSG)
  • Excellent SEO performance
  • Fast initial page loads (FCP/LCP)
  • Flexible rendering (SSR, SSG, ISR)
  • Robust React ecosystem with full-stack capabilities
  • Content-rich websites (blogs, marketing sites)
  • E-commerce with SEO needs
  • Applications needing a balance of SEO, performance, and interactivity
AHA Stack (HTML-first)
  • Extreme simplicity & minimal client-side JS
  • Fast load times due to minimal JS payload
  • "HTML over the wire" for dynamic updates
  • Leverages web standards
  • Content-heavy sites (blogs, docs)
  • Internal tools & dashboards
  • Projects prioritizing simplicity and maintainability over complex client state

Additional Resources

For a comprehensive tutorial on building with the AHA Stack, check out this guide: LogRocket's AHA Stack Tutorial