Skip to content
@ubgo

Ubgo

Batteries included for Go, one module at a time.

ubgo logo: a bold lowercase u holding one amber block

ubgo

Batteries included for Go, one module at a time.

Early alpha: ubgo is still being built and is not fully production-ready yet, so libraries and APIs may change.

Open-source Go libraries, plus a few TypeScript ones, for authentication, errors, logging, caching, config, SQL, GraphQL, HTTP services, crypto and tooling.

Website: ubgo.github.io 46 public libraries Languages: Go and TypeScript License: Apache-2.0

ubgo is an ecosystem for building Go apps, in the spirit of the components Laravel ships for authentication, caching, logging and configuration. Every piece is its own Go module, so a service imports only what it uses: sign-in, sessions, two-factor, passkeys, OAuth and organizations, structured errors and logging, caching with Redis, Postgres, Memcached and in-memory backends, typed configuration and .env files, SQL building, GraphQL and ent helpers, health checks, graceful shutdown and crypto. The main libraries share one shape, a small core with adapters outside it and a shared test suite, so learning one teaches you the next.

Libraries by area

Auth and identity

  • auth: Embeddable authentication with plugins for email, password, phone, OAuth, passkeys, 2FA, API keys, JWT and organizations, stored in your own Postgres, MySQL or SQLite.

Errors and logging

  • errx: One structured error type with stable identity, class, redactable fields, return traces and a wire codec.
  • goerr: Error type with separate operator and user messages, error codes, key/value data and trace IDs.
  • logger: Adapter-based, slog-native structured logging with sampling, redaction, OpenTelemetry and rotation.
  • otelkit: One constructor that sets up OpenTelemetry traces, metrics and logs, with presets for common backends.

Caching

  • cache: The core cache interface with generics, single-flight Remember, a distributed locker and a shared conformance suite.
  • cache-cli: Command-line cache inspector (get, set, del, stats, keys) with JSON output, built on cache. (CLI)
  • cache-cluster: Peer-aware distributed cache with a consistent-hash ring and HTTP peer fill, on any cache backend.
  • cache-examples: Runnable examples for the cache family, one self-contained program per feature. (examples)
  • cache-mem: Sharded in-memory backend for cache with W-TinyLFU or LRU eviction and optional snapshots.
  • cache-memcached: Memcached backend for cache, covering the parts of the interface Memcached supports.
  • cache-obj: In-process cache that holds live Go objects by reference, with TTL and LRU and no serialization.
  • cache-pg: Postgres and SQLite backend for cache over database/sql, with Migrate and Vacuum.
  • cache-redis: Redis 6+ backend for cache with prefix isolation and Pub/Sub invalidation across processes.
  • cache-tiered: Stacks cache backends into L1/L2/L3 tiers with read promotion and per-tier TTL.
  • threadsafecache: Generic thread-safe LRU and TTL cache. Deprecated; use cache-obj instead.

Config and env

  • cfgkit: Typed config from env, .env, JSON, YAML, TOML, flags and secret stores into one validated struct.
  • dotenv: .env parser and editor that keeps comments, order and quoting, plus the dotenvctl CLI.

SQL and data

  • gormuuid: Postgres uuid[] field type for GORM.
  • gouuid: Small helpers around google/uuid.
  • jsonslice: A JSON-backed slice that round-trips through SQL columns and gqlgen scalars.
  • jsontype: A JSON type that round-trips between Go, JSON and SQL drivers (Postgres jsonb, MySQL json, SQLite).
  • lock: One lock interface with five backends (filelock, flock, Redis, Postgres, etcd) and fencing tokens.
  • publicid: URL-safe, non-sequential public IDs from a fixed lowercase nanoid alphabet.
  • sqlb: Typed SQL builder with compile-checked columns and joins, Postgres and ClickHouse packages and a driver conformance suite.

GraphQL and ent

  • entkit: Column types and field helpers for ent and gqlgen, as small independent modules.
  • entx: Extensions for ent such as polymorphic relations, cascade delete and per-API GraphQL schemas.
  • gqlgenfn: Helper functions for using gqlgen with Gin.
  • gqlkit: Generates typed GraphQL client SDKs for Go and TypeScript with compile-checked field selection.
  • gqlmodel: Custom scalar field types for gqlgen.
  • gqlutil: Small helper functions for gqlgen.

HTTP and services

  • buildinfo: Version, commit, build time and module info for Go binaries, from runtime/debug with -ldflags overrides.
  • buildinfo-examples: Runnable example apps for buildinfo, from ldflags stamping to HTTP, OpenTelemetry, Zap and slog. (examples)
  • gofm: An early framework for building Go microservices.
  • health: Thread-safe health and readiness registry with k8s-style probes, framework adapters and ready-made checkers.
  • health-examples: Runnable example apps for health, covering every HTTP framework adapter and observability. (examples)
  • httpreq: JSON-over-HTTP calls on top of net/http with one function, options and typed errors.
  • shutdown: Phased graceful shutdown for services, parallel within a phase, with a watchdog and telemetry hooks.
  • shutdown-examples: Runnable examples for shutdown. (examples)

Crypto

  • crypt: Go crypto with safe defaults (AES-GCM, ChaCha20-Poly1305, argon2id, HMAC, Ed25519, key rotation), byte-compatible with crypt-ts.
  • crypt-ts: TypeScript and Node.js crypto with safe defaults over node:crypto, byte-compatible with the Go crypt.

Tooling

  • docsync: Finds the sentences in your docs that stopped being true when the code they describe changed.
  • gots: Generates TypeScript types, enums, constants and interfaces from Go source. (CLI)
  • goutil: A small set of everyday Go helper functions.
  • lath: A task runner where tasks are typed Go functions and a deploy runs the same on a laptop, over ssh and in CI. (CLI)
  • ubgo-skills: Reusable skill files that capture Go and frontend coding conventions.

Volt

Volt is the layer on top of ubgo to build, release and ship Go CLIs and libraries: the volt tool (scaffold, CI gate, coverage, cross-platform builds, verified releases) plus importable kit modules for building the CLIs themselves.

brew install khanakia/tap/volt
  • voltkit: The Volt tool to scaffold, check, build, release and ship Go CLIs and libraries in any repo layout, plus importable kit modules for building the CLIs themselves.
  • volt-cli: Templates for volt new cli, a stdlib-only minimal CLI and a cobra variant, fetched at a pinned tag.
  • volt-action: GitHub Action that installs the released Volt binary, checksum-verified, and runs one command such as volt ci or volt release.
  • volt-api: The batteries-included Go backend starter, with schema-first GraphQL (gqlgen), Ent ORM, NATS JetStream events, typed config via cfgkit, OpenTelemetry, a Cobra CLI and cron workers in a go.work monorepo.
  • volt-web: The batteries-included TanStack Start starter for server-rendered React apps, with a token-driven design system, dashboard shell, tRPC and oRPC, typed GraphQL via gqlkit, Drizzle and PostgreSQL.
  • volt-demo-cli: Demo of a single-CLI repo released with Volt, with install scripts, workflows and a skills command generated by volt gen.
  • volt-demo-clis: Demo of a monorepo with two CLIs, nested libraries and an internal module, each released on its own tag stream.
  • volt-demo-lib: Demo of a single-library repo, released with notes and a verified module proxy entry instead of binaries.

Upcoming

These exist but are not public yet, so they have no links. More libraries are on the way.

  • workflow: Embeddable Go library for cron schedules, delayed and background jobs with retries, and multi-step workflows behind one Client interface, with swappable drivers (in-memory, SQL and Hatchet).
  • brick: A component-based HTML render engine for Go built on html/template, with layouts, components, islands and server actions, and a 133-component UI kit.
  • validator: Struct-native Go validator with a serializable IR; one set of rules validates in Go, exports to JSON Schema, and runs as a Standard-Schema TypeScript validator.

Principles

These hold for the libraries named under each point, as their own READMEs state. They are not a promise for every repo.

Install

Most libraries install with:

go get github.com/ubgo/<name>

Some are split into sub-modules or ship a CLI to go install. Each repo's README, and its page on ubgo.github.io, gives the exact line.

FAQ

Do I need to install everything? No. Every library is its own Go module (and some split further into sub-modules), so you add only the ones you use.

Where are the docs? Each repository's README, plus its page on pkg.go.dev (or npm for the TypeScript ones). The library index links to both.

What license are they under? Every library is open source under Apache-2.0. The LICENSE file in each repository is the source of truth.

Where do I report a bug? Open an issue in that library's repository.

Pinned Loading

  1. logger logger Public

    Pluggable, adapter-based, slog-native zero-allocation structured logging for Go — sampling, redaction, OpenTelemetry, FingersCrossed debug-on-error, rotation, audit. A zap/zerolog/logrus/slog alter…

    Go 1

  2. errx errx Public

    One coherent structured error for Go: stable identity, class, redactable fields, return-trace, miette-style diagnostics, wire codec — zero-dep core, isolated contrib adapters.

    Go

  3. voltkit voltkit Public

    Build production-grade Go CLIs — importable kit modules + the volt tool: build, release, ship any repo layout with one command

    Go

  4. cfgkit cfgkit Public

    Typed Go configuration from layered sources — env vars, .env, JSON, YAML, TOML, flags, Vault, Consul, etcd, Kubernetes, AWS, GCP and Azure — into one validated struct. Defaults compile into the bin…

    Go

  5. sqlb sqlb Public

    Typed SQL builder for Go: compile-checked columns, joins and scan targets, zero dependencies, Postgres and ClickHouse packages, pgvector and ltree extension sub-packages, and a shared conformance s…

    Go

  6. cache cache Public

    World-class cache library for Go: bytes-level interface, generics, single-flight Remember (refresh-ahead/SWR/stale-if-error/negative/jitter), distributed Locker, pluggable codecs incl. AES-GCM, cro…

    Go

Repositories

Showing 10 of 57 repositories

Top languages

Loading…

Most used topics

Loading…