Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Hypermedia web apps from a directory of Go templates.
xtemplate is a Go server that turns a directory of HTML templates into a hypermedia web application, treating templates themselves as route handlers with no separate application layer.
xtemplate is a Go-based web server that uses HTML template files as the entire application layer. It accepts a directory of templates, parses them at startup, and serves HTTP requests according to file-based routing: for example, contacts.html handles GET /contacts and contacts/{id}.html handles GET /contacts/{id}. It runs on Go and can be deployed through its CLI, Docker images, a Caddy module, or embedded directly into any Go program as an http.Handler. The project is open source under the Apache 2.0 license and developed on GitHub.
admin/settings.html serves GET /admin/settings, and index.html serves the directory root.define "DELETE /contact/{id}" become routes with path parameters, enabling CRUD and custom methods..Req, .Resp, .DB, and .FS so templates can access form values, path parameters, and database queries directly.html/template escaping for output, with optional sanitize and trust helpers for controlled raw HTML.define "SSE /path" blocks stream live updates to clients..html files with SQL queries against a configured provider..html templates; each file or define block maps to a URL route.xtemplate is free and open source, released under the Apache 2.0 license.
Yes. xtemplate is open source under the Apache 2.0 license, so you can use, modify, and distribute it freely, including in commercial projects.
No. A SQL provider can be configured as .DB in the dot context, but it's optional. Templates can also work with the request context and static files alone.
Yes. The public example app infogulch/todoxt is a todos application built with xtemplate and htmx, and the template syntax supports returning HTML fragments for AJAX updates.
Routing is file-based: admin/settings.html serves GET /admin/settings, and template definitions like define "DELETE /contact/{id}" handle other methods and path parameters. No separate route configuration is needed.