Examples

September 4, 2026 ยท View on GitHub

Try them live at http-nu.cross.stream/examples/.

Running all examples

The examples hub mounts individual examples under one server:

http-nu --datastar :3001 examples/serve.nu

With a store (enables quotes):

http-nu --datastar --store ./store :3001 examples/serve.nu

Then visit http://localhost:3001.

Local dev: add --dev when running over plain HTTP. Examples that set cookies (2048's session cookie, for instance) default to Secure, so the browser drops them on http://localhost. --dev omits the Secure flag.

Individual examples

Each example can also be run standalone.

ExampleCommandDescription
basichttp-nu :3001 examples/basic.nuMinimal routes, JSON, streaming, POST echo
storhttp-nu :3001 examples/stor.nuIn-memory SQLite with stor commands
datastar-counterhttp-nu --datastar :3001 examples/datastar-counter/serve.nuClient-side reactive counter
datastar-sdkhttp-nu --datastar :3001 examples/datastar-sdk/serve.nuDatastar SDK feature demo
mermaid-editorhttp-nu --datastar :3001 examples/mermaid-editor/serve.nuLive Mermaid diagram editor
markdown-mermaidhttp-nu :3001 examples/markdown-mermaid/serve.nuMarkdown via .md with Mermaid fences rendered client-side
templateshttp-nu --datastar --store ./store :3001 examples/templates/serve.nu.mj file, inline, and topic modes
quoteshttp-nu --datastar --store ./store :3001 examples/quotes/serve.nuLive quotes board with SSE
taohttp-nu --datastar --dev -w :3001 examples/tao/serve.nuThe Tao of Datastar
bloghttp-nu :3001 examples/blog/serve.nuRouting, layouts, HTML composition
2048http-nu --dev --datastar --services --store ./store :3001 examples/2048/serve.nuMulti-game library, event-sourced via snapshot-actor, animated tile slides

Store-dependent examples

Quotes and the /topic route in templates require --store. The hub detects $HTTP_NU.store at runtime and greys out unavailable examples. When --store is provided, templates automatically seeds its topics on startup.