Build customer portals, admin tools, and interactive websites with Go, HTML, and HTMX.
Goldr (Go Layout-Driven Router) is a server-first Go web framework. Keep page
handlers, templates, and actions together, compose layouts through directories,
and let Goldr generate your routing and URL helpers. Write HTML with
templ and keep browser interactions visible in
ordinary HTMX attributes.
Your application uses ordinary Go functions and a standard net/http server.
Goldr is v0. APIs and conventions may change before v1.
Why Goldr
A portal needs more than a collection of request handlers. You need shared
page shells, forms that update part of a screen, links between related records,
and consistent behavior across customer and admin areas. As those areas grow,
you also need to find the code behind a URL and understand which layouts and
middleware apply to it.
Goldr brings those pieces into one Go workflow: filesystem routes, nested
layouts, explicit page and fragment responses, generated URL helpers, and
tools for developing and inspecting the application. You write the business
logic and HTML; Goldr generates the dispatch and composition code around them.
You can keep your existing Go libraries and mount the generated handler in a
standard net/http server.
See Your Application In The Directory Tree
Find a page's request logic and HTML in the same directory:
app/routes/
layout.go Shared layout logic
layout.templ Shared HTML shell
route.go /
page.templ
users/
layout.go Layout for /users and its pages
layout.templ
route.go /users, /users/table
page.templ
frag_table.templ
by_id/
route.go /users/{id}
page.templ
content/
about/
page.json Page title and description
body.md /about
The route directory determines the URL. Declare pages, HTMX fragments, and
mutation actions in route.go; keep their templates beside it. Layouts wrap
pages in their directory and below, so the user detail page shares both the
site shell and the users layout. by_id/ declares the {id} URL parameter
using a Go-safe directory name.
Before your application runs, go tool goldr generate scans app/routes and
reads its route and layout declarations without executing your application.
It generates ordinary Go dispatch and URL helpers: you can inspect the wiring,
and the Go compiler checks calls to your handlers. The running server uses that
code, with no runtime route discovery or dynamic handler loading.
What Goldr Provides
Shared Shells And Portal Sections
Use nested layouts for the site shell, an admin sidebar, and a section's tabs.
Pages supply metadata and typed layout data, so a child page can select an
active tab or provide a toolbar without duplicating the surrounding HTML.
Keep each workflow's handlers, templates, and actions in its route directory.
See Routes And Layouts.
For sections you need in several places, mount a shared Kit route subtree
under different live URLs. A reports implementation can serve both
/admin/reports and /user/reports, with each owner supplying its dependencies
and selecting which child routes to expose. See
Mounted Kit Route Subtrees.
Forms And Partial Page Updates
Declare pages, fragments, and mutation actions together. Use HTMX to filter a
table, load a dialog, or submit a form; return the HTML needed for that update
from Go. Goldr provides explicit page, fragment, redirect, and text responses,
plus HTMX response-header helpers. Your handlers choose validation rules and
render field errors beside the inputs.
Custom error hooks let you provide full error pages or HTMX error fragments
that fit the surrounding workflow. See HTMX and
Error Handling.