Documentation
¶
Overview ¶
Package gobananas is the documentation root for go-bananas, the application framework for Go that is so simple, it's Bananas.
go-bananas is a lean, server-side-rendered (SSR) web framework plus a small application-infrastructure layer. It is assembled from focused, composable packages rather than a single monolith, so you import only what you need.
Web layer ¶
- github.com/mikehelmick/go-bananas/render: an html/template + text/template renderer with a rich default FuncMap, Subresource Integrity (SRI) asset tags, and optional hot-reload in development.
- github.com/mikehelmick/go-bananas/middleware: composable gorilla/mux middleware (secure headers, CSRF, sessions, gzip, request/trace IDs, locale, and a pluggable Authenticator seam).
- github.com/mikehelmick/go-bananas/session, github.com/mikehelmick/go-bananas/flash, and github.com/mikehelmick/go-bananas/cookiestore: typed session accessors, one-shot flash messages, and a hot-reloadable secure-cookie store.
- github.com/mikehelmick/go-bananas/webctx and github.com/mikehelmick/go-bananas/response: request-scoped context helpers and HTTP response/error helpers.
Infrastructure layer ¶
- github.com/mikehelmick/go-bananas/server: a gracefully-stoppable HTTP server.
- github.com/mikehelmick/go-bananas/secrets and github.com/mikehelmick/go-bananas/keys: pluggable secret and key managers. The core ships filesystem and in-memory providers; cloud providers (GCP, AWS, Azure, Vault) are opt-in sub-packages you blank-import to self-register, so their SDKs are only linked when used.
- github.com/mikehelmick/go-bananas/cache: a generic, TTL-based in-memory cache.
- github.com/mikehelmick/go-bananas/logging: a context-scoped log/slog-based logger.
See the example application under examples/ssr-oidc for an end-to-end SSR app wiring these packages together, including an OIDC Authenticator.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cache implements a generic, in-memory, TTL-based cache for any object.
|
Package cache implements a generic, in-memory, TTL-based cache for any object. |
|
Package cookiestore provides a github.com/gorilla/sessions.Store backed by encrypted cookies whose HMAC and encryption keys can be hot-reloaded.
|
Package cookiestore provides a github.com/gorilla/sessions.Store backed by encrypted cookies whose HMAC and encryption keys can be hot-reloaded. |
|
Package flash implements one-shot "flash" messages: alerts, errors, and warnings that are stored on a session, surfaced once on the next render, and then automatically cleared on read.
|
Package flash implements one-shot "flash" messages: alerts, errors, and warnings that are stored on a session, surfaced once on the next render, and then automatically cleared on read. |
|
Package form binds and validates HTML form submissions into Go structs.
|
Package form binds and validates HTML form submissions into Go structs. |
|
Package i18n loads gettext (.po) translations from a filesystem and resolves the best locale for a request, implementing the github.com/mikehelmick/go-bananas/middleware.LocaleProvider seam so ProcessLocale — and the renderer's "t"/"tDefault" template functions — work out of the box.
|
Package i18n loads gettext (.po) translations from a filesystem and resolves the best locale for a request, implementing the github.com/mikehelmick/go-bananas/middleware.LocaleProvider seam so ProcessLocale — and the renderer's "t"/"tDefault" template functions — work out of the box. |
|
internal
|
|
|
azureauth
Package azureauth provides the shared Key Vault authorizer used by the Azure secrets and keys providers.
|
Package azureauth provides the shared Key Vault authorizer used by the Azure secrets and keys providers. |
|
util
Package util holds small, dependency-free helpers shared across go-bananas.
|
Package util holds small, dependency-free helpers shared across go-bananas. |
|
Package keys defines a pluggable abstraction over key-management systems for signing and encryption.
|
Package keys defines a pluggable abstraction over key-management systems for signing and encryption. |
|
aws
Package aws provides an AWS KMS backed github.com/mikehelmick/go-bananas/keys.KeyManager.
|
Package aws provides an AWS KMS backed github.com/mikehelmick/go-bananas/keys.KeyManager. |
|
azure
Package azure provides an Azure Key Vault backed github.com/mikehelmick/go-bananas/keys.KeyManager.
|
Package azure provides an Azure Key Vault backed github.com/mikehelmick/go-bananas/keys.KeyManager. |
|
gcp
Package gcp provides a Google Cloud KMS backed github.com/mikehelmick/go-bananas/keys.KeyManager.
|
Package gcp provides a Google Cloud KMS backed github.com/mikehelmick/go-bananas/keys.KeyManager. |
|
vault
Package vault provides a HashiCorp Vault (transit engine) backed github.com/mikehelmick/go-bananas/keys.KeyManager.
|
Package vault provides a HashiCorp Vault (transit engine) backed github.com/mikehelmick/go-bananas/keys.KeyManager. |
|
Package logging provides a context-scoped logger built on the standard library's log/slog.
|
Package logging provides a context-scoped logger built on the standard library's log/slog. |
|
Package middleware provides composable github.com/gorilla/mux middleware for building server-side-rendered web applications.
|
Package middleware provides composable github.com/gorilla/mux middleware for building server-side-rendered web applications. |
|
Package render renders HTML, JSON, and CSV responses from templates loaded out of an io/fs.FS.
|
Package render renders HTML, JSON, and CSV responses from templates loaded out of an io/fs.FS. |
|
Package response provides HTTP response and error helpers that negotiate between HTML and JSON based on the request's Accept and Content-Type headers.
|
Package response provides HTTP response and error helpers that negotiate between HTML and JSON based on the request's Accept and Content-Type headers. |
|
Package secrets defines a pluggable abstraction over secret managers.
|
Package secrets defines a pluggable abstraction over secret managers. |
|
aws
Package aws provides an AWS Secrets Manager backed github.com/mikehelmick/go-bananas/secrets.SecretManager.
|
Package aws provides an AWS Secrets Manager backed github.com/mikehelmick/go-bananas/secrets.SecretManager. |
|
azure
Package azure provides an Azure Key Vault backed github.com/mikehelmick/go-bananas/secrets.SecretManager.
|
Package azure provides an Azure Key Vault backed github.com/mikehelmick/go-bananas/secrets.SecretManager. |
|
gcp
Package gcp provides a Google Secret Manager backed github.com/mikehelmick/go-bananas/secrets.SecretManager.
|
Package gcp provides a Google Secret Manager backed github.com/mikehelmick/go-bananas/secrets.SecretManager. |
|
vault
Package vault provides a HashiCorp Vault backed github.com/mikehelmick/go-bananas/secrets.SecretManager.
|
Package vault provides a HashiCorp Vault backed github.com/mikehelmick/go-bananas/secrets.SecretManager. |
|
Package server provides a small, gracefully-stoppable HTTP server.
|
Package server provides a small, gracefully-stoppable HTTP server. |
|
Package session provides typed, nil-safe accessors for the values the framework stores on a github.com/gorilla/sessions.Session, plus a helper to obtain the session's github.com/mikehelmick/go-bananas/flash.Flash.
|
Package session provides typed, nil-safe accessors for the values the framework stores on a github.com/gorilla/sessions.Session, plus a helper to obtain the session's github.com/mikehelmick/go-bananas/flash.Flash. |
|
Package webctx provides typed helpers for storing and retrieving request-scoped values on a context.Context.
|
Package webctx provides typed helpers for storing and retrieving request-scoped values on a context.Context. |
Click to show internal directories.
Click to hide internal directories.