Repository navigation
v3.1.0
In short: One Go backend, every way to talk to it: HTML, a JSON API, MCP and SvelteKit. Services still own the rules; the new transports are thin and call the same methods as your htmx or Datastar handlers.
New
- JSON API (
--api):/api/v1next to your htmx or Datastar app, from the same binary. Free covers auth, account and sessions; Paid adds billing, admin, workspaces, members, invitations, activity and avatars. - API details: the login session doubles as the credential,
Authorization: Bearer <token>; cookie sessions keep working withX-CSRF-TokenfromGET /api/v1/csrf. One error envelope, snake case JSON, cursor pagination for activity, 415 for anything that is notapplication/json, a 1 MiB body limit. - OpenAPI: a hand-written OpenAPI 3.1 document at
/api/v1/openapi.yaml, with a test that fails when a route and the document drift apart. - CORS for listed origins through
CORS_ALLOWED_ORIGINS; OAuth callbacks can use a separateAPI_URL. - Headless (
--headless): the Go backend with the JSON API and no native frontend, no templ, Tailwind or assets.GET /answers JSON and the Docker image is about 51 MB. - Personal API tokens (
pat_...) with read or read and write scope, bound to one workspace, stored as hashes, shown once, created and revoked under Settings, Security. New routes are closed to tokens until they opt in; tokens never manage people, credentials or billing. They end when the password is reset or changed and when an admin revokes a user's sessions. - MCP server (
--mcp) at/mcp, built on the official Go SDK, so your customers connect Claude, Cursor or VS Code with a token. Free shipswhoami; Paid addsget_billing; Workspaces addlist_workspaces,get_workspace,list_activity,invite_memberandrename_workspace.AGENTS.mdshows how to add your own tool in under 20 lines. - SvelteKit (
--framework svelte): a SvelteKit 3 app with Svelte 5 and shadcn-svelte on the Headless backend, embedded into the Go binary: one origin, one deploy, about 53 MB. Same look and pages as the templ app, cookie sign-in with CSRF, a strict CSP. Needs Node.js 22.17 or newer and pnpm;goilerplate doctorchecks both. htmx and Datastar stay the recommendation. - The CLI has
--api,--headless,--mcpand--framework svelte, and the wizard asks for them.
Changed
- shadcn-templ v2.0.0-beta.13: Base UI behavior across components, a minified bundle from
/assets/jsand gzip for text assets. The bundle goes from 613 KB to about 77 KB on the wire. - Safer by default: OAuth refuses provider accounts without a verified email, payment webhooks reject bodies over 1 MiB, the invitation limit is shared across web, API and MCP, and invitation tokens no longer show up in request logs.
Fixed
- UI: select triggers show their labels again, the mobile sidebar closes on the first Escape, and Back and Forward work after docs navigation in htmx and Datastar.
- Datastar settings: Sign Out Everywhere, Remove Password and remove avatar no longer stay disabled.
- Forms show their red border on errors.
- Account deletion: a refused deletion no longer deletes the user's files first.
- A data race in the first concurrent page renders is gone.
Upgrade
- Install the goilerplate CLI v3.1.0. The v3.0.x CLI can run this update, but it cannot read locks written by v3.1.0.
- Commit your work, run
goilerplate update, then switch to thegoilerplate-update-v3.1.0branch. - If
internal/routes/routes.goconflicts, keep the newmiddleware.Gzip(assetHandler)line and deletemux.Handle("GET /components/{bundle}", components.ScriptsHandler()). Vendored components you edited may also conflict. - If you edited component JavaScript or added components the template does not ship, re-add them with
go run github.com/axadrn/shadcn-templ/v2/cmd/shadcn-templ@v2.0.0-beta.13 add <name> --overwrite, run the same command withbundle, and commitassets/js/shadcn-templ-*.jsandinternal/ui/components/scripts_bundle.go. - In your own templates, JavaScript and CSS, replace
data-tui-*withdata-slot(for example[data-slot=dialog-content]), open state withdata-openanddata-closed, andwindow.tuiwithwindow.templ. Nothing fails to compile here, so search fordata-tuiandwindow.tui. API_URLis new and optional; it defaults toAPP_URL.- Run
go tool templ generateandgo mod tidy, then build and test.
Adding the JSON API, MCP or SvelteKit to an existing project is a new generation with the same answers plus the new flags; goilerplate update keeps your current selection.