lib

v0.11

The Go foundation of every InfraPI service.

lib gives your own platform services the same URL layout, authentication, contract enforcement, errors and observability as Kayra and tofu-api — so every API on the platform behaves the same way.

The problem

Why lib

  • Each internal service picks its own routing, error format, auth, metrics and config conventions.
  • Callers have to learn each API’s quirks; operators run each service differently.
  • The same plumbing is rewritten, and re-reviewed, in every new service.

One URL layout

/apis/{name}.{domain}/{version}/namespaces/{namespace}/{resource}, shared by server, client and auth.

Server, pre-wired

A gin engine with CORS, trusted proxies, Prometheus metrics, tracing and OpenAPI contracts enforced on every request.

Errors that help

RFC 9457 problems with a stable code, a cause, a remediation hint and an explicit retryable flag.

Batteries for infra

Vault (AppRole, KV v2, PKI), OTLP tracing, systemd socket activation, and the OpenTofu engine behind tofu-api.

Status

At a glance

Version
v0.11 — pre-1.0, APIs may change
Requires
Go 1.26.7 or later
Install
go get github.com/infrapi/lib
License
MIT
Source
github.com/infrapi/lib

Contribute to lib

Issues, ideas and pull requests are welcome on GitHub.