Mental Models
Datastar's focus on hypermedia, reactivity, and speed leads to some fun mental models.

- Intro
- Datastar
Datastar is a framework focused on interactivity and streaming updates through a handful of HTML attributes. The server owns state and logic; the client handles reactive UI with signals.
HTML is the contract between these two. Element ids
are server targets. Events trigger the server to stream patches — morphing elements or updating signals. There's little state to synchronize, as the frontend acts as a dumb, reactive terminal.
Datastar's philosophy
- Stream-first: Simple patches with SSE; real-time updates to elements or signals.
- Reactive: Interactive UI is handled through signals and HTML attributes.
All we have to decide is what to do with the time that is given to us. There are other forces at work in this world, Frodo, besides the will of evil.
Datastar includes reactivity as a core idea. The result is a hypermedia framework capable of handling simple CRUD apps or a billion multiplayer checkboxes.
TodoMVC
Mental Models
Datastar's focus on hypermedia, reactivity, and speed leads to some fun mental models.
“Hobbit software: Pretty chill, keeps to itself, tends to its databases, hangs out with other hobbit software at the pub, unbothered by the scheming of wizards and orcs...”



- Compared to...
- htmx
htmx extends hypermedia: any element makes requests; any event triggers them; any target receives updates. Locality of behavior with hx-*
attributes keeps the server in charge and the client minimal. For CRUD apps without heavy JavaScript, htmx excels. Its approach makes request/response very easy to implement.
But htmx strains with complex UI interactions. Updating multiple parts of the DOM requires out-of-band swaps — a “workable solution” to a messy problem. Interactive UI requires a good chunk of users to bolt on Alpine. These trade-offs are from htmx's core approach: declarative request/response rather than declarative interactivity.
Where Datastar diverges
- Signals, computed values, and effects for interactive UI.
- SSE patches multiple elements and signals; no OOB workarounds needed.
My basic rule is: analogies are great for a sympathetic audience and bad for an antagonistic one.
Both embrace declarative HTML and the server as the source of truth, but their centers of gravity differ.
- htmx extends hypermedia with declarative request/response: minimal client, server in charge.
- Datastar combines declarative reactivity with streaming updates: it assumes a responsive UI and makes it achievable in pragmatic ways.
<!-- Hobbit Autocomplete --> <input type="text" placeholder="Search meals (e.g. elevenses)" data-bind-search data-on-input__debounce.150ms="@get('/hobbit/meals')" />
“Hobbit software: Pretty chill, keeps to itself, tends to its databases, hangs out with other hobbit software at the pub, unbothered by the scheming of wizards and orcs...”


“Spreadsheets really are the fullest realization we've seen of functional-programming-without-code... It's no wonder they kicked off the microcomputer era.”



- Compared to...
- Spreadsheets
My favorite mental model for Datastar is spreadsheets. Spreadsheets are incredibly useful across domains. Yet the database remains the truth, while the spreadsheet provides a reactive view. In this analogy: signals are cells and computed values are formulas. Type in a cell (data-bind
) for immediate updates — but the database remains the source of truth.
Datastar as a spreadsheet
- Signals as cells: Hold ephemeral values (inputs, toggles, flags); update instantly.
- Computed values as formulas: Derive from signals automatically; recalculate when dependencies change.
- Effects as macros: Fire on signal changes; handle toasts, indicators, styling — never business logic.
- Bindings allow edits: Two-way flow between DOM and signals; input updates signal, signal updates DOM.
All enterprise software competes with Excel. All productivity software competes with emailing things to yourself.
Make no mistake: using spreadsheets requires discipline — otherwise an analyst's view can turn into a tangled mess. The same can happen with signals and effects. But if the server owns state and streams patches, then the client can act as an interactive terminal.
“Spreadsheets really are the fullest realization we've seen of functional-programming-without-code... It's no wonder they kicked off the microcomputer era.”


“My basic rule is: analogies are great for a sympathetic audience and bad for an antagonistic one.”



- Compared to...
- DuckDB
- Hypermedia ≈ SQLite: embedded, straightforward, useful
- React/Solid/Svelte ≈ MySQL/Postgres: full client applications
- Datastar ≈ DuckDB: embedded, powerful without a heavy burden
Both DuckDB and Datastar handle hard cases (complex analytical queries; real-time, multiplayer updates) while keeping the simple cases simple.
Datastar as DuckDB
- Embedded, but powerful: Multi-target orchestration with SSE; interactivity with HTML attributes.
- Built for modern platforms: modern browser features (SSE, View Transitions, Web Components) narrow SPA advantages (interactive UI/UX); Datastar aims to reduce the reactivity UX gap.
Product design is making things simpler to achieve, not adding new features.
There are problems that neither SQLite or MySQL/Postgres are great for — and where DuckDB shines. Datastar is a good analogy. Choose the best tool for your problem; some demands require even heavier frameworks.
“My basic rule is: analogies are great for a sympathetic audience and bad for an antagonistic one.”


Mental Models
Datastar's focus on hypermedia, reactivity, and speed leads to some fun mental models.

- Recap
- Datastar
Datastar enforces boundaries: state and logic on server; signals are ephemeral. Events trigger compute, SSE patches HTML, and the DOM morphs. This loop keeps the server in charge and the UI interactive.
Datastar is designed for hypermedia's hard problems first. Multi-target updates, real-time pushes, and reactive UX are core primitives. The framework assumes these capabilities and delivers a pragmatic set of tools.
Handful of Datastar patterns: two-way forms (data-bind
); ephemeral toasts (data-on-load__delay
); virtual scrolling (data-ref
+ throttling). Notice these aren't hacks, they're included.
A complex system that works is invariably found to have evolved from a simple system that worked.
When in doubt, write hobbit software — treat browsers as interactive terminals; stream patches; ignore framework wars.
Hypermedia Recap
- Shared DNA: htmx and Datastar use declarative HTML attributes, embrace the server, and minimize client complexity.
- Different areas of focus: htmx extends hypermedia with request/response; Datastar adds spreadsheet reactivity and orchestrates streaming updates.
Zach Williams
Mental Models
Datastar's focus on hypermedia, reactivity, and speed leads to some fun mental models.