Releases: 0mjs/zinc
Release list
v0.2.1
Zinc 0.2.1
Zinc 0.2.1 tightens route matching and ships the new Zinc documentation site.
Router fixes
- Fix case-insensitive matching for dynamic routes.
- Match catch-all parameters when the remaining path is empty.
- Reject malformed legacy colon and wildcard route patterns consistently.
- Keep exact static routes ahead of catch-all routes.
Documentation
- Replace the previous documentation site with the new Astro and Starlight site.
- Add complete Guide, API Reference, Middleware, and Cookbook sections.
- Add validated examples and internal-link checks.
This is a backwards-compatible patch release for Zinc 0.2 applications.
v0.2.0
Zinc 0.2.0
Zinc 0.2 makes the framework a clearer application layer for Go's standard HTTP stack. It keeps the small Get, JSON, and error-returning handler experience while making routing, registration, and interoperability more idiomatic.
This is an intentional pre-1.0 breaking release. See the migration guide for mechanical upgrade steps.
Cleaner route definitions
Zinc now uses Go-style brace patterns:
app.Get("/users/{id}", showUser)
app.Get("/files/{path...}", serveFile)Zinc handlers read matched values through Context.Param:
c.Param("id")Standard handlers registered with HandleHTTP or Wrap receive the same
matched values through http.Request.PathValue:
app.HandleHTTP("GET /users/{id}", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, r.PathValue("id"))
}))Colon parameters, star wildcards, and regex-constrained patterns have been removed. Validate parameter formats in handlers, binders, or application code.
Minimal, typed registration
Route helpers accept only zinc.HandlerFunc and no longer return registration errors:
app.Get("/health", func(c *zinc.Context) error {
return c.String("ok")
})Invalid or conflicting routes declared in source panic during startup instead of allowing an error to be ignored. Routes loaded from configuration or plugins can use the explicit error-returning API:
if err := app.TryHandle(spec); err != nil {
return err
}The literal string handler shorthand and StringHandler have been removed.
First-class net/http
Register standard handlers directly:
app.HandleHTTP("GET /metrics", promhttp.Handler())Wrap the entire application in standard middleware:
app.UseHTTP(requestTracing, authenticateRequest)Standard middleware runs outside Zinc application, group, and route middleware. The original request, response writer, and optional interfaces such as Flusher, Hijacker, ReaderFrom, Pusher, and Unwrap are preserved.
App continues to implement http.Handler, so applications can keep using a user-owned http.Server.
Explicit context lifetime
Context.Copy has been removed. Zinc contexts are pooled and valid only while their handler is running.
Background work should extract exact values before the handler returns. Use c.Request().Context() when work shares request cancellation, or deliberately use context.WithoutCancel when standard context values must outlive it.
Behavior retained
- Handlers remain
func(*zinc.Context) error. Get,Post,c.JSON,c.String,Map, context storage, and typed getters remain.CaseSensitiveandStrictRoutingremain configurable and default tofalse.- Automatic
HEAD, automaticOPTIONS, and 405 responses remain enabled. app.Listenremains available with Zinc's server timeout defaults.- The
jobspackage remains an optional first-party package.
Performance
The new route syntax retains the pre-0.2 request-time performance of Zinc
handlers. Standard handlers populate PathValue at the native-handler boundary,
so ordinary Context.Param routes do not pay for unused interoperability work.
Both paths remain zero-allocation after warm-up.
On the final Apple M1 Pro comparison, Zinc recorded the lowest latency in 62 of 77 comparable rows against Gin, Echo, and Chi. It was fastest or within 2% of the fastest result in 63 rows. See the complete benchmark report for the environment, command, and complete results.
Breaking-change checklist
- Replace
:idwith{id}. - Replace
*pathwith{path...}. - Move regex route constraints into validation.
- Replace literal string routes with typed handlers.
- Remove error checks around source route registration.
- Use
TryHandlefor dynamically supplied routes. - Replace
Context.Copywith explicit value extraction.
v0.1.4
Changelog
0.1.4
Changes since v0.1.3.
Performance
- Reworked the router around compact per-method radix nodes and stable route-cache snapshots.
- Improved exact static-route hits, parameterized routing, large mixed route trees, method mismatch handling, and high-cardinality cache behavior.
- Reduced context reuse overhead while preserving zero request-time allocations across Zinc's primary static, parameter, and not-found dispatch benchmarks.
- Improved feature paths without broad router changes: invalid JSON binding, JSON happy paths, validation failures, large JSON binding, and static-file handling.
Benchmarks
- Expanded the comparison suite with realistic large route trees, cold paths, scenario builds, 404 and 405 paths, parallel dispatch, route registration, and cache-matrix coverage.
- Separated throughput/RPS benchmarks from the main suite so they remain an optional workload.
- In the latest Apple M1 Pro comparison snapshot, Zinc records the lowest raw latency in
64/77comparable rows and finishes first or second in all77/77rows against Gin, Echo, and Chi.
Quality
- Added regression coverage for route precedence, wildcard routing, method handling, cache cardinality, route memory, context reuse, and concurrent dispatch.
- Removed the accidentally tracked benchmark binary.
- Preserved the existing public API while establishing a tested performance baseline for the next Zinc release cycle.
v0.1.3
Changelog
0.1.3
Changes since v0.1.2.
Added
- Added a first-party in-memory jobs add-on under
github.com/0mjs/zinc/jobs. - Added named job handlers, worker-pool runners, delayed jobs with
EnqueueIn, retry handling with configurable backoff, failed-job inspection withFailed, and lifecycle hooks throughEventHandler. - Added recurring scheduling via five-field cron expressions,
@everyintervals, named aliases such as@hourly,@daily, and@weekly, plusSchedule,Cron, andUnschedule. - Added
examples/jobs-cronand theScheduled Jobscookbook for HTTP-triggered enqueueing and graceful shutdown patterns.
Changed
- Expanded the README and docs to cover the Jobs package, refreshed the getting-started guides, and added the Templ UI cookbook entry.
- Refreshed the docs site structure, cookbook index, and presentation around the new Jobs documentation.
Quality
- Expanded regression coverage across the Jobs package, core app lifecycle, response helpers, static serving, wrappers, and middleware behaviors such as CSRF, gzip, proxying, redirects, and hardening.
- Added Jobs package tests for enqueue/decode flow, retries, exponential backoff, pending counts, runner waiting, failed-job tracking, delayed jobs, cron scheduling, duplicate schedule rejection, unscheduling, and schedule parsing edge cases.
- Reported full-suite coverage improved from
83.4%in thev0.1.2README snapshot to86.3%on the latest local run ofgo test -count=1 ./... -coverprofile=coverage.out. - Latest local package coverage: core
86.1%, jobs86.2%, middleware87.2%.
v0.1.2
Changelog
Added
-
Added typed context store getters:
c.GetStringc.GetBoolc.GetIntc.GetInt64c.GetFloat64c.GetStringSlicec.GetStringMapc.GetStringMapStringc.GetStringMapStringSlice
-
Added query and form helpers:
c.QueryArrayc.QueryMapc.PostFormc.PostFormOrc.PostFormArrayc.PostFormMap
-
Added request inspection helpers:
c.ContentTypec.IsWebSocket
-
Added cookie SameSite support with
c.SetSameSite. -
Added response helpers:
c.Blobc.JSONBlobc.XMLBlobc.HTMLBlobc.Inlinec.SSEc.Acceptsc.Negotiate
-
Added
zinc.SSEventfor writing single server-sent events. -
Added public response writer tracking:
zinc.ResponseWriterzinc.WrapResponseWriter
-
Added decompression safety with
middleware.DecompressConfig.MaxDecompressedSize. -
Added gzip response-size tuning with
middleware.GzipConfig.MinLength. -
Expanded proxy middleware with:
- multiple targets
- round-robin balancing
- random balancing
- retry support
- retry filtering
- path rewrites
- regex rewrites
- custom transport support
- response modification support
-
Added utility middleware:
middleware.NoCachemiddleware.Heartbeatmiddleware.RealIPmiddleware.Throttlemiddleware.Maybemiddleware.AllowContentTypemiddleware.AllowContentEncodingmiddleware.SetHeadermiddleware.RouteHeaders
-
Added optional pprof middleware:
middleware.Pprofmiddleware.PprofWithPrefix
Changed
- Updated request logger middleware to use the public
zinc.WrapResponseWriter. - Updated Prometheus middleware to use the public
zinc.WrapResponseWriter. - Improved response writer tracking to preserve common optional interfaces while tracking status and bytes written.
- Improved docs across context, response rendering, middleware overview, gzip, decompress, proxy, utility middleware, header guards, and pprof.
Fixed
- Hardened decompression against oversized decompressed request bodies.
- Ensured gzip can skip small responses when
MinLengthis configured. - Reduced duplicated internal response writer code by moving shared behavior into the public wrapper.
Tests
- Added and expanded unit tests for the new context helpers, response helpers, middleware utilities, proxy behavior, gzip/decompress hardening, pprof, and response writer tracking.
- Verified with:
go test ./...npm run buildgit diff --check
v0.1.1
Added
- Added a broader first-party middleware set under
github.com/0mjs/zinc/middleware:RequestIDfor request ID generation and response header publishing.Recoverfor panic recovery through Zinc's normal error flow.GzipandDecompressfor response compression and gzip request-body handling.KeyAuthfor API key validation from headers, query values, cookies, and composed extractors.CasbinAuthfor Casbin-compatible authorization through a small adapter interface.MethodOverridefor POST method override support.PrometheusandPrometheusHandlerfor dependency-free request metrics.Jaegerforuber-trace-idpropagation with an observer hook.Proxyfornet/http/httputilreverse proxy middleware.RedirectandRewritehelpers for exact and wildcard path rules.Securefor common security response headers.SessionCookiefor signed cookie-backed string session values.Staticfor middleware-shaped static file serving.TrailingSlashfor add, remove, and redirect slash normalization.
- Added focused tests for new middleware behavior, integration paths, route rewriting helpers, and hardening coverage.
- Added docs pages and sidebar entries for the expanded middleware package.
Changed
- Updated README middleware examples to show a more complete real-world stack.
- Cleaned up the docs visual style to use flatter panels, simpler code blocks, tighter radii, and less decorative chrome.
- Switched the docs favicon and navbar logo to
z_logo.png. - Reworked the docs sidebar row geometry so expanding and collapsing categories does not shift labels or carets.
- Moved Docusaurus broken markdown link handling to
markdown.hooks.onBrokenMarkdownLinks.
Quality
- Verified with
go test ./.... - Verified with
npm run buildfor the docs site.
v0.1.0
Changelog
Added
- Added named routes and reverse URL generation with richer route metadata and lookup helpers.
- Added route introspection APIs, including route lookup by name, route discovery helpers, and mounted-route metadata.
- Added regex-constrained params with
:name<expr>route syntax. - Added route-scoped
404handlers for app and groups. - Added
Context.Copy()plus exported context lifecycle helpers for acquire/release flows. - Added a
Binding()builder API for explicit bind flows without removing the simpleBind(...)path. - Added multipart file binding support for
multipart.FileHeader,*multipart.FileHeader,[]multipart.FileHeader, and[]*multipart.FileHeader. - Added typed bind errors for clearer input/binding failures.
- Added plain-text body binding, YAML body binding, and TOML body binding.
- Added YAML and TOML response helpers.
- Added new benchmark families for invalid JSON, validation failure, multipart upload, header/query/body binding, large JSON payloads, static file hit/miss, nested middleware API paths, and unauthorized reject paths.
Changed
- Static serving is now fully implemented instead of partially configured: browse mode works, custom index files are honored, and unsafe traversal paths are rejected.
- Mounted routes now participate properly in route introspection and route metadata.
- Error ergonomics are richer:
HTTPErrornow carries more structured state, and abort/fail helpers are cleaner for API handlers. - Response file download behavior now correctly honors custom attachment/download filenames.
- The benchmark suite now targets Zinc only against its real framework peers:
Gin,Echo, andChi.ServeMuxandHttpRouterwere removed from the suite and reporting.
Performance
- Substantially improved router hot paths across static routes, dynamic params, grouped routes, scenario routing, and method-mismatch handling.
- Tightened miss/
405behavior and default error-response paths to reduce unnecessary work. - Improved param lookup/materialization behavior for routed handlers.
- Improved route registration performance, especially for static and param-heavy route sets.
- Improved binder hot paths, especially JSON-heavy API bind cases and cached-body reuse.
- Kept Zinc strongly ahead on most non-throughput API-path benchmarks in the peer-only suite.
Benchmarks
- Updated the benchmark reporting to the new peer-only suite and refreshed all tables/results.
- Current peer-only headline: Zinc wins
65/85overall and65/77non-throughput rows. - Throughput remains the weakest category and is now clearly separated in reporting from the stronger request-path and API-path wins.
Docs and Quality
- Added and updated feature-parity planning docs and scorecards.
- Added a benchmark-process guide to make future optimization work more disciplined and less regression-prone.
- Updated README coverage and benchmark snapshots to match the current codebase.
- Expanded supporting tests across static serving, route features, context helpers, response behavior, multipart binding, and error flows.
v0.0.87
v0.0.86
v0.0.85
0.0.85 - 2026-03-10
Added
- Support for dynamic routes with more than 8 path parameters.
- Support for custom HTTP methods on dynamic routes.
- Correct
405 Method Not AllowedandAllowheader handling for custom methods.
Changed
- Reworked path param storage to use an inline fast path with dynamic spillover.
- Kept the common routing hot path allocation-free for typical routes and built-in methods.
- Updated benchmark documentation to reflect the latest local benchmark run.
Fixed
- Removed the previous hard 8-param ceiling in the router/context path param pipeline.
- Fixed dynamic-route matching for nonstandard HTTP methods.
- Fixed cached dispatch behavior for large param captures and custom-method allow scanning.
Performance
- Preserved
0 allocs/opon the common static and param hot paths in benchmark checks. - Improved several static, mixed-route, and API-path benchmark rows versus the previous snapshot.
Tests
- Added coverage for routes with 9+ params.
- Added coverage for cached dispatch with overflow params.
- Added coverage for custom-method routing and
Allowheader behavior.