Overview

GoFastr is a full-stack Go framework. You build the whole app in Go: database schema and migrations, a REST API, and a server-rendered UI, plus opt-in batteries for auth, background jobs, search, and storage. Everything it generates is plain Go on disk that you own: no reflection, no runtime you're stuck inside. When it's in your way, drop to core/, net/http, or database/sql.

Agents work with it two ways. In production, the agents your users bring call your data over MCP, with the same login and permissions your users have. In development, gofastr dev gives your coding agent (Claude Code, Codex) the running app's routes, config, and logs over MCP, so it can help you build and debug.

This page lists every feature and links to its doc. Read it once, then jump to what you need. New here? Start with Get started and Project structure.

Two layers

GoFastr is two layers, and you can work at either one.

core/ + core-ui/: the primitives. stdlib-first building blocks: router, query, schema, render, mcp, openapi (core); HTML primitives, signals, the runtime (core-ui). Each works on its own, no framework required:

6 lines
// core only: a router and a handler.
r := router.New()
r.Get("/", render.HTMLHandler(func(req *http.Request) render.HTML {
    return render.Tag("h1", nil, render.Text("Hello from core."))
}))
http.ListenAndServe(":8080", r)

framework/ + framework/ui/: the opinionated layer. Built on those primitives. Declare an entity and the framework wires them together for you. You get a migrated table, a REST API with filtering/sorting/pagination, MCP tools, and an OpenAPI spec:

9 lines
// framework: one entity, wired end to end.
app := framework.NewApp(framework.WithDB(db))
app.Entity("posts", framework.EntityConfig{
    Fields: []schema.Field{
        {Name: "title", Type: schema.String, Required: true},
        {Name: "body",  Type: schema.Text},
    },
})
app.Start(":8080")

See Entity declarations. The app.Entity call above is a runtime registration; it wires the table, routes, and tools in memory and writes no files. gofastr init scaffolds the project that hosts it: main.go, screens.go, screens_auth.go (sign-in over battery/auth), and entities/entities.go at the module root, all plain Go you read, edit, and commit. When the framework is in your way, drop back to core/. You can also scaffold a whole app from a gofastr.yml app spec with the code generator; the running app never needs the file.

(Only core/middleware pulls in a dependency, OpenTelemetry, for tracing. Everything else in core/ is stdlib-only.)

Modeling your domain

Declare entities; get their tables, routes, and tools.

Serving HTTP

The middleware between the socket and your handler, on by default.

Building UI

Server-rendered with islands: every page is full HTML on first load; a small runtime attaches handlers to the existing DOM; in-page changes (sort, paginate, add a row) are island calls that swap one fragment: no hard refresh, no client re-render.

  • Getting started (UI): scaffold, theme, screen, custom component. UI wiring: adding the UI to a plain framework.App by hand.
  • Theming: token catalog, dark mode, section overrides, --ui-* vars. Runtime contract: the SSR/hydration/island/SSE model and the full data-cui-* reference.
  • New components: the minimal-register, SSR-inline, hydrate contract. Widget builder: islands that hydrate against a registered handler.
  • Interactive patterns · Signal store: client state shared by many consumers from one declaration.
  • Forms: server-validated, with island-swapped error states.
  • PWA: installable manifest and an offline shell via uihost.WithPWA; works live and in static exports.
  • Image pipeline: pure-Go resize and WebP. Print documents: print-friendly HTML and PDF. Runtime modules: split per feature, so a page ships only the JS it uses.
  • Browse every component live in the gallery.
  • Porting an app with an existing frontend: the escape hatch for a foreign DOM contract — html/template screens plus static.Mount for a compiled design system. Possible, deliberately unsupported; the page says exactly where the line is.

Persisting & migrating

SQLite and Postgres, dialect-aware.

Working with agents

  • Agent-readiness: per-entity MCP tools, auto llm.md, and the discovery endpoints your app serves.
  • MCP server: the core/mcp reference: wire methods, registering tools, resources, templates, and prompts, gates, cursor pagination.
  • Embed: hand a screen to a site you don't control: one <script> tag, an origin allowlist, a themed iframe. Semantic search: local vector retrieval, no API key. Audit deps: flag packages an agent shouldn't import.
  • Kiln: experimental build-mode binary: an agent edits an in-memory model over HTTP.
  • ACP: the Agent Client Protocol server package behind kiln acp: sessions, streamed updates, permissioned tool calls.

Operations

Reference

Where to go next

  1. Get started: a running app in a few minutes.
  2. Entity declarations: the core of the model.
  3. Examples: reference apps, smallest first.
  4. Components: every UI component, one page each.

Every doc is grounded in the code, and each guide ends with a "common mistakes" note. The same content is available offline with gofastr docs.