burrow

package module
v0.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 13 Imported by: 0

README

Burrow

CI Release Go Version Go Report Card License Docs

A web framework for Go developers who want something like Django, Rails, or Flask — but with the deployment simplicity of a single static binary.

Most Go web development follows the "API backend + SPA frontend" pattern. Burrow takes a different approach: server-rendered HTML with templates, modular apps with their own routes and middleware, and a document database that just works. Deploy with embedded SQLite as a single binary, or connect to PostgreSQL for scale — same code, same API.

Built on Chi, Den (ODM with SQLite and PostgreSQL backends), and Go's standard html/template. Ideal for self-hosted applications, internal tools, or any project where "download, start, use" is the goal.

[!TIP] Why Burrow? A burrow is a network of interconnected chambers — each with its own purpose, yet part of a larger whole. That's exactly how the framework works: pluggable apps are the rooms, and your gophers live in them.

[!NOTE] Burrow is designed for server-rendered web applications, not API-only services. If you're building a JSON API with a separate frontend, a lighter router like Chi on its own is probably a better fit.

Features

  • App-based architecture — build your application from composable, self-contained apps
  • SQLite or PostgreSQL — embedded SQLite (pure Go, no CGO) for single-binary deploys, or PostgreSQL for scale — switch with one flag
  • Automatic schema — document types declared in code, tables and indexes created on startup
  • Standard templates — Go's html/template with a global template set, per-app FuncMaps, and automatic layout wrapping
  • Tailwind v4 by defaultcontrib/admin, contrib/auth, and contrib/jobs ship Tailwind v4 templates out of the box, and the bundled burrow tailwind sub-command auto-discovers every contrib's template directory so utility scanning Just Works. Prefer a different stack? Bring your own CSS and override the contrib templates via html/template's last-define-wins — Burrow's core itself ships no CSS.
  • Layout system — app layout via server, admin layout via admin package
  • CLI configuration — flags, environment variables, and TOML config via urfave/cli
  • CSRF protection — automatic token generation and validation
  • Flash messages — session-based flash message system
  • htmx-first interactivitycontrib/htmx ships the vendored JS plus response helpers (OpenDialog, SmartRedirect, etc.) so SSR pages get partial swaps and modals without a JS framework. Dark mode follows prefers-color-scheme.
  • Contrib apps — auth (WebAuthn/passkeys), sessions, i18n, admin, CSRF, flash messages, jobs, uploads, rate limiting, healthcheck, static files, API docs (Scalar)

Quick Start

The fastest path is the bundled burrow CLI, which scaffolds a project with the contrib stack, Tailwind v4, live reload, CI, and goreleaser config already wired:

go install github.com/oliverandrich/burrow/cmd/burrow@latest
burrow new myapp --module github.com/you/myapp
cd myapp && mise run setup && mise run dev

Without mise, the scaffold prints a go mod tidy && go run ./cmd/myapp fallback.

Or build from scratch:

mkdir myapp && cd myapp
go mod init myapp
go get github.com/oliverandrich/burrow@latest
package main

import (
    "context"
    "log"
    "net/http"
    "os"

    "github.com/oliverandrich/burrow"
    "github.com/go-chi/chi/v5"
    "github.com/urfave/cli/v3"
)

// homeApp is a minimal app with a single route.
type homeApp struct{}

func (a *homeApp) Name() string { return "home" }
func (a *homeApp) Routes(r chi.Router) {
    r.Method("GET", "/", burrow.Handle(func(w http.ResponseWriter, r *http.Request) error {
        return burrow.Text(w, http.StatusOK, "Hello from Burrow!")
    }))
}

func main() {
    srv := burrow.NewServer(
        &homeApp{},
    )

    cmd := &cli.Command{
        Name:   "myapp",
        Flags:  srv.Flags(nil),
        Action: srv.Run,
    }

    if err := cmd.Run(context.Background(), os.Args); err != nil {
        log.Fatal(err)
    }
}
go mod tidy
go run .

See example/hello/ for a minimal hello world app, or example/notes/ for a complete example with auth, admin, i18n, and more.

Architecture

contrib/        Reusable apps
  admin/        Admin panel coordinator (top-nav layout, dashboard cards, route mounting)
  apidocs/      Vendored Scalar OpenAPI documentation UI
  auth/         WebAuthn passkeys, recovery codes, email verification
  authmail/     Pluggable email renderer + SMTP implementation
  csrf/         CSRF protection
  healthcheck/  Liveness and readiness probes
  htmx/         htmx static asset + request/response helpers
  i18n/         Locale detection and translations
  jobs/         Den-backed background job queue (SQLite + Postgres)
  messages/     Flash messages
  ratelimit/    Per-client rate limiting
  session/      Cookie-based sessions
  staticfiles/  Static file serving with content-hashed URLs
  uploads/      File upload storage and serving
example/        Example applications (hello world, notes app)
The App Interface

Every app implements burrow.App:

type App interface {
    Name() string
}

Apps can optionally implement additional interfaces:

Interface Purpose
HasDocuments Register Den document types
HasRoutes Register HTTP routes
HasMiddleware Contribute middleware
HasNavItems Contribute navigation items
HasTemplates Contribute .html template files
HasFuncMap Contribute static template functions
HasRequestFuncMap Contribute request-scoped template functions
Configurable Define CLI flags and read configuration
HasCLICommands Contribute CLI subcommands
Seedable Seed the database with initial data
HasAdmin Contribute admin panel routes and nav items
HasStaticFiles Contribute embedded static file assets
HasTranslations Contribute translation files
HasDependencies Declare required apps
HasJobs Register background job handlers
PostConfigurable Second-pass configuration after all apps are configured
HasShutdown Clean up on graceful shutdown
Layouts

Layouts are template name strings. The app layout wraps user-facing pages:

srv.SetLayout("myapp/layout")

The admin layout is owned by the admin package:

admin.New(admin.WithLayout("custom/admin-layout"))

RenderTemplate renders page content, then wraps it in the layout template with .Content set to the rendered fragment. Layout templates access dynamic data via template functions:

{{ range navLinks }}...{{ end }}  {{/* filtered nav with active state */}}
{{ if currentUser }}...{{ end }}  {{/* authenticated user */}}
{{ csrfToken }}                   {{/* CSRF token for forms */}}
Configuration

Configuration is resolved in order: CLI flags > environment variables > TOML file.

Core flags include --host, --port, --database-dsn, --log-level, --log-format, --tls-mode, and more. Apps can contribute their own flags via the Configurable interface.

Document Registration

Apps declare their document types by implementing HasDocuments:

func (a *App) Documents() []document.Document {
    return []document.Document{&Poll{}, &Choice{}}
}

Tables and indexes are created automatically on startup via Den's Register(). No SQL migration files needed.

Development

Burrow uses mise for tool-version pinning and task running. After cloning:

mise install              # Install pinned Go + dev tools
mise run setup            # Verify the environment + install pre-commit git hooks

Common tasks:

mise run test             # Run all tests
mise run lint             # Run golangci-lint
mise run fmt              # Format code
mise run coverage         # Generate coverage report
mise run tidy             # Tidy module dependencies
mise run example-hello    # Run the hello world example
mise run example-notes    # Run the notes example application
mise tasks                # List every available task

Documentation

Full documentation is available in the docs/ directory.

License

Burrow is licensed under the MIT License.

The Go Gopher was originally designed by Renee French and is licensed under CC BY 4.0.

Third-party licenses are listed in THIRD_PARTY_LICENSES.md.

Documentation

Overview

Package burrow is a Go web framework built on chi, Den, and html/template. It provides a modular architecture where features are packaged as "apps" that plug into a shared server.

The root burrow package re-exports the most-used names from the sub-packages as type aliases and thin wrapper functions, so downstream code can keep writing burrow.App, burrow.AppConfig, burrow.NewServer, burrow.Handle and so on. Less-frequent names live in their proper sub-package:

Getting Started

Create a server, register apps, and run:

srv := burrow.NewServer(
    session.New(),
    csrf.New(),
    myapp.New(),
)
srv.SetLayout(myLayout)

app := &cli.Command{
    Name:   "mysite",
    Flags:  srv.Flags(nil),
    Action: srv.Run,
}
_ = app.Run(context.Background(), os.Args)

NewServer sorts apps by declared dependencies automatically. The boot sequence runs migrations, configures each app from CLI/ENV/TOML flags, and starts the HTTP server with graceful shutdown.

Handler Functions

Burrow handlers return an error instead of silently swallowing failures:

func listItems(w http.ResponseWriter, r *http.Request) error {
    items, err := fetchItems(r.Context())
    if err != nil {
        return err // logged and rendered as 500
    }
    return burrow.JSON(w, http.StatusOK, items)
}

Wrap them with Handle to get a standard http.HandlerFunc:

r.Get("/items", burrow.Handle(listItems))

Return an HTTPError to control the status code and message:

return burrow.NewHTTPError(http.StatusNotFound, "item not found")

App Interface

Every app implements App (Name only). Apps gain additional capabilities by implementing optional interfaces such as HasRoutes, HasMiddleware, HasMigrations, Configurable, HasShutdown, and others — all defined in the github.com/oliverandrich/burrow/app package.

Contrib Apps

The contrib/ directory provides reusable apps:

  • admin — admin panel coordinator with three-tier role gating
  • auth — WebAuthn passkey authentication with recovery codes
  • authmail — pluggable email rendering with SMTP backend
  • csrf — CSRF protection (gorilla/csrf)
  • healthcheck — liveness and readiness probes
  • htmx — HTMX asset serving and request/response helpers
  • humanize — i18n-aware template helpers for times, numbers, file sizes
  • jobs — Den-backed in-process job queue with retry (SQLite + Postgres)
  • messages — flash messages via session storage
  • ratelimit — per-client token bucket rate limiting
  • secure — security response headers (X-Frame-Options, HSTS, CSP, …)
  • selfupdate — in-app binary self-update from GitHub releases
  • session — cookie-based sessions (gorilla/sessions)
  • sse — Server-Sent Events with in-memory pub/sub broker
  • staticfiles — static file serving with content-hashed URLs

Locale detection and translations are provided by the root github.com/oliverandrich/burrow/i18n package, not a contrib.

Index

Constants

View Source
const CacheControlImmutable = web.CacheControlImmutable

CacheControlImmutable is the value to set on Cache-Control headers for content-hashed static assets. Alias for web.CacheControlImmutable.

Variables

View Source
var ErrNoTemplateExecutor = web.ErrNoTemplateExecutor

ErrNoTemplateExecutor is returned by Render when no executor is in context. Alias for web.ErrNoTemplateExecutor.

Functions

func Bind

func Bind(r *http.Request, v any) error

Bind parses a request body (JSON, multipart, or form-encoded) into v and validates it. Wrapper around web.Bind.

func CaptureResult added in v0.13.0

func CaptureResult(ctx context.Context, data []byte)

CaptureResult stores result data in the context-bound capture. Wrapper around tasks.CaptureResult.

func ClientIP added in v0.26.0

func ClientIP(ctx context.Context) string

ClientIP returns the client IP stored in the context by burrow's server-level ClientIP middleware (configured via --client-ip-mode). Returns "" when no middleware ran. Wrapper around chimw.GetClientIP. See docs/guide/client-ip.md for the trust model.

func ClientIPAddr added in v0.26.0

func ClientIPAddr(ctx context.Context) netip.Addr

ClientIPAddr returns the client IP as a netip.Addr. Use netip.Addr.IsValid to check whether a middleware ran. Wrapper around chimw.GetClientIPAddr.

func ContextValue

func ContextValue[T any](ctx context.Context, key any) (T, bool)

ContextValue retrieves a typed value from the context. Wrapper around app.ContextValue.

func CoreFlags

func CoreFlags(configSource func(key string) cli.ValueSource) []cli.Flag

CoreFlags returns the CLI flags for core framework configuration. Wrapper around app.CoreFlags.

func FlagSources

func FlagSources(configSource func(key string) cli.ValueSource, envVar, tomlKey string) cli.ValueSourceChain

FlagSources builds a cli.ValueSourceChain from an environment variable and an optional TOML key. Wrapper around app.FlagSources.

func HTML

func HTML(w http.ResponseWriter, code int, s string) error

HTML writes an HTML response with the given status code. Wrapper around web.HTML.

func Handle

func Handle(fn HandlerFunc) http.HandlerFunc

Handle wraps a HandlerFunc into an http.HandlerFunc with centralized error handling. Wrapper around web.Handle.

func IsAdmin added in v0.23.0

func IsAdmin(ctx context.Context) bool

IsAdmin returns true if the AuthChecker in context reports admin status. Wrapper around app.IsAdmin.

func IsAuthenticated added in v0.23.0

func IsAuthenticated(ctx context.Context) bool

IsAuthenticated returns true if the AuthChecker in context reports authentication. Wrapper around app.IsAuthenticated.

func IsLocalhost

func IsLocalhost(host string) bool

IsLocalhost reports whether the host string refers to a localhost address. Wrapper around app.IsLocalhost.

func IsStaff added in v0.23.0

func IsStaff(ctx context.Context) bool

IsStaff returns true if the AuthChecker in context reports staff status. Wrapper around app.IsStaff.

func JSON

func JSON(w http.ResponseWriter, code int, v any) error

JSON writes a JSON response with the given status code. Wrapper around web.JSON.

func Layout

func Layout(ctx context.Context) string

Layout retrieves the layout template name from the context. Wrapper around app.Layout.

func OpenDB added in v0.7.0

func OpenDB(ctx context.Context, dsn string, opts ...den.Option) (*den.DB, error)

OpenDB opens a database from a URL-style DSN. Wrapper around server.OpenDB.

func PageNumbers added in v0.6.0

func PageNumbers(current, total int) []int

PageNumbers returns the truncated page list for a paginator UI. Wrapper around pagination.PageNumbers.

func PageURL added in v0.6.0

func PageURL(basePath, rawQuery string, page int) string

PageURL builds a pagination URL preserving existing query parameters. Wrapper around pagination.PageURL.

func Render

func Render(w http.ResponseWriter, r *http.Request, statusCode int, name string, data map[string]any) error

Render writes a rendered template into the HTTP response, wrapping it in the layout for full-page requests. Wrapper around web.Render.

func RenderContent added in v0.6.0

func RenderContent(w http.ResponseWriter, r *http.Request, statusCode int, content template.HTML, data map[string]any) error

RenderContent writes pre-rendered template.HTML into the response. Wrapper around web.RenderContent.

func RenderError added in v0.5.0

func RenderError(w http.ResponseWriter, r *http.Request, code int, message string)

RenderError writes a typed error response (JSON or HTML based on Accept). Wrapper around web.RenderError.

func RenderFragment added in v0.9.0

func RenderFragment(ctx context.Context, name string, data map[string]any) (template.HTML, error)

RenderFragment executes a named template into template.HTML using the context's executor. Wrapper around web.RenderFragment.

func RequestIsHTTPS added in v0.29.0

func RequestIsHTTPS(r *http.Request) bool

RequestIsHTTPS reports whether the request should be treated as HTTPS for per-request security decisions (CSRF origin check, Secure cookies). Wrapper around app.RequestIsHTTPS: it honors a trusted reverse proxy's X-Forwarded-Proto (see --forwarded-mode) and falls back to r.TLS.

func RequestPath added in v0.9.0

func RequestPath(ctx context.Context) string

RequestPath retrieves the request path from the context. Wrapper around app.RequestPath.

func Text

func Text(w http.ResponseWriter, code int, s string) error

Text writes a plain-text response with the given status code. Wrapper around web.Text.

func Validate

func Validate(v any) error

Validate runs validator on v and returns any *ValidationError. Wrapper around web.Validate.

func WithAuthChecker added in v0.4.0

func WithAuthChecker(ctx context.Context, checker AuthChecker) context.Context

WithAuthChecker stores an AuthChecker in the context. Wrapper around app.WithAuthChecker.

func WithContextValue

func WithContextValue(ctx context.Context, key, val any) context.Context

WithContextValue stores a value in the context under the given key. Wrapper around app.WithContextValue.

func WithLayout

func WithLayout(ctx context.Context, name string) context.Context

WithLayout stores the layout template name in the context. Wrapper around app.WithLayout.

func WithNavItems

func WithNavItems(ctx context.Context, items []NavItem) context.Context

WithNavItems stores navigation items in the context. Wrapper around app.WithNavItems.

func WithRequestPath added in v0.9.0

func WithRequestPath(ctx context.Context, path string) context.Context

WithRequestPath stores the request path in the context. Wrapper around app.WithRequestPath.

func WithResultCapture added in v0.13.0

func WithResultCapture(ctx context.Context, rc *ResultCapture) context.Context

WithResultCapture stores a ResultCapture in the context. Wrapper around tasks.WithResultCapture.

func WithTemplateExecutor

func WithTemplateExecutor(ctx context.Context, exec TemplateExecutor) context.Context

WithTemplateExecutor stores the template executor in the context. Wrapper around app.WithTemplateExecutor.

Types

type AdminAuth added in v0.13.0

type AdminAuth = app.AdminAuth

AdminAuth provides middleware for the admin panel. Alias for app.AdminAuth.

type App

type App = app.App

App is the required interface that every burrow app implements. Alias for app.App.

type AppConfig

type AppConfig = app.AppConfig

AppConfig is passed to each app's Configure method, providing access to shared framework resources. Alias for app.AppConfig.

type AuthChecker added in v0.4.0

type AuthChecker = app.AuthChecker

AuthChecker carries auth-state closures in the request context. Alias for app.AuthChecker.

type Config

type Config = app.Config

Config holds core framework configuration. Alias for app.Config.

func NewConfig

func NewConfig(cmd *cli.Command) *Config

NewConfig creates a Config from a parsed CLI command. Wrapper around app.NewConfig.

type Configurable

type Configurable = app.Configurable

Configurable is implemented by apps that need to read configuration and perform setup. Alias for app.Configurable.

type DatabaseConfig

type DatabaseConfig = app.DatabaseConfig

DatabaseConfig holds database settings. Alias for app.DatabaseConfig.

type Enqueuer added in v0.13.0

type Enqueuer = tasks.Enqueuer

Enqueuer provides job submission and cancellation. Alias for tasks.Enqueuer.

type FieldError

type FieldError = web.FieldError

FieldError is one entry in a ValidationError. Alias for web.FieldError.

type HTTPError

type HTTPError = web.HTTPError

HTTPError is the typed error returned from handlers to control status code and message. Alias for web.HTTPError.

func NewHTTPError

func NewHTTPError(code int, message string) *HTTPError

NewHTTPError constructs a typed HTTP error. Wrapper around web.NewHTTPError.

type HandlerFunc

type HandlerFunc = web.HandlerFunc

HandlerFunc is burrow's error-returning HTTP handler signature. Alias for web.HandlerFunc.

type HasAdmin

type HasAdmin = app.HasAdmin

HasAdmin is implemented by apps that contribute admin routes and nav items. Alias for app.HasAdmin.

type HasCLICommands

type HasCLICommands = app.HasCLICommands

HasCLICommands is implemented by apps that contribute CLI subcommands. Alias for app.HasCLICommands.

type HasDependencies

type HasDependencies = registry.HasDependencies

HasDependencies is implemented by apps that require other apps to be registered first. Alias for registry.HasDependencies.

type HasDocuments added in v0.11.0

type HasDocuments = app.HasDocuments

HasDocuments is implemented by apps that register Den document types. Alias for app.HasDocuments.

type HasFlags added in v0.10.0

type HasFlags = app.HasFlags

HasFlags is implemented by apps that define CLI flags. Alias for app.HasFlags.

type HasFuncMap

type HasFuncMap = app.HasFuncMap

HasFuncMap is implemented by apps that provide static template functions. Alias for app.HasFuncMap.

type HasJobs

type HasJobs = tasks.HasJobs

HasJobs is implemented by apps that register background job handlers. Alias for tasks.HasJobs.

type HasMiddleware

type HasMiddleware = app.HasMiddleware

HasMiddleware is implemented by apps that contribute HTTP middleware. Alias for app.HasMiddleware.

type HasMigrations added in v0.22.0

type HasMigrations = app.HasMigrations

HasMigrations is implemented by apps that ship versioned migrations. Alias for app.HasMigrations.

type HasNavItems

type HasNavItems = app.HasNavItems

HasNavItems is implemented by apps that contribute navigation items. Alias for app.HasNavItems.

type HasRequestFuncMap

type HasRequestFuncMap = app.HasRequestFuncMap

HasRequestFuncMap is implemented by apps that provide context-scoped template functions. Alias for app.HasRequestFuncMap.

type HasRoutes

type HasRoutes = app.HasRoutes

HasRoutes is implemented by apps that register HTTP routes. Alias for app.HasRoutes.

type HasShutdown

type HasShutdown = app.HasShutdown

HasShutdown is implemented by apps that need cleanup during graceful shutdown. Alias for app.HasShutdown.

type HasStaticFiles

type HasStaticFiles = app.HasStaticFiles

HasStaticFiles is implemented by apps that contribute static assets. Alias for app.HasStaticFiles.

type HasTemplates

type HasTemplates = app.HasTemplates

HasTemplates is implemented by apps that provide HTML template files. Alias for app.HasTemplates.

type HasTranslations

type HasTranslations = app.HasTranslations

HasTranslations is implemented by apps that contribute translation files. Alias for app.HasTranslations.

type JobConfig

type JobConfig = tasks.JobConfig

JobConfig holds per-handler job configuration. Alias for tasks.JobConfig.

type JobHandlerFunc

type JobHandlerFunc = tasks.JobHandlerFunc

JobHandlerFunc is the signature for job handler functions. Alias for tasks.JobHandlerFunc.

type JobOption

type JobOption = tasks.JobOption

JobOption configures job handler registration. Alias for tasks.JobOption.

func WithMaxRetries

func WithMaxRetries(n int) JobOption

WithMaxRetries sets the maximum number of retries for a job type. Wrapper around tasks.WithMaxRetries.

func WithPriority added in v0.13.0

func WithPriority(n int) JobOption

WithPriority sets the default priority for a job type. Wrapper around tasks.WithPriority.

type NamedMigration added in v0.22.0

type NamedMigration = app.NamedMigration

NamedMigration pairs a version label with a Den migration. Alias for app.NamedMigration.

type NavItem = app.NavItem

NavItem represents a navigation entry contributed by an app. Alias for app.NavItem.

func NavItems(ctx context.Context) []NavItem

NavItems retrieves the navigation items from the context. Wrapper around app.NavItems.

type NavLink = app.NavLink

NavLink is a template-ready navigation item with pre-computed active state. Alias for app.NavLink.

type PageRequest

type PageRequest = pagination.PageRequest

PageRequest captures requested limit and page from the query string. Alias for pagination.PageRequest.

func ParsePageRequest

func ParsePageRequest(r *http.Request) PageRequest

ParsePageRequest extracts limit and page from the request query string. Wrapper around pagination.ParsePageRequest.

type PageResponse

type PageResponse[T any] = pagination.PageResponse[T]

PageResponse wraps items and pagination metadata for JSON APIs. Alias for pagination.PageResponse.

type PageResult

type PageResult = pagination.PageResult

PageResult holds the computed pagination metadata. Alias for pagination.PageResult.

func CursorResult

func CursorResult(hasMore bool, nextCursor string) PageResult

CursorResult builds pagination metadata for forward cursor pagination. Wrapper around pagination.CursorResult.

func OffsetResult

func OffsetResult(pr PageRequest, totalCount int) PageResult

OffsetResult computes pagination metadata from a request and total count. Wrapper around pagination.OffsetResult.

type PostConfigurable added in v0.7.4

type PostConfigurable = app.PostConfigurable

PostConfigurable is implemented by apps that need a second configuration pass after Configure has run on every Configurable app. Alias for app.PostConfigurable.

type Queue

type Queue = tasks.Queue

Queue provides job handler registration, enqueueing, and cancellation. Alias for tasks.Queue.

type ReadinessChecker added in v0.4.0

type ReadinessChecker = app.ReadinessChecker

ReadinessChecker is implemented by apps that contribute to the readiness probe. Alias for app.ReadinessChecker.

type Registry

type Registry = registry.Registry

Registry stores the apps that make up a Server. Alias for registry.Registry — operate on it with the free functions in package registry: registry.New, registry.Add, registry.Get, etc.

type ResultCapture added in v0.13.0

type ResultCapture = tasks.ResultCapture

ResultCapture holds the captured result of a job handler. Alias for tasks.ResultCapture.

type ResultTask added in v0.13.0

type ResultTask[P, R any] = tasks.ResultTask[P, R]

ResultTask is a generic typed task that captures a result. Alias for tasks.ResultTask.

func DefineResultTask added in v0.13.0

func DefineResultTask[P, R any](name string, handler func(context.Context, P) (R, error), opts ...JobOption) *ResultTask[P, R]

DefineResultTask wires up a generic typed task that captures a result. Wrapper around tasks.DefineResultTask.

type Server

type Server = server.Server

Server is the framework's main orchestrator. Alias for server.Server. Construct with NewServer; configure layout via server.Server.SetLayout; start with server.Server.Run inside a urfave/cli action.

func NewServer

func NewServer(apps ...App) *Server

NewServer creates a Server and registers the given apps. Apps are auto-sorted to satisfy HasDependencies declarations. Wrapper around server.New.

type ServerConfig

type ServerConfig = app.ServerConfig

ServerConfig holds HTTP server settings. Alias for app.ServerConfig.

type Startable added in v0.9.0

type Startable = server.Startable

Startable is implemented by apps that need to start background processes after the boot sequence completes. Alias for server.Startable.

type StorageConfig added in v0.15.0

type StorageConfig = app.StorageConfig

StorageConfig holds file-storage settings. Alias for app.StorageConfig.

type TLSConfig

type TLSConfig = app.TLSConfig

TLSConfig holds TLS settings. Alias for app.TLSConfig.

type TaskDefinition added in v0.13.0

type TaskDefinition[P any] = tasks.TaskDefinition[P]

TaskDefinition is a generic typed task wrapper. Alias for tasks.TaskDefinition.

func DefineTask added in v0.13.0

func DefineTask[P any](name string, handler func(context.Context, P) error, opts ...JobOption) *TaskDefinition[P]

DefineTask wires up a generic typed task definition. Wrapper around tasks.DefineTask.

type TemplateExecutor

type TemplateExecutor = app.TemplateExecutor

TemplateExecutor executes a named template with the given data. Alias for app.TemplateExecutor.

func TemplateExec added in v0.5.0

func TemplateExec(ctx context.Context) TemplateExecutor

TemplateExec retrieves the template executor from the context. Wrapper around app.TemplateExec.

func TemplateExecutorFromContext

func TemplateExecutorFromContext(ctx context.Context) TemplateExecutor

TemplateExecutorFromContext is a deprecated alias for TemplateExec.

type ValidationError

type ValidationError = web.ValidationError

ValidationError carries per-field validation failures. Alias for web.ValidationError.

Directories

Path Synopsis
Package app defines the foundation types and capability interfaces every burrow app implements.
Package app defines the foundation types and capability interfaces every burrow app implements.
Package burrowtest provides test helpers for code that uses the burrow framework.
Package burrowtest provides test helpers for code that uses the burrow framework.
cmd
burrow command
Command burrow is the Burrow framework's command-line companion.
Command burrow is the Burrow framework's command-line companion.
contrib
admin
Package admin provides the admin panel coordinator as a burrow contrib app.
Package admin provides the admin panel coordinator as a burrow contrib app.
apidocs
Package apidocs serves a self-hosted, interactive OpenAPI documentation UI.
Package apidocs serves a self-hosted, interactive OpenAPI documentation UI.
auth
Package auth provides authentication as a burrow contrib app.
Package auth provides authentication as a burrow contrib app.
auth/authtest
Package authtest provides test helpers for creating auth-migrated databases and test users, following the convention of net/http/httptest.
Package authtest provides test helpers for creating auth-migrated databases and test users, following the convention of net/http/httptest.
authmail
Package authmail defines the Renderer interface for auth email templates.
Package authmail defines the Renderer interface for auth email templates.
authmail/smtpmail
Package smtpmail provides an SMTP-based implementation of auth.EmailService with pluggable email templates via authmail.Renderer.
Package smtpmail provides an SMTP-based implementation of auth.EmailService with pluggable email templates via authmail.Renderer.
csrf
Package csrf provides CSRF protection as a burrow contrib app.
Package csrf provides CSRF protection as a burrow contrib app.
healthcheck
Package healthcheck provides liveness and readiness probes for burrow.
Package healthcheck provides liveness and readiness probes for burrow.
htmx
Package htmx provides request detection and response helpers for htmx, inspired by django-htmx.
Package htmx provides request detection and response helpers for htmx, inspired by django-htmx.
humanize
Package humanize provides i18n-aware template functions for human-friendly display of times, numbers, and file sizes.
Package humanize provides i18n-aware template functions for human-friendly display of times, numbers, and file sizes.
messages
Package messages provides flash message support as a burrow contrib app.
Package messages provides flash message support as a burrow contrib app.
ratelimit
Package ratelimit provides per-client rate limiting as a burrow contrib app.
Package ratelimit provides per-client rate limiting as a burrow contrib app.
selfupdate
Package selfupdate adds an `update` sub-command to a burrow app that downloads the latest release for the running OS/arch from GitHub, Codeberg, or any Forgejo instance and atomically replaces the binary in place.
Package selfupdate adds an `update` sub-command to a burrow app that downloads the latest release for the running OS/arch from GitHub, Codeberg, or any Forgejo instance and atomically replaces the binary in place.
session
Package session provides cookie-based session management as a burrow contrib app.
Package session provides cookie-based session management as a burrow contrib app.
sse
Package sse provides a Server-Sent Events (SSE) contrib app for burrow.
Package sse provides a Server-Sent Events (SSE) contrib app for burrow.
staticfiles
Package staticfiles provides static file serving as a burrow contrib app.
Package staticfiles provides static file serving as a burrow contrib app.
Package crud turns a Den document type into a standard set of JSON CRUD endpoints, so the common 90% of an API can be declared instead of hand-written while custom actions stay ordinary chi routes.
Package crud turns a Den document type into a standard set of JSON CRUD endpoints, so the common 90% of an API can be declared instead of hand-written while custom actions stay ordinary chi routes.
example
hello command
Command hello is a minimal burrow application that serves a single "Hello, World!" page with Tailwind v4 styling and i18n support.
Command hello is a minimal burrow application that serves a single "Hello, World!" page with Tailwind v4 styling and i18n support.
notes/cmd/server command
Command server demonstrates how to build an application using the burrow framework with contrib apps.
Command server demonstrates how to build an application using the burrow framework with contrib apps.
notes/internal/app
Package app is the example-notes shell: it owns the project's layout templates, the homepage, the compiled Tailwind CSS bundle, and the brand logo.
Package app is the example-notes shell: it owns the project's layout templates, the homepage, the compiled Tailwind CSS bundle, and the brand logo.
notes/internal/notes
Package notes is an example custom app demonstrating the burrow framework.
Package notes is an example custom app demonstrating the burrow framework.
Package forms provides struct-based form definitions for creation, binding, validation, and field metadata extraction.
Package forms provides struct-based form definitions for creation, binding, validation, and field metadata extraction.
Package i18n provides internationalization as core framework infrastructure.
Package i18n provides internationalization as core framework infrastructure.
internal
bgloop
Package bgloop provides panic recovery for long-lived background goroutines.
Package bgloop provides panic recovery for long-lived background goroutines.
cryptokey
Package cryptokey provides shared utilities for resolving and decoding hex-encoded 32-byte cryptographic keys used by contrib apps (csrf, session).
Package cryptokey provides shared utilities for resolving and decoding hex-encoded 32-byte cryptographic keys used by contrib apps (csrf, session).
dev
Package dev implements the `burrow dev` integrated development server: a file watcher that restarts the application on source changes and (optionally) runs the Tailwind v4 standalone CLI in `--watch` mode alongside it.
Package dev implements the `burrow dev` integrated development server: a file watcher that restarts the application on source changes and (optionally) runs the Tailwind v4 standalone CLI in `--watch` mode alongside it.
scaffold
Package scaffold renders embedded file trees into a destination directory, applying placeholder substitution and (optionally) a Go module path rewrite.
Package scaffold renders embedded file trees into a destination directory, applying placeholder substitution and (optionally) a Go module path rewrite.
tailwind
Package tailwind drives the standalone Tailwind v4 CLI with a pre-generated `@source` listing that points at every template directory in the project — Burrow's contribs plus the project's own templates.
Package tailwind drives the standalone Tailwind v4 CLI with a pre-generated `@source` listing that points at every template directory in the project — Burrow's contribs plus the project's own templates.
translationscheck
Package translationscheck holds the repo-wide translation guards that walk every contrib's and example's TOML translation files and assert cross-cutting invariants: go-i18n accepts each file (reserved-keys guard) and no message ID has divergent values across files for the same locale (boot-time merge collision guard).
Package translationscheck holds the repo-wide translation guards that walk every contrib's and example's TOML translation files and assert cross-cutting invariants: go-i18n accepts each file (reserved-keys guard) and no message ID has divergent values across files for the same locale (boot-time merge collision guard).
Package registry holds the apps that make up a burrow Server.
Package registry holds the apps that make up a burrow Server.
Package uploader provides HTTP-layer helpers for file uploads built on top of den.Storage: an Uploader service that validates and persists multipart uploads into a document.Attachment, a ServeHandler that streams stored bytes back to HTTP clients, and a Mount helper that registers the serving handler at the Storage's own URL prefix.
Package uploader provides HTTP-layer helpers for file uploads built on top of den.Storage: an Uploader service that validates and persists multipart uploads into a document.Attachment, a ServeHandler that streams stored bytes back to HTTP clients, and a Mount helper that registers the serving handler at the Storage's own URL prefix.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL