Skip to content

Releases: 0mjs/zinc

v0.2.1

Choose a tag to compare

@0mjs 0mjs released this 04 Aug 14:36

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

Choose a tag to compare

@0mjs 0mjs released this 31 Jul 21:45
34f954f

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.
  • CaseSensitive and StrictRouting remain configurable and default to false.
  • Automatic HEAD, automatic OPTIONS, and 405 responses remain enabled.
  • app.Listen remains available with Zinc's server timeout defaults.
  • The jobs package 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

  1. Replace :id with {id}.
  2. Replace *path with {path...}.
  3. Move regex route constraints into validation.
  4. Replace literal string routes with typed handlers.
  5. Remove error checks around source route registration.
  6. Use TryHandle for dynamically supplied routes.
  7. Replace Context.Copy with explicit value extraction.

v0.1.4

Choose a tag to compare

@0mjs 0mjs released this 31 Jul 10:47
16fc070

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/77 comparable rows and finishes first or second in all 77/77 rows 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

Choose a tag to compare

@0mjs 0mjs released this 22 Apr 15:03

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 with Failed, and lifecycle hooks through EventHandler.
  • Added recurring scheduling via five-field cron expressions, @every intervals, named aliases such as @hourly, @daily, and @weekly, plus Schedule, Cron, and Unschedule.
  • Added examples/jobs-cron and the Scheduled Jobs cookbook 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 the v0.1.2 README snapshot to 86.3% on the latest local run of go test -count=1 ./... -coverprofile=coverage.out.
  • Latest local package coverage: core 86.1%, jobs 86.2%, middleware 87.2%.

v0.1.2

Choose a tag to compare

@0mjs 0mjs released this 13 Apr 21:03

Changelog

Added

  • Added typed context store getters:

    • c.GetString
    • c.GetBool
    • c.GetInt
    • c.GetInt64
    • c.GetFloat64
    • c.GetStringSlice
    • c.GetStringMap
    • c.GetStringMapString
    • c.GetStringMapStringSlice
  • Added query and form helpers:

    • c.QueryArray
    • c.QueryMap
    • c.PostForm
    • c.PostFormOr
    • c.PostFormArray
    • c.PostFormMap
  • Added request inspection helpers:

    • c.ContentType
    • c.IsWebSocket
  • Added cookie SameSite support with c.SetSameSite.

  • Added response helpers:

    • c.Blob
    • c.JSONBlob
    • c.XMLBlob
    • c.HTMLBlob
    • c.Inline
    • c.SSE
    • c.Accepts
    • c.Negotiate
  • Added zinc.SSEvent for writing single server-sent events.

  • Added public response writer tracking:

    • zinc.ResponseWriter
    • zinc.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.NoCache
    • middleware.Heartbeat
    • middleware.RealIP
    • middleware.Throttle
    • middleware.Maybe
    • middleware.AllowContentType
    • middleware.AllowContentEncoding
    • middleware.SetHeader
    • middleware.RouteHeaders
  • Added optional pprof middleware:

    • middleware.Pprof
    • middleware.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 MinLength is 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 build
    • git diff --check

v0.1.1

Choose a tag to compare

@0mjs 0mjs released this 11 Apr 00:37

Added

  • Added a broader first-party middleware set under github.com/0mjs/zinc/middleware:
    • RequestID for request ID generation and response header publishing.
    • Recover for panic recovery through Zinc's normal error flow.
    • Gzip and Decompress for response compression and gzip request-body handling.
    • KeyAuth for API key validation from headers, query values, cookies, and composed extractors.
    • CasbinAuth for Casbin-compatible authorization through a small adapter interface.
    • MethodOverride for POST method override support.
    • Prometheus and PrometheusHandler for dependency-free request metrics.
    • Jaeger for uber-trace-id propagation with an observer hook.
    • Proxy for net/http/httputil reverse proxy middleware.
    • Redirect and Rewrite helpers for exact and wildcard path rules.
    • Secure for common security response headers.
    • SessionCookie for signed cookie-backed string session values.
    • Static for middleware-shaped static file serving.
    • TrailingSlash for 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 build for the docs site.

v0.1.0

Choose a tag to compare

@0mjs 0mjs released this 18 Mar 22:40

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 404 handlers 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 simple Bind(...) 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: HTTPError now 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, and Chi. ServeMux and HttpRouter were 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/405 behavior 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/85 overall and 65/77 non-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

Choose a tag to compare

@0mjs 0mjs released this 15 Mar 02:11
v0.0.87

v0.0.86

Choose a tag to compare

@0mjs 0mjs released this 15 Mar 02:10
v0.0.86

v0.0.85

Choose a tag to compare

@0mjs 0mjs released this 10 Mar 16:59

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 Allowed and Allow header 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/op on 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 Allow header behavior.