andersch.dev

<2025-10-10 Fri>

Datastar

Datastar is a hypermedia frontend framework that uses HTML attributes and SSE.

In D*, clicking a button sends a GET request and the server responds with zero or more SSE events over time.

HTMX vs. Datastar

  • D* sends responses using SSE.
  • HTMX supports SSE via extension, but only for server-initiated events.
  • D* can do front-end using "signals". HTMX needs Hyperscript/AlpineJS/…
  • HTMX supports OOB (out-of-band) patching, whereas D* has this as the default.
  • HTMX is free, D* is freemium
  • D* has a smaller library footprint (11kb vs 14kb)
  • D* often needs fewer attributes to achieve same behavior

Resources