go-redis

The official Redis client library for Go, with pooling, pipelines, Pub/Sub, and Cluster support

Library
Go
vv8.11.5
22,255 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 →
83 /100 Excellent
Architecture 88
Code Quality 90
Innovation 72
Learning Curve 80

go-redis is the official Redis client for the Go programming language, maintained by Redis and offering a complete, idiomatic interface for talking to a Redis server or cluster. It wraps every core Redis command family (strings, hashes, sets, sorted sets, streams, geo, HyperLogLog, scripting) behind a single typed Client, handling connection pooling, retries, and RESP protocol encoding so application code never touches raw sockets.

Beyond basic commands, the library ships production features that most Go Redis wrappers leave out: automatic and manual pipelining, MULTI/EXEC transactions, Pub/Sub, Redis Sentinel and Redis Cluster clients with the same API surface as a standalone client, and client-side caching. This version tracks the v8 module line (github.com/go-redis/redis/v8), the long-lived release series that predates the project’s move to the redis/go-redis module path and v9 major version.

What You Get

  • A typed Client/ClusterClient/SentinelClient covering the full Redis command set (strings, hashes, lists, sets, sorted sets, streams, geo, HyperLogLog, scripting) behind one consistent API
  • Automatic connection pooling with configurable pool size, idle timeouts, and health checks baked into every client
  • Pipelining and MULTI/EXEC transaction support for batching multiple commands into a single round trip
  • Native Pub/Sub client for publish/subscribe messaging patterns
  • Redis Sentinel support for automatic master discovery and failover in high-availability deployments
  • Redis Cluster client that transparently handles slot routing, redirects (MOVED/ASK), and resharding
  • Lua scripting helpers (Eval/EvalSha) with script caching for atomic server-side logic

Common Use Cases

  • Application caching layer - services store and invalidate cached query results or computed values in Redis to cut database load
  • Session storage - web backends keep user session state in Redis so any server instance can serve a logged-in request
  • Rate limiting and counters - APIs use Redis INCR/expire semantics via go-redis to enforce per-user or per-IP request limits
  • Pub/Sub messaging between services - lightweight event fan-out between Go microservices without a dedicated message broker
  • Distributed locks and coordination - services use Redis-backed locks (often paired with companion libraries like redislock) to coordinate exclusive access across replicas

Under The Hood

Architecture The client is built around a shared baseClient embedded by Client, ClusterClient, Ring, and SentinelClient in redis.go and cluster.go, so every deployment topology reuses the same command execution, hook, and pipeline machinery while only the connection-resolution strategy differs (a single pool for Client, slot-aware routing across per-node pools for ClusterClient). A Hook interface (DialHook/ProcessHook/ProcessPipelineHook) lets callers wrap command execution for tracing or retries without touching internals, and connections themselves are managed by a dedicated pool package (internal/pool) that separates dialing, health-checking, and checkout/return logic from the command layer above it. Commands are generated onto the client via large per-datatype files (string_commands.go, hash_commands.go, sortedset_commands.go, etc.), keeping the RESP encoding/decoding (internal/proto) isolated from command definitions.

Tech Stack Written in idiomatic Go with zero required third-party runtime dependencies beyond small internal-use libraries (cespare/xxhash for cluster hashing, golang.org/x/sys for platform syscalls); optional integrations exist for OpenTelemetry tracing (extra/redisotel) and structured logging. The module targets modern Go versions and uses Go modules exclusively, with Docker Compose used to spin up real Redis/Sentinel/Cluster topologies for integration testing rather than mocking the protocol.

Code Quality The repository carries an unusually large test suite for a Go library — dozens of _test.go files covering unit tests, race-detector runs, and full integration suites (cluster routing, Sentinel failover, pipelining edge cases) exercised against dockerized Redis. CI runs golangci-lint, CodeQL static analysis, and govulncheck on every change, and errors are returned as typed Go errors rather than swallowed, consistent with idiomatic Go error handling throughout the command layer.

What Makes It Unique What distinguishes go-redis from lighter Redis wrappers is that Cluster, Sentinel, and standalone clients all share one command API — application code written against *redis.Client mostly works unchanged against *redis.ClusterClient — while pipelining, transactions, and Pub/Sub are first-class rather than bolted on. As the official client maintained directly by Redis, it also tracks new server-side command additions closely and is the reference implementation most Go tooling and tutorials assume.

Used by 10 apps in this directory

Go
72%
Other

Convoy

Developer Tools · Devops

2,876

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
89
Repo Health
81
Technical
65
Dependency
Built with
Go 72%
TypeScript 15%
HTML 12%
Updated 5 days ago
Go
74%
Other

Flipt

Developer Tools · Devops

4,911

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
Go 74%
TypeScript 25%
Updated 4 days ago
TypeScript
48%
AGPL 3.0

Grafana

Analytics · Monitoring

76,962

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 48%
Go 46%
Updated 4 days ago
Go
62%
Apache 2.0

Harness Open Source

Code Editors · Developer Tools · Devops

38,450

A unified open source DevOps platform combining Git hosting, CI/CD pipelines, cloud development environments, and artifact registries in a single self-hosted system.

View details
89
Repo Health
79
Technical
64
Dependency
Built with
Go 62%
TypeScript 33%
Updated 1 weeks ago
Go
88%
AGPL 3.0

Lago

Ecommerce · Invoicing Finance

10,627

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

View details
88
Repo Health
81
Technical
76
Dependency
Built with
Go 88%
Shell 10%
Updated 1 weeks ago
Go
78%
Apache 2.0

OpenMeter

Developer Tools · Invoicing Finance

2,350

Open-source metering and billing engine for AI, agentic, and DevTool monetization — ingest usage events in real time and turn them into accurate invoices automatically.

View details
86
Repo Health
81
Technical
66
Dependency
Built with
Go 78%
TypeScript 17%
Updated 1 weeks ago
TypeScript
50%
Other

SigNoz

Analytics · Monitoring

32,224

Self-host your entire observability stack — logs, metrics, traces, and LLM monitoring — in one OpenTelemetry-native platform, without the Datadog bill.

View details
92
Repo Health
83
Technical
67
Dependency
Built with
TypeScript 50%
Go 38%
Updated 4 days ago
Go
98%
Apache 2.0

Space Cloud

Authentication · Devops

4,002

Kubernetes-native serverless platform that generates instant GraphQL and REST APIs for any database with built-in auth and real-time subscriptions

View details
50
Repo Health
74
Technical
63
Dependency
Built with
Go 98%
Updated 2 years ago
Go
54%
AGPL 3.0

Uptrace

Devops · Monitoring

4,293

Unified open-source APM that collects OpenTelemetry traces, metrics, and logs into a single self-hosted platform backed by ClickHouse.

View details
58
Repo Health
70
Technical
65
Dependency
Built with
Go 54%
Vue 34%
Updated 1 months 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