Interactive Demo
This page demonstrates Datastar + Quartz — a static site that comes alive with server-sent events. The page itself is Obsidian markdown, but the interactive sections below connect to a live backend via SSE.
Live Server Time
Watch the server push updates every second — no polling, no WebSocket, just SSE:
Say Hello
Type your name and let the server greet you:
Live Blog Stats
Click to fetch the latest engagement numbers from the backend:
How This Works
This entire page is a markdown file in an Obsidian vault. The interactive sections use:
- Quartz generates the static HTML from markdown
- Datastar (11KB) adds reactivity via
data-*attributes - Sanic backend responds with SSE events that update the DOM
The HTML in the markdown uses Datastar v1.0.0-RC.8 attributes:
data-init— runs an expression when initialized (triggers SSE on load)data-signals:name— declares a reactive signal with colon syntaxdata-bind:name— two-way binding between input and signaldata-on:click— triggers expression on click event@get()/@post()— SSE action expressions
The backend responds with event: datastar-patch-elements SSE events containing HTML fragments. Datastar patches them into the DOM by matching element IDs.
The result: A blog that’s 95% static (fast, cacheable, SEO-friendly) with surgical interactivity where you need it.
