Focus on your business logic
and let Datapages generate the boilerplate.
Define your pages and handlers in pure Go code and let Datapages generate the server, routing, and middleware automatically.
Not just a one-time scaffold. Every time you change your source package, Datapages regenerates routing, wiring, and helpers to stay coherent.
Catches naming violations, missing fields, and invalid handler signatures at generation time. Fix mistakes before they reach runtime.
datapages watch rebuilds on file changes, regenerates code, and live-reloads the browser. No manual restarts.
Dispatch events and handle them with OnXXX methods. Datapages wires up Server-Sent Events, NATS, and CQRS for you.
Token-based sessions, automatic CSRF protection, and secure cookie management. Just declare session Session in your handler and let Datapages handle the rest.
// PageProfile is /profile/{id} type PageProfile struct{ App *App } func (p PageProfile) GET( r *http.Request, session Session, path struct { ID string `path:"id"` }, ) (body templ.Component, err error) { user, err := p.App.repo.FindUser(path.ID) if err != nil { return nil, err } return profilePage(user, session), nil } // POSTFollow is /profile/{id}/follow func (p PageProfile) POSTFollow( r *http.Request, session Session, path struct { ID string `path:"id"` }, dispatch func(EventUserFollowed) error, ) error { return dispatch(EventUserFollowed{TargetID: path.ID}) }
HTTP mux with typed handlers, middleware chain, session cookie management, CSRF validation, error recovery, SSE stream handlers, and event broker wiring.
Functions like href.Profile("user-42") that return correct URL strings with path parameters filled in at compile time.
Helpers like action.ProfileFollow("user-42") for Datastar form actions with the right HTTP method and URL.
Per-page streaming endpoints that subscribe to event subjects, deserialize events, and call your OnXXX handlers over Server-Sent Events.
A ready-to-run main package that wires up your app, session store, message broker, and starts the server.