Skip to content

v3.1.0

Choose a tag to compare

@github-actions github-actions released this 06 Oct 07:23
· 73 commits to main since this release
b16f755

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/v1 next 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 with X-CSRF-Token from GET /api/v1/csrf. One error envelope, snake case JSON, cursor pagination for activity, 415 for anything that is not application/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 separate API_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 ships whoami; Paid adds get_billing; Workspaces add list_workspaces, get_workspace, list_activity, invite_member and rename_workspace. AGENTS.md shows 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 doctor checks both. htmx and Datastar stay the recommendation.
  • The CLI has --api, --headless, --mcp and --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/js and 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

  1. 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.
  2. Commit your work, run goilerplate update, then switch to the goilerplate-update-v3.1.0 branch.
  3. If internal/routes/routes.go conflicts, keep the new middleware.Gzip(assetHandler) line and delete mux.Handle("GET /components/{bundle}", components.ScriptsHandler()). Vendored components you edited may also conflict.
  4. 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 with bundle, and commit assets/js/shadcn-templ-*.js and internal/ui/components/scripts_bundle.go.
  5. In your own templates, JavaScript and CSS, replace data-tui-* with data-slot (for example [data-slot=dialog-content]), open state with data-open and data-closed, and window.tui with window.templ. Nothing fails to compile here, so search for data-tui and window.tui.
  6. API_URL is new and optional; it defaults to APP_URL.
  7. Run go tool templ generate and go 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.