Pular para o conteúdo
Esta página ainda não foi traduzida. O conteúdo abaixo está em inglês. Ler em inglês

Getting started

Starters

Pick a stack for vukem new — HTMX, HTMX with templ, Inertia with React, Vue or Svelte, or a JSON API — all on Vite and Tailwind CSS v4.

Última atualização:

vukem new renders one of five starters. On a terminal without a stack flag it asks which one you want; in scripts pass the flag.

Terminal
vukem new blog                       # HTMX + html/template (default)
vukem new blog --templ               # HTMX + templ components
vukem new blog --inertia react       # Inertia + React (also: vue, svelte)
vukem new shop --api                 # JSON-only REST API
vukem new blog --pm bun             # bun install instead of npm install
vukem new blog --no-install          # skip installing frontend dependencies
vukem new site --minimal             # HTMX without a database
StarterViewsFrontendNode.js
HTMX (default)html/template in resources/viewshtmx 4 (vendored), Vite 8, Tailwind CSS v4for Vite builds
HTMX + templtempl components in resources/views (package views)same as HTMXfor Vite builds
InertiaReact, Vue or Svelte pages in resources/js/pagesVite 8, TypeScript, Tailwind CSS v4required
APInonenonenot used

Every starter except --minimal ships SQLite, migrations, a posts CRUD example and tests that pass with go test ./.... vukem new runs go mod tidy, writes APP_KEY, installs frontend dependencies with --pm (default npm) when it is on PATH (frontend starters) and git init.

Every starter also ships a production Dockerfile (Vite assets with the chosen package manager, a static Go binary built with the tags in .buildtags, a non-root Alpine runtime with APP_ENV=production and HOST=0.0.0.0) and a .dockerignore that keeps .env files, node_modules and storage/ out of the image. Railway and other platforms build it without extra configuration: see Docker and Railway.

HTMX on Vite#

The default starter vendors htmx 4.0.0 (served by the static middleware, SHA-256 pinned), and builds CSS and scripts with Vite 8 and Tailwind CSS v4 (@tailwindcss/vite):

Text
package.json, vite.config.ts
resources/css/app.css       @import "tailwindcss" + starter styles in @layer base
resources/js/app.ts
resources/vite/vukem.js     hot-file plugin (writes public/hot while the dev server runs)
resources/public/build/     vite build output, embedded in the binary

The layout loads assets with {{ vite "resources/css/app.css" "resources/js/app.ts" }} (Vite). Without a dev server or a build, the tag renders an HTML comment in development, so Go tests never need Node. Starter views have no inline scripts or handlers and run under the default CSP. See HTMX for the request and response helpers.

templ#

vukem new app --templ is the HTMX starter with the same pages and tests written as templ components:

  • templ is pinned as a Go tool (tool line in go.mod); run it with go tool templ generate.
  • The generated *_templ.go files are committed, so go build and go test work without running templ.
  • vukem serve runs go tool templ generate before every build when .templ files exist and watches them; vukem build generates before vite build.
  • resources/views/helpers.go wraps the context helpers (route, asset, viteTags, script, flash, old, fieldError, csrfField). Scripts go through helpers that add the CSP nonce, so components contain no raw <script> tags.
Go
return c.View(views.PostsIndex(posts), web.Partial(views.PostList(posts)))

web.Partial renders the fragment for htmx partial requests and the page otherwise. Components read request data through web.FlashFrom(ctx, key), web.OldInput(ctx, field), web.ErrorsFrom(ctx), csrf.Token(ctx) and middleware.CSPNonce(ctx).

Inertia (React, Vue, Svelte)#

Terminal
vukem new app --inertia react         # or vue, svelte
vukem install:inertia --force --vue   # convert an existing HTMX starter

The app gets vukem.WithInertia(inertia.Config{}), controllers that call inertia.Render, the root view resources/views/app.html, TypeScript pages in resources/js/pages, a default layout in resources/js/layouts and tests with AssertInertia. npm run typecheck runs tsc (React), vue-tsc or svelte-check. Styling is Tailwind only (resources/css/app.css), with dark mode driven by a dark class on <html>: resources/js/app.ts applies the saved choice (localStorage.theme = "dark" or "light") or the system preference on load (views have no inline scripts, for the CSP), so a theme toggle only needs to flip the class and save it. <html lang> follows the request locale. vukem install:auth on an Inertia app adds Auth/* and Dashboard pages. See Inertia.

Minimal#

vukem new site --minimal is the HTMX starter for a stateless app: the home page, layout, vendored htmx and Vite, with no database/, models, posts or uploads examples, and no DATABASE_URL. Sessions, cache, queue and rate limits keep their cookie, memory and sync defaults, which need no database. Its .buildtags file holds vukem_nosqlite, so vukem build and vukem serve leave the SQLite driver out of the binary (about 4 MB smaller); opening a SQLite database in such a build fails with an error naming the tag. The starter Dockerfile reads .buildtags too, so the image is built with the same tags; a hand-written Dockerfile must pass them (go build -tags vukem_nosqlite ./cmd/app). Tests run with plain go test ./.... To add a database later, delete the tag from .buildtags (or configure another driver) and run vukem install:auth or make:migration as usual.

API#

vukem new shop --api is a JSON-only app: /api/v1 routes, token guard, CORS, rate limiting and problem+json errors, no views or Node. See REST APIs.

Add-ons#

These scaffolds work on top of any web starter:

CommandAdds
vukem install:auth [--social …] [--2fa]Authentication, social login, two-factor
vukem install:adminAdmin panel at /admin
vukem install:billingStripe subscriptions
vukem install:apiToken-authenticated /api/v1 routes
vukem boost:installGuidelines, skills and an MCP server for AI coding agents