Repository navigation
v0.3.0 — form handling + config
Two composable, storage-free primitives that close the most central remaining SSR gap, while keeping the core lean (curated-toolkit philosophy — no ORM, no generators, nothing that forces a storage opinion).
✨ Highlights
form package (new)
The server-side parse → validate → re-render loop, previously fully manual.
form.Bind(r, dst) (Errors, error)—gorilla/schemabinding +go-playground/validatortags, with errors keyed by theformfield name so one name spans your HTML, binding, and errors.- Honest two-failure-mode contract: a non-nil
errormeans an unprocessable request (respond400);Errors.Any()means invalid user input (re-render with per-field errors and the user's input preserved). - Optional
Validatorhook for cross-field / bespoke rules thevalidatetags can't express (e.g. a must-accept-terms checkbox). - New dependencies are isolated to this package — the rest of the framework (and your
secrets/keysbuilds) stays free of them, and cloud-isolation is unchanged.
type signup struct {
Email string `form:"email" validate:"required,email"`
Age int `form:"age" validate:"gte=18"`
}
errs, err := form.Bind(r, &in)
if err != nil { response.BadRequest(w, r, renderer); return } // unprocessable
if errs.Any() { // invalid input
renderer.RenderHTMLStatus(w, http.StatusUnprocessableEntity, "signup",
webctx.TemplateMap{"Form": in, "Errors": errs})
return
}Configuration via go-envconfig
- No new package:
logging.Configfollows the existingsecrets.Config/keys.Configenv-tag pattern, and apps compose one config struct processed by a singleenvconfig.Process. - The example drops its hand-rolled
env/envBoolhelpers in favor of a composedappConfig.
render
- 422 Unprocessable Entity is now an allowed response code — the conventional status for a form that failed validation.
📚 Docs & example
- New Forms and Configuration guides.
examples/ssr-oidcwires the full validated/submitloop (422 re-render with preserved input, success flash + redirect) and the composed config.
✅ Quality
- Reviewed by parallel security / correctness / design agents across multiple models;
govulncheckclean on both modules; cloud isolation preserved (form/logging/secrets= 0);go test -race,golangci-lint, and the docs build all green.
Full changelog: v0.2.0...v0.3.0