Reusable building blocks for Go services: logging, middleware, database helpers, Prometheus instrumentation, HTTP client/server utilities, and more.
pkg/client: HTTP client helpers and OAuth2 clientpkg/db: GORM setup, connection management, and metricspkg/instrumented: Handler factory with structured logging and metricspkg/log: Structured logging, audit logs, HTTP request/response loggingpkg/logging: Global logger facade for conveniencepkg/middlewares: Auth, tenant, tracing, URL filter middlewarespkg/migrate: Migration runner for PostgreSQL (SQL files)pkg/prom: Prometheus metrics utilities for HTTP client/serverpkg/standard: Opinionated server/gateway wiringpkg/ticket: Lightweight JWT ticket verification/claimspkg/transport: Composable RoundTripper chain (retry, timeout, auth, trace)
Metrics default to the d4l namespace for backward compatibility. You can set a
custom namespace at runtime:
import (
dbMetrics "github.com/d4l-data4life/go-svc/pkg/db"
prom "github.com/d4l-data4life/go-svc/pkg/prom"
)
func init() {
prom.SetNamespace("myapp")
dbMetrics.SetPrometheusNamespace("myapp")
}Apache License 2.0. See LICENSE.