go-redis

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

Library
Go
vv9.23.0
22,275 stars
BSD-2-Clause

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
91 /100 Excellent
Development Activity 96
Maintenance 84
Community 84
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
87 /100 Excellent
Architecture 90
Code Quality 96
Innovation 80
Learning Curve 80

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

Ruby
66%
Other

GitLab

Developer Tools · Devops

24,537

The complete DevOps platform that unifies Git hosting, CI/CD, issue tracking, and security scanning into a single self-hostable application.

View details
87
Repo Health
86
Technical
65
Dependency
Built with
Ruby 66%
JavaScript 20%
Updated 1 weeks ago
TypeScript
47%
AGPL 3.0

Grafana

Analytics · Monitoring

77,469

The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.

View details
95
Repo Health
91
Technical
63
Dependency
Built with
TypeScript 47%
Go 47%
Updated 1 weeks ago
TypeScript
71%
Other

highlight.io

Analytics · Developer Tools · Monitoring

9,384

Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.

View details
76
Repo Health
78
Technical
65
Dependency
Built with
TypeScript 71%
Go 16%
Updated 1 weeks ago
TypeScript
96%
Other

Infisical

Devops · Security

29,961

The open-source platform for secrets, certificates, privileged access, and AI agent security — all in one self-hostable system.

View details
91
Repo Health
84
Technical
64
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
Go
84%
AGPL 3.0

Lago

Ecommerce · Invoicing Finance

10,709

Open-source metering, billing, and revenue infrastructure for product-led companies that need complete control over their pricing stack.

View details
90
Repo Health
81
Technical
75
Dependency
Built with
Go 84%
Updated 1 weeks ago
TypeScript
85%
MIT

LibreChat

AI Assistants · Developer Tools

46,236

Unite every major AI model in one self-hosted chat platform with agents, code execution, MCP tools, and enterprise authentication.

View details
93
Repo Health
81
Technical
62
Dependency
Built with
TypeScript 85%
JavaScript 14%
Updated 1 weeks ago
TypeScript
44%
Other

Magic

AI Agents · Automation · Low Code Platforms

5,055

Magic is an enterprise-grade open-source AI agent platform combining a generalist AI agent, workflow engine, IM, and collaborative office system for running an AI-powered digital workforce.

View details
68
Repo Health
79
Technical
65
Dependency
Built with
TypeScript 44%
PHP 32%
Updated 2 months ago
Go
56%
Other

Multica

AI Assistants · AI Development

53,682

Turn coding agents into real teammates — assign issues, track progress, and compound reusable skills across a vendor-neutral, self-hosted platform.

View details
87
Repo Health
83
Technical
67
Dependency
Built with
Go 56%
TypeScript 38%
Updated 1 weeks ago
Go
95%
Other

NetBird

Security

30,175

Replace your VPN with a zero-trust WireGuard overlay network that auto-connects devices, enforces SSO and posture checks, and deploys in under 5 minutes.

View details
92
Repo Health
82
Technical
66
Dependency
Built with
Go 95%
Updated 1 weeks 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