Repository navigation
Releases
v1.7.0 — status helpers
Named status helpers, and error responses that callers can propagate.
Status helpers
BadRequest, Unauthorized, Forbidden, Conflict, UnprocessableEntity, TooManyRequests, InternalServerError, and ServiceUnavailable write the status and a message, then return ErrResponseWritten. An empty message uses the status text.
return ctx.Forbidden("nope")NotFound is unchanged (404 page not found). Other codes stay on ctx.Status(code).Error(message).
Behavior change
Context.Error and Context.NotFound now return ErrResponseWritten after writing the body. Handler treats that error as already handled, including when wrapped, so return ctx.Error(...) still completes the request. A helper that returns it is non-nil, so if err != nil { return err } stops before a second write.
Callers that treated a nil return from Error or NotFound as success and then wrote their own body must propagate the error instead.
Tooling
- Requires Go 1.26. Direct modules updated: parapet v0.19.2, testify v1.12.1, minify v2.25.0.
- Repo guidance lives in
AGENTS.md.
Full changelog: v1.6.0...v1.7.0 (#125, #126)
v1.6.0 — htmx SPA integration
Server-rendered apps that feel like a SPA with htmx — one template set, no client build step. See the htmx guide.
Fragment rendering
ctx.View("page#form", data)renders a single{{block}}/{{define}}of a view through the same minify/ETag pipeline as full pages.ctx.ViewPartial(name, fragment, data)— fragment for htmx partial requests, full page for everyone else (deep links, back button, JS-off).- Breaking (parse time only):
#is now reserved — registering a template or component name containing it panics at parse time.
htmx helpers
- Predicates
ctx.IsBoosted()andctx.WantsPartial()(pure header reads;IsHTMX()unchanged). app.HTMXAwareRedirect(opt-in): the wholeRedirectfamily answers partial htmx requests withHX-Redirect+ 204 instead of a 3xx, so post/redirect/get + flash flows work unchanged over htmx.- New chainable helpers:
HTMXPushURL,HTMXReplaceURL,HTMXNoPush,HTMXReselect,HTMXLocation,HTMXTriggerAfterSwap,HTMXTriggerAfterSettle. - Behavior change: repeated
HTMXTriggercalls now merge into one header instead of clobbering (merged events serialize in alphabetical order).
Caching
ctx.NoCache()— chainableCache-Control: no-store.ctx.VaryHTMX()— chainableVary: HX-Request, HX-Boosted, HX-History-Restore-Requestfor cacheable responses that branch on htmx headers. Nothing sets Vary automatically; call it when you need it.
Docs
- README htmx section: partial rendering, out-of-band swap pattern, active-nav recipe, 422 validation config, caching guidance.
- Modernized CSRF guidance: explicit
SameSitecookies + Go 1.25'shttp.NewCrossOriginProtectioninstead of token middleware (#124).
Full changelog: v1.5.0...v1.6.0 (#123, #124)
v1.5.0
Highlights
A productivity release for server-rendered MPA / htmx sites — the output of a feature-DX review. Every addition is a thin, no-lock-in helper over the standard library; all changes are additive (no breaking changes, still Go 1.25).
htmx (#119)
ctx.IsHTMX(), HTMXRedirect, HTMXRefresh, and chainable HTMXReswap / HTMXRetarget / HTMXTrigger — detect htmx requests and drive swaps/redirects from Go.
Templates & components (#118)
dicttemplate func — pass multiple values to a component/partial:{{component "card" (dict "title" .T "body" .B)}}.jsontemplate func — inline<script>state, escaped for<script>safety.ctx.RenderComponentToString— render a component to a string for out-of-band composition.
Forms & navigation
ctx.FormState()(#121) — re-render a form with the submitted values and per-field validation errors.ctx.IsRoute(name)(#122) — most-specific active-nav highlighting; use from templates as{{.IsRoute "home"}}by passingctxas the view data.- Stateless flash messages
AddFlash/Flashes(#120) — post/redirect/get with no session store.
Security
- Opt-in signed cookies (#117) — a
CookieSignerinterface plus an HMAC-SHA256 reference impl (NewHMACCookieSigner), wired throughAddSignedCookie/SignedCookieValue. Binds the cookie name into the MAC, verifies in constant time.
What's Changed
- feat: add opt-in signed cookies (CookieSigner + HMAC-SHA256) by @acoshift in #117
- feat: add dict/json template funcs and RenderComponentToString by @acoshift in #118
- feat: add htmx Context helpers by @acoshift in #119
- feat: add stateless flash messages by @acoshift in #120
- feat: add FormState for re-rendering forms after validation by @acoshift in #121
- feat: add ctx.IsRoute for active-nav highlighting by @acoshift in #122
Full Changelog: v1.4.0...v1.5.0
v1.4.0
Highlights
New Context helpers (#115)
XML(data)andBindXML(v)— XML response and request-body binding, mirroringJSON/BindJSON(XML responses support ETag).StatusCode()— read back the status code set viaStatus().QueryValue*typed getters (QueryValueInt,QueryValueInt64,QueryValueFloat32/64,QueryValueTrimSpace[Comma]) for query-only reads, mirroring theFormValue*family.FormValues/PostFormValues/QueryValues— slice getters for multi-valued fields (checkboxes, multi-select, repeated params).
⚠️ Behavior change (#114)
Registering a duplicate component name via ParseComponent / ParseComponentFile now panics with ErrComponentDuplicate instead of silently overwriting the existing component. This was a bug — the duplicate check looked at the template namespace instead of the component namespace, and now matches the Component() loader. If you relied on the silent overwrite, give the components distinct names.
Tooling & quality
- Requires Go 1.25; dependencies upgraded — parapet, testify, minify (#112).
- Statement coverage raised to ~97% with a substantial regression-test pass (#114).
- Runnable
example_test.goadded so usage shows on pkg.go.dev (#116). - CI: dropped codecov, added the GitHub Actions test badge (#113).
What's Changed
- chore: require Go 1.25, upgrade dependencies, add CLAUDE.md by @acoshift in #112
- ci: drop codecov, add GitHub Actions test badge by @acoshift in #113
- test: add regression tests and fix component duplicate-detection bug by @acoshift in #114
- feat: add XML/BindXML, StatusCode getter, and query-value helpers by @acoshift in #115
- docs: add runnable examples (example_test.go) by @acoshift in #116
Full Changelog: v1.3.0...v1.4.0
v1.3.0
v1.2.0
Breaking Changed
- remove builder style
Before
app := hime.New().Address(":8080").Handler(h)
app.Template().Minify().Parse("index", "<p>index</p>")After
app := hime.New()
app.Address(":8080")
app.Handler(h)
t := app.Template()
t.Minify()
t.Parse("index", "<p>index</p>")What's Changed
- update dependencies by @acoshift in #104
- app implement ServeHandler by @acoshift in #105
- improve component by @acoshift in #106
- implement ctx.Render by @acoshift in #107
- move http server logic out to parapet by @acoshift in #108
- change go mod to 1.21, update gh action version by @acoshift in #109
Full Changelog: v1.1.4...v1.2.0