Introducing Utilitybelt

Utilitybelt is a Go library that bundles the building blocks we use across Punsky services: caching, HTTP APIs with OpenAPI, DTOs, and shared DB models. One import, less boilerplate.

What’s in the belt

Utilitybelt is a single module, go.punksky.com/utilitybelt, with focused packages:

  • cache — Common cache interface with BoltDB and Valkey backends, plus multicache for tiered L1/L2 setups.
  • db — GORM base models (Model, ModelUint, ModelUuid) with IDs, timestamps, and soft delete.
  • dto — Shared response shapes: ResponseDto[T], PaginationDto[T], and ProblemDto for RFC 7807–style errors.
  • http — Router (httprouter) with JSON helpers and OpenAPI (Swagger) integration.
  • http/endpoint — Type-safe endpoints with method chaining and automatic OpenAPI registration.
  • timer — Resettable timer utility for debouncing and timeouts.

Why we built it

We kept copying the same patterns: cache interfaces, pagination DTOs, and “router + OpenAPI” wiring. Utilitybelt is that set of patterns in one place — open source so others can reuse it and we can improve it in one repo.

Get it

go get go.punksky.com/utilitybelt

Docs and source: gitlab.com/punksky/utilitybelt. Apache-2.0.

Previous Post Next Post