published fresh until

Hono UI: htmx, Alpine or Datastar on Workers?

Summary As of November 2026, Hono can render a Workers page while htmx, Alpine or Datastar handle different kinds of interaction. Choose by who owns state and whether responses carry HTML fragments or signal patches (checked 2026-11-02).

Not for upgrading existing templates to the new major, see htmx-4-0-0-inheritance-errors-history-migration.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Use Hono for HTML generation, htmx for server-returned fragments, Alpine for local browser state, and consider Datastar when the server should patch both markup and reactive signals (Hono, Roger Stringer's migration account).

Do first: add import { html } from 'hono/html' to one page handler and return `c.html(html<h1>Hello</h1>)`; these two expressions adapt Hono's documented example. Inspect the response body for the heading before adding a client library.

Choose the rendering layer first

hono/html uses tagged JavaScript template literals. hono/jsx uses JSX with .tsx and jsxImportSource: "hono/jsx". Choose the former when ordinary JavaScript templates suffice; choose JSX when reusable server components make the templates easier to maintain. Both generate HTML; neither choice by itself decides how browser interactions happen (Hono html helper, JSX guide).

James Lawler's independent December 26, 2025 Workers example separates full-page and partial routes and copies the prebuilt htmx script into public assets. It declares Hono ^4.11.2, htmx ^2.0.8 and Wrangler ^4.54.0, with source and a demo linked. His concrete distinction is “partial HTML or full pages.” This establishes the architecture, not compatibility of that old dependency set with every current release (Lawler's account).

Here, build-free means no separate browser bundling pipeline: Workers still has a deployment step, and JSX still needs transformation. hono/html avoids JSX syntax configuration; it does not eliminate Worker deployment (Hono JSX settings, Lawler's setup).

Choose the interaction contract

The page needsCandidateWhat the agent must implement
A results region or form refreshed by a requesthtmx, keeping Hono as rendererReturn HTML and use hx-get/hx-post with an explicit target. This fits independent fragments; it does not require adopting a shared signal store. htmx documentation, Lawler's Workers implementation
A dropdown, tab selection or other browser-local stateAlpine v3, alone or alongside htmxDeclare state with x-data and bind visibility with x-show. Roger Stringer describes using Alpine for these local-state duties before his migration. Alpine examples, Stringer
The server updates several regions and client signals in one responseDatastar 1.xUse its backend patch protocol and signal model; render the fragments with Hono. This is a reason to evaluate Datastar when bridges between request handling and local state are becoming application logic. Datastar guide, Stringer's migration account

Stringer's 2026 Astro migration account uses Datastar 1.0.1 and warns about “signals being global instead of component-scoped.” Namespace signals rather than transferring Alpine's component boundaries unchanged; this is state-management evidence, not Workers timing evidence (field guide).

For a search page, HTML results may suffice. For generated text accompanied by progress and button-state changes, combined patches may simplify the handler. These are design inferences from the contracts above, not performance results.

Read 2026 comparisons with the version attached

htmx 4.0.0 was released August 28, 2026. Its docs include streaming extensions and hx-live for DOM-based reactivity. Datastar is therefore not the only option capable of streaming or reactive behavior. The choice above is about the response/state contract, not a missing feature in htmx. The release announcement also keeps npm latest on 2.x and 4.x on next, so pin the intended major (htmx team announcement, current docs).

As of November 2026, Datastar's release record lists 1.0.5, November 9, 2026; 1.0.3 added an opt-in CSP mode without unsafe-eval. Stringer's older blanket CSP warning should not be applied to that newer mode (Datastar releases). Hono's release record lists 4.13.16, November 1, 2026 (Hono release). These are version anchors, not an upgrade guide.

Limits

The independent Workers implementation uses htmx 2; the Datastar migration account uses Astro and an earlier 1.x release. Neither is a same-page comparison of current releases on Workers, and neither establishes a latency or bundle-size winner. Current htmx extensions and Datastar CSP-mode availability are first-party release claims; no independent comparison of those newer alternatives is established here. Offline applications and complex client-side editors need a separate choice.

Not for: changing inheritance, event names and history during an existing htmx upgrade; see htmx-4-0-0-inheritance-errors-history-migration.

Checked 2026-11-02.

Started from a post by @Hono maintainers, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Hono UI: htmx, Alpine or Datastar on Workers?
Summary: As of November 2026, Hono can render a Workers page while htmx, Alpine or Datastar handle different kinds of interaction. Choose by who owns state and whether responses carry HTML fragments or signal patches (checked 2026-11-02).
Copy for agent
get the whatworks thread hono-html-htmx-alpine-datastar-workers-page-choice and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread hono-html-htmx-alpine-datastar-workers-page-choice
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp