[!NOTE]
Beta: Datapages is ready for production use.
APIs are close to stable but can still change.
A Templ + Go + Datastar web framework and toolset for building GUI apps and web application in pure Go - no matter whether it's a real-time collaborative dynamic web app, a simple HTMX-style website, or an installable local-first GUI app.
See FAQ.md for frequently asked questions.
Utilize AI agents more efficiently
Datapages will provide your coding agents with the skills and CLI tools they need to generate well performing, resource-efficient apps and keep the code base coherent and maintainable, lowering token-usage, reducing potential for bugs and vulnerabilities as well as slowing the accumulation of technical debt.
Focus on your business logic
Datapages parses your app source packages, lints them, reports errors, and generates all the wiring and boilerplate. Routing, sessions and authentication, SSE streams, per-tab server-side state, CSRF protection, type-safe URL and action helpers, Prometheus metrics, JavaScript service workers etc. - so your application code stays clean and takes full advantage of Go's strong static typing and high performance.
Examples
counter: Real-time counter built twice in one module, bare bones asapp/simpleand polished asapp/fancy. Bare bones starting point, and the example of a module that builds more than one application.todolist: Real-time collaborative todo list with per-tab server-side state (Most Tao conform example).calculator: Hybrid calculator app that runs both as a multi-client server and single-client Desktop app.classifieds: Full-featured classifieds marketplace with sessions, auth, Prometheus metrics, Grafana dashboards and load testing.tailwindcss: Minimal static page demonstrating Tailwind CSS integration.webcomponents: Landing page with vanilla and Lit-based Web Components bundled via esbuild through a custom watcher.sqlitesessions: Customsessions.Managerimplementation backed by SQLite via sqinn-go (no cgo).fast-shim: A cached placeholder shown immediately and replaced with the live response.offline-cache: Service worker support with handler-cached pages, aPageOfflinefallback, and tickets available without a connection.file-upload: Chunked file uploads to disk that can be paused, resumed and continued after a reload or a server restart, with server-enforced transfer limits.
Getting Started
See the Guide.
Specification
See SPECIFICATION.md for the full source package specification, including handler signatures, parameters, return values, events, sessions, and modules.
Modules
Datapages ships pluggable modules with swappable implementations:
- [
Manager[Data]](modules/sessions/sessions.go)
natskv - NATS KV store with AES-128-GCM encrypted cookies
- inmem - In-memory sessions (lost on restart; single-instance only)
- natscore - Core NATS backed message broker
- inmem - In-memory fan-out message broker (single-instance only)
- Tokens - the built-in default: HMAC-SHA256 over the session token under a fixed domain-separator key, BREACH-resistant masking, nothing to configure
Motivation
The reason I built Datapages is that the combination of Datastar + Go + Templ is my preferred way of writing server-centric web applications. But in every project I used this tech stack for I kept repeating the same code patterns and solving the same problems over and over again. I realized many developers are repeating the same patterns too and struggle with the common pitfalls:
- How to handle SSE streams correctly?
- How to use NATS effectively?
- How to approach security and authentication?
- How to configure a convenient hot-reload for development?
- How to keep the code maintainable over time, especially when you add more developers and/or AI assistants?
- How to keep AI coding assistants from drifting too much?
- How to achieve optimal performance and a good UX for endusers?
Not only does Datapages allow you to start quickly with datapages init and jump straight into building your application, but it also continuously supports you keeping accidental complexity low by:
- Providing a Datastar Tao oriented architecture as a good default while preserving enough flexibility to go beyond if you need to.
- Providing
datapages gento generate all boilerplate code consistently and guide you and your AI coding agents. - Providing
datapages lintthat can be used in CI/CD workflows for extensive static code analysis. - Providing
datapages watchto give you an interactive hot-reload environment for a fast feedback loop with error reporting directly in the browser preview.
Who This Is For
Datapages is a good fit if you:
- Already write your backend in Go and want to build your web frontend in the same language and toolchain.
- Are building a server-rendered application, where the server owns the data; not a local-first offline-capable SPA.
- Already use Datastar and want a Go framework to help you ship faster with less code while preserving maintainability.
- Already use Templ and want a full framework built around it.
- Use HTMX, idiomorph and Alpine.js, and instead want a single cohesive stack with a smaller bundle size and less spaghetti-code.
- Don't want to maintain a separate REST/GraphQL API just to feed your frontend.
- Want to deploy as a single, statically compiled binary that makes the most of your hardware.
- Want to develop hybrid desktop apps in Go and HTML5 (see Calculator example)
Contributing
See CONTRIBUTING.md for development setup and commands, and AGENTS.md for code style, testing conventions, commit message format and project structure.