Small, self-contained apps that each demonstrate one xtemplate feature.
The quickest way to explore them is to start everything at once:
mise run examplesThis launches all seven examples plus a landing page at http://localhost:9000 with links to each one. Press Ctrl+C to stop them all.
If one of those ports is already taken, pass a different base port; everything shifts up from there (the hub takes the base, each example the base + its offset):
mise run examples 9100To run just one as a dev server instead, use mise run example-<name> and open
the listed URL.
| Example | Feature | Run task | Port | URL |
|---|---|---|---|---|
contacts |
File-based routing + custom method routes + .DB (sqlite CRUD) |
mise run example-contacts |
9001 | http://localhost:9001/ |
sse-chat |
Multi-user SSE chat with .Bus + .Flush |
mise run example-sse-chat |
9002 | http://localhost:9002/ |
blog |
Optimal asset serving: content-hash cache-busting + Subresource Integrity (.X.StaticFileHash) |
mise run example-blog |
9003 | http://localhost:9003/ |
filebrowser |
Filesystem dot provider (.FS list/read + ReceiveFiles upload) |
mise run example-filebrowser |
9004 | http://localhost:9004/ |
embedded |
Single-binary deployment with //go:embed (custom build) |
mise run example-embedded |
9005 | http://localhost:9005/ |
dotprovider |
Custom dot provider exposing Go code to templates (custom build) | mise run example-dotprovider |
9006 | http://localhost:9006/ |
datastar |
Datastar client + SSE datastar-patch-elements (shared SQLite counter) |
mise run example-datastar |
9007 | http://localhost:9007/ |
- Examples 1-4 and 7 (
contacts,sse-chat,blog,filebrowser,datastar) run the default CLI binary built bymise run build-cli(dist/xtemplate) against aconfig.jsonin the example directory. - Examples 5-6 (
embedded,dotprovider) are custom Go programs (their ownmain.gocallingapp.Main(...)) and have their ownbuild-example-<name>task.
Each example has:
- A
templates/directory (the web root). - A
tests/*.hurlsmoke test. Following the convention of the main suite, the.hurlfiles hardcodelocalhost:8080; the harness remaps that to the example's real port withcurl --connect-to, so the same files work no matter which port the example listens on.
mise run example-<name>- run the example as a foreground dev server.mise run test-example-<name>- build, serve on its port, run its hurl suite, tear down.mise run test-examples- run every example's integration test (included inmise run test/mise run ci).