Skip to content
romsharkPublic

About

A Datastar Go web frontend framework, code generator and toolchain

Topics

Resources

Contributing

Security policy

Stars

119 stars

Watchers

3 watching

Forks

Latest commit

 

History

1,019 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Datapages

CI golangci-lint Coverage Status Go Reference License: MIT Release

Discord Slack

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.

Give coding agents project-specific guidance

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.

Focus on your business logic

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.

Examples

  • counter: 2 real-time counters in 1 module. app/simple is the smallest example, and app/fancy adds 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: Custom sessions.Manager backed 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, a PageOffline fallback, 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.

Getting Started

See the documentation. Start with the installation and the tutorial.

Specification

SPECIFICATION.md defines handler signatures, parameters, return values, events, sessions and modules.

Modules

Datapages includes modules with replaceable implementations:

  • Manager[Data]
    • natskv - NATS KV store with AES-128-GCM encrypted cookies
    • inmem - In-memory sessions (lost on restart; single-instance only)
  • Broker
    • natscore - Core NATS backed message broker
    • inmem - In-memory fan-out message broker (single-instance only)
  • TokenWriter, TokenValidator
    • Tokens - the built-in default: HMAC-SHA256 over the session token under a fixed domain-separator key, BREACH-resistant masking, nothing to configure
  • TokenGenerator
  • assetcompress.Store
    • disk - Compressed assets in a directory (kept across restarts, shared by the processes that use it)

Motivation

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 init creates a project with a working server, development setup and CI workflow.
  • datapages gen generates the routes, streams and typed template helpers from Go declarations.
  • datapages lint checks the declarations and templates in CI without writing files.
  • datapages watch rebuilds 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.

Cost comparison: doing it all yourself, using AI assistance, and Datapages plus AI assistance

Who this is for

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.

Contributing

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.

About

A Datastar Go web frontend framework, code generator and toolchain

Topics

Resources

Contributing

Security policy

Stars

119 stars

Watchers

3 watching

Forks

Releases

Contributors

Languages