Datastar v1 patterns with OpenAPI content negotiation and D1 persistence
The core counter backed by D1 (SQLite). Every action is an atomic SQL update.
data-signals
data-text
data-on:click
data-init
data-class
data-show
data-attr
data-bind
data-on:keydown.window
Derived values, conditional messages, and reactive styles — all driven by the counter signal.
data-computed
data-show
data-style
Full CRUD with server-rendered list items. Form submit creates; delete button removes. Server re-renders the full list on each mutation — no client-side templating.
@post
@delete
datastar-patch-elements
Server renders HTML via SSE datastar-patch-elements. Datastar patches it into the DOM using Idiomorph.
datastar-patch-elements
data-effect
Client-side clock that ticks every second. No server requests — pure reactive interval.
data-on-interval
.duration
Output updates 500ms after you stop typing. The .debounce modifier handles timing automatically.
.debounce
Authenticated task CRUD. Same Zod schemas power both this REST API and the MCP tools for AI agents.
Drizzle ORM
@post / @patch / @delete
MCP Tools
Manage users via Better Auth admin plugin. Only visible to admin role.
Better Auth Admin
data-show
fetch()
Active sessions across all your devices. Revoke any session to log it out remotely.
Multi-Session
SSE Polling
Remote Revocation
Live JSON dump of every signal in the store. Updates in real-time as you interact with the page.
data-json-signals