Note
Beta: Datapages is ready for production use. APIs are close to stable but can still change.
Datapages is a web framework and toolchain for Go, Templ and Datastar. It supports collaborative web applications, HTMX-style sites and installable desktop applications.
See FAQ.md for frequently asked questions.
datapages init writes instructions and skills for coding agents. datapages lint and datapages gen report invalid application declarations and template calls with file positions and suggested fixes.
Datapages parses and checks the application package, then generates the HTTP wiring. The generated code covers routes, sessions, SSE streams, per-tab state, CSRF protection, typed URL and action helpers, Prometheus metrics and offline service workers. Application code remains Go and Templ.
counter: 2 real-time counters in 1 module.app/simpleis the smallest example, andapp/fancyadds a polished interface.todolist: Collaborative todo list with per-tab server-side state.calculator: Calculator that runs as a multi-client server or a single-client desktop app.classifieds: Full-featured classifieds marketplace with sessions, auth, Prometheus metrics, Grafana dashboards and load testing.tailwindcss: Minimal static page with Tailwind CSS.webcomponents: Landing page with vanilla and Lit-based Web Components bundled via esbuild through a custom watcher.sqlitesessions: Customsessions.Managerbacked by SQLite through sqinn-go, without 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.docs: Collaborative rich-text editor built on Quill, with operational transformation in Go.
See the documentation. Start with the installation and the tutorial.
SPECIFICATION.md defines handler signatures, parameters, return values, events, sessions and modules.
Datapages includes modules with replaceable implementations:
Manager[Data]BrokerTokenWriter,TokenValidatorTokens- the built-in default: HMAC-SHA256 over the session token under a fixed domain-separator key, BREACH-resistant masking, nothing to configure
TokenGeneratorassetcompress.Storedisk- Compressed assets in a directory (kept across restarts, shared by the processes that use it)
Go, Templ and Datastar are a direct way to build server-rendered applications. Projects built with them still repeat the same work for routes, SSE streams, NATS, sessions, CSRF protection, development reloads and deployment.
Datapages defines conventions for that repeated work and checks them with the CLI:
datapages initcreates a project with a working server, development setup and CI workflow.datapages gengenerates the routes, streams and typed template helpers from Go declarations.datapages lintchecks the declarations and templates in CI without writing files.datapages watchrebuilds the application, reports build errors in the browser and serves it through Toxiproxy to test slow and failing networks.
These conventions also give coding agents a stable application model. The generated instructions describe the model, and the CLI reports violations with source positions and fixes.
Datapages fits projects where:
- The backend is in Go, and the frontend should use the same toolchain.
- The server owns the data and renders the HTML.
- Datastar or Templ is already part of the stack.
- HTMX, idiomorph and Alpine.js should be replaced by 1 client library.
- A separate REST or GraphQL API would serve only the application's own frontend.
- Deployment should be 1 statically compiled binary.
- A desktop app should use Go and HTML. See the calculator example.
See CONTRIBUTING.md for development setup and commands, DEV.md for the watcher of the documentation pages, and AGENTS.md for code style, testing conventions, commit message format and project structure.