Host-aware routing on top of net/http: route groups, middleware, named routes, mounted routers and not-found pages, with middleware for logging, security headers, compression and output caching.
go-webthings is a family of focused packages for server-rendered Go applications that still want sharp interactivity. The pieces stay small: routing is routing, template knowledge is documented, and partial rendering is explicit.
You work with ordinary net/http and normal html/template files, and get HTMX-friendly updates without turning the browser into the main application runtime.
Requests are routed by go-router, template contracts are described by go-clue, and full pages or HTMX fragments are rendered by go-partial.
Host-aware routing on top of net/http: route groups, middleware, named routes, mounted routers and not-found pages, with middleware for logging, security headers, compression and output caching.
Typed contracts and editor metadata for html/template files. Templates stay plain, while your editor can complete, navigate and diagnose model access.
Renders full pages or just the part that's needed from the same templates: targeted HTMX updates, out-of-band swaps, selections, actions and reusable regions, without turning HTML into a component dialect.
Forms, translations and asset preparation follow the same approach: explicit Go types and HTML-first rendering. Each package can be used on its own.
Typed HTML forms from struct tags, with submission mapping, field validation, configurable themes, request metadata and CSRF protection.
Vendors pinned JavaScript and CSS packages at build time with a lock file, embeds them, serves them with versioned URLs and Subresource Integrity, and generates import maps and stylesheet tags for your templates.
Gettext PO catalogues with request-local locale selection, plural forms, translation contexts and extraction of literal keys from Go templates.
The Go library go-webthings runs the backend of a website, built from these packages. Your site is a small Go program: you bring the templates and choose the modules. The result is a single binary, running on SQLite with no other service, or on PostgreSQL or MySQL.
app := webthings.New(webthings.Config{
Name: "My site",
Locales: locales.Config{
Default: "en",
Enabled: []string{"en", "nl"},
},
Templates: os.DirFS("templates"),
})
err := app.Use(
publishing.Module("news", "News"),
events.Module("agenda", "Agenda"),
)
if err != nil {
log.Fatal(err)
}
err = app.ListenAndServe(ctx, ":8080")
You add a module with one line: its admin sections, pages, template functions and database tables come with it. The bundled modules use only the public API, so a module of your own can do everything they do.