Datastar + Go demo: real-time todo list with SSE
- Go 58.6%
- HTML 41.4%
- Live todo CRUD with SSE fan-out to all connected clients - Continuous clock stream demonstrating long-lived SSE - Signal debugging endpoint - chi router + datastar-go SDK - Embedded HTML, single binary deployment |
||
|---|---|---|
| go.mod | ||
| go.sum | ||
| go.sum.bak | ||
| index.html | ||
| main.go | ||
| README.md | ||
Datastar Playground 🚀
A real-time todo app built with Datastar + Go — showcasing SSE streaming, reactive UI, and zero-JS-framework patterns.
Features
- Real-time todos — Add, toggle, delete with instant UI updates via SSE fan-out
- Live clock — Continuous SSE stream demonstrating long-lived connections
- Signal debugging — Inspect Datastar client signals from the server
- No JS framework — Pure HTML +
data-*attributes, 11KB client
Architecture
Browser (Datastar 11KB) ←── SSE ──→ Go (chi router)
data-* attributes datastar-go SDK
Signals (reactive state) In-memory store + fan-out
Key Patterns
- SSE Fan-out: TodoStore notifies all connected clients via channels
- ReadSignals: Extract typed data from Datastar requests
- PatchElements: Send HTML fragments to morph into the DOM
- PatchSignals: Update client-side reactive state from server
- Continuous streams: Clock endpoint keeps connection alive
Run
go run .
# Open http://localhost:8080
Stack
- Datastar — Hypermedia framework
- datastar-go — Go SDK
- chi — HTTP router
- Go
embed— Single binary deployment