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:
<!-- gofastr:compile
import "github.com/DonaldMurillo/gofastr/core/router"
import "github.com/DonaldMurillo/gofastr/core/render"
import "net/http"
-->
// 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 — a
migrated table, a REST API with filtering/sorting/pagination, MCP tools, and an
OpenAPI spec:
<!-- gofastr:compile
import "github.com/DonaldMurillo/gofastr/framework"
import "database/sql"
var db *sql.DB
import "github.com/DonaldMurillo/gofastr/core/schema"
-->
// 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, 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 blueprint 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.
- Entity declarations — Go or a
gofastr.yml;
both produce the same tables, routes, and tools. SetOwnerFieldfor
per-user data. - Filter DSL —
?status=published&views_gte=10&sort=-created_atparses to a typedWhere. - Eager loading —
?include=author.profileflattens the N+1. - Cursor pagination — keyset paging, opt-in.
- Hooks & transactions —
BeforeCreate/
AfterUpdatehooks share the parent transaction. - Batch endpoints — create, update, or delete many
rows in one request. Migrations — versioned, ordered,
reversible. - Multi-tenant scope — automatic
tenant_idfiltering.
Serving HTTP
The middleware between the socket and your handler, on by default.
- Auth — login, OAuth, magic-link, 2FA, password reset; each a
plugin. Access control — roles, permissions,
policies. - Security defaults — CSP, CSRF, rate limit, headers.
- Idempotency — an
Idempotency-Keyheader replays
mutations safely. Webhooks — signed outbound delivery
with retry. Notifications — multi-channel delivery. - Health checks · Plugins — the
lifecycle every battery uses.
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 plainframework.Appby hand. - Theming — token catalog, dark mode, section overrides,
--ui-*vars. Runtime contract — the
SSR/hydration/island/SSE model and the fulldata-fui-*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.
Persisting & migrating
SQLite and Postgres, dialect-aware.
- Audit log — a row per Create, Update, and Delete.
- Isolation — a separate local DB per git worktree.
- Factories — fixtures for tests.
Full-text search. - Uploads — file and image fields with pluggable storage.
- Env / .env — auto-loaded by
NewApp.
Working with agents
- Agent-readiness — per-entity MCP tools, auto
llm.md, and the discovery endpoints your app serves. - 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.
Operations
Reference
- Benchmarks ·
Performance results — how it performs and how
that's measured. - Code generation — what the scaffold writes and how to
read it. - The full A–Z index lists every doc.
Where to go next
- Get started — a running app in a few minutes.
- Entity declarations — the core of the model.
- Examples — reference apps, smallest first.
- 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.