Documentation

go-bananas is a server-side-rendering web framework plus a small application-infrastructure layer for Go. It is assembled from focused, composable packages rather than a single monolith, so you import only what you need.

Packages at a glance

Web layer

PackagePurpose
renderhtml/template + text/template renderer with a rich FuncMap and SRI asset tags
formBind, validate, and re-render HTML forms with preserved input and inline errors
middlewareComposable gorilla/mux middleware + the Authenticator seam
session · flash · cookiestoreTyped session accessors, one-shot flash messages, hot-reloadable cookie store
webctx · responseRequest-scoped context helpers and HTTP response/error helpers
i18ngettext (.po) translations with Accept-Language matching

Infrastructure layer

PackagePurpose
serverGracefully-stoppable HTTP server
secrets · keysPluggable secret and key managers (filesystem/in-memory core; cloud opt-in)
cacheGeneric, TTL-based in-memory cache
loggingContext-scoped log/slog logger

Cross-cutting guides cover Forms (the bind/validate/re-render loop) and Configuration (composing per-package env-tagged Config structs with go-envconfig).

These guides walk through each area. For the complete, always-current API, see pkg.go.dev — every headline API there has a runnable example.


Getting started

Install go-bananas and stand up a minimal SSR server.

The middleware chain

Assemble the recommended middleware in the right order.

Rendering & templates

The renderer, its FuncMap, SRI asset tags, and hot reload.

Sessions, flash & CSRF

Secure-cookie sessions, one-shot flash messages, and CSRF protection.

Authenticator & OIDC

The pluggable auth seam, and wiring OIDC with it.

Secrets & keys

Pluggable secret and key managers with opt-in cloud providers.

HTTP server

A small, gracefully-stoppable HTTP server.

Cache & logging

A generic TTL cache and a context-scoped slog logger.

Internationalization

Translate your templates with gettext (.po) files.

Forms

Bind, validate, and re-render HTML forms with preserved input and inline errors.

Configuration

Compose per-package env-tagged Config structs with go-envconfig — no central config package.