go-redis

The official, idiomatic Go client for Redis — connection pooling, Cluster, Sentinel, pipelines, and client-side caching built in.

Library
Go
vv9.22.0
22,234stars
BSD-2-Clause

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
92/100Excellent
Development Activity100
Maintenance84
Community84
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
87/100Excellent
Architecture90
Code Quality96
Innovation80
Learning Curve80

go-redis is the official Go client library for Redis, maintained by Redis, Inc. and the community. It provides typed, idiomatic wrappers for the full Redis command surface — strings, hashes, sets, sorted sets, streams, JSON, search, probabilistic data structures, and the new array type introduced in Redis 8.8 — alongside first-class support for Redis Cluster, Sentinel, and Ring-based sharding.

Beyond basic command coverage, go-redis ships production-grade operational features: automatic connection pooling with configurable dial retries, pipelines and transactions, an extensible Hook system for tracing and auth, optional OpenTelemetry instrumentation, client-side caching, and an experimental automatic-pipelining mode that batches concurrent commands for high-throughput workloads. It is one of the most widely used and heavily tested Redis clients in the Go ecosystem.

What You Get

  • Full Redis command coverage — strings, hashes, sets, sorted sets, streams, JSON, search, probabilistic types, and the new AR* array command family
  • Multiple deployment modes — Client, ClusterClient, Ring, and Sentinel-aware failover, unified behind a UniversalClient interface
  • Built-in connection pooling with configurable dial retries and pluggable backoff
  • Pipelines, transactions, and an experimental automatic-pipelining mode for high-throughput batching
  • Extensible Hook system plus optional OpenTelemetry instrumentation for tracing and auth

Common Use Cases

  • Caching layer for a web or API service backed by Redis
  • Rate limiting and distributed locks built on Redis primitives
  • Pub/Sub messaging and event fan-out between services
  • Session storage and token/credential caching with streaming auth providers
  • Powering Redis Cluster or Sentinel-based high-availability deployments

Under The Hood

Architecture The root package exposes several client types — Client, ClusterClient, Ring, and a Sentinel-aware failover client — all sharing the same command-building layer (command.go, commands.go) and a hooksMixin that lets Dial/Process/ProcessPipeline behavior be wrapped without touching call sites. Underneath, internal/pool owns connection lifecycle (pool.go, conn.go, want_conn.go) and internal/proto implements the RESP2/RESP3 wire protocol directly (reader.go, writer.go, scan.go) rather than depending on a third-party parser. A UniversalClient interface and universal.go let application code target standalone, Cluster, or Sentinel deployments through the same configuration surface. Large subsystems layer on top of this core: autopipeline.go (over 100KB) implements automatic command batching for high-throughput scenarios, csc_integration.go adds client-side caching, and maintnotifications/ handles Redis Cluster maintenance push notifications. The Cmder abstraction that every per-command wrapper builds on is the load-bearing seam — every one of the hundreds of typed command methods depends on it.

Tech Stack A Go 1.24 module with a deliberately minimal dependency footprint: github.com/cespare/xxhash/v2 and github.com/zeebo/xxh3 for cluster hashing, go.uber.org/atomic for lock-free state, golang.org/x/sys, and github.com/klauspost/cpuid/v2 for SIMD feature detection, with github.com/bsm/ginkgo/v2 and gomega used only in tests. The RESP wire protocol is implemented in-house rather than pulled from a dependency, and optional OpenTelemetry integration (otel.go) is wired in as an opt-in instrumentation layer. Docker Compose and a dockers/ directory spin up real Redis, Cluster, and Sentinel instances for integration testing, with CI split across build, end-to-end, and Redis Enterprise workflows.

Code Quality Testing here is extensive — well over a hundred _test.go files covering unit tests, race-detector tests, fuzz tests (fuzz/, reader_fuzz_test.go), and protocol-level desync/truth tests that validate edge cases in the wire format, on top of full integration suites that run against live Redis via docker-compose. The bsm/ginkgo BDD framework is used alongside standard testing.T tests. Error handling is idiomatic Go with explicit returns and a typed sentinel error (redis.Nil) plus dedicated error-wrapping coverage. CI enforces golangci-lint with staticcheck’s near-complete ruleset, gofmt formatting, govulncheck dependency scanning, and CodeQL static analysis — a rigor level uncommon even among popular Go libraries.

API Design The public API favors compile-time safety over stringly-typed replies: each command returns a typed *Cmd wrapper (StringCmd, IntCmd, and so on) with Result()/Err() accessors matching that command’s actual return shape, and getting started takes only a handful of lines. Advanced capabilities — pipelining, transactions, cross-cutting hooks, automatic pipelining, and client-side caching — activate through configuration rather than API changes, and UniversalClient lets code move between standalone, Cluster, and Sentinel deployments without a rewrite. Documentation is thorough, with godoc comments throughout, a substantial README, and a doctests/ directory of runnable examples. It is not a novel protocol design, but the operational feature set — streaming credentials, maintenance notifications, hitless upgrades — goes well beyond a typical thin RESP client.

Used by 34 apps in this directory

Go
55%
Apache 2.0

Authgear

Authentication

2,047

Open-source, self-hostable authentication platform with passkeys, biometric login, SSO, MFA, and GraphQL admin API — a full Auth0/Clerk/Firebase alternative for SaaS and mobile apps.

View details
89
Repo Health
81
Technical
68
Dependency
Built with
Go55%
HTML24%
TypeScript17%
Updated 3 days ago
Go
83%
AGPL 3.0

Beta9

Developer Tools · AI Development · Data Engineering

1,777

Run AI workloads at scale with a Pythonic serverless runtime that handles GPU inference, background jobs, and sandboxes with zero infrastructure overhead.

View details
85
Repo Health
78
Technical
66
Dependency
Built with
Go83%
Python16%
Updated 2 days ago
Go
50%
MIT

Bytebase

Devops

14,484

An open-source database CI/CD and DevSecOps platform — schema migration review, GitOps-driven changes, data masking, and access control across MySQL, PostgreSQL, Oracle, Snowflake, MongoDB, and more.

View details
92
Repo Health
73
Technical
68
Dependency
Built with
Go50%
TypeScript42%
Updated 2 days ago
Go
72%
Other

Convoy

Developer Tools · Devops

2,865

Convoy is an open-source, cloud-native webhooks gateway that ingests events over HTTP or straight from Kafka, SQS, Google Pub/Sub, and RabbitMQ, then reliably delivers them to subscriber endpoints with signed payloads, automatic retries, circuit breaking, and JavaScript-based transformations.

View details
88
Repo Health
81
Technical
65
Dependency
Built with
Go72%
TypeScript15%
HTML12%
Updated 1 weeks ago
Go
91%
AGPL 3.0

Cozy Stack

File Storage · Productivity

1,269

Self-hosted personal cloud platform that unifies your files, apps, and devices in one private space you fully control.

View details
95
Repo Health
77
Technical
67
Dependency
Built with
Go91%
Updated 3 days ago
Go
33%
Apache 2.0

CubeSandbox

Developer Tools · Security · AI Agents

12,344

Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.

View details
83
Repo Health
88
Technical
63
Dependency
Built with
Go33%
Rust26%
C23%
Updated 3 days ago
C++
74%
Other

Dragonfly

Databases · Developer Tools · Devops

31,519

A modern Redis and Memcached replacement engineered for multi-core servers — delivering 25x more throughput, better cache hit rates, and up to 80% lower memory consumption with full API compatibility.

View details
90
Repo Health
9
Technical
71
Dependency
Built with
C++74%
Python16%
Updated 3 days ago
Go
73%
Other

Flipt

Devops · Developer Tools

4,898

Git-native feature flag platform that stores, versions, and deploys feature toggles directly in your own Git repositories with no external database required.

View details
90
Repo Health
83
Technical
69
Dependency
Built with
Go73%
TypeScript26%
Updated 3 days ago
Go
83%
MIT

Gitea

Devops · Developer Tools · Project Management

57,984

Self-hosted DevOps in a single Go binary — Git hosting, GitHub Actions-compatible CI/CD, and 30+ package registries without any SaaS dependency.

View details
93
Repo Health
79
Technical
64
Dependency
Built with
Go83%
Updated 2 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search