node-redis connects Node.js applications to Redis with typed commands, clustering, pub/sub, transactions, and optional client-side caching.
Overview
node-redis is the Node.js client for talking to Redis servers from application code. It exposes standard Redis commands under both raw names and camelCase helpers, and returns replies as convenient JavaScript data structures.
Connections support URL strings, discrete host settings, UNIX sockets, and TLS. The client emits lifecycle events for connect, ready, errors, and reconnection. Built-in helpers cover transactions with MULTI and EXEC, pub and sub, SCAN iterators, sentinel setups, and Redis Cluster.
Version 5 adds a dedicated connection pool for blocking commands, compare-and-set style operations where the server supports them, and a local digest helper aligned with server-side DIGEST. Client-side caching can store replies locally when using RESP3. Auto-pipelining batches requests in the same event loop tick when you await multiple promises together.
Optional OpenTelemetry metrics and diagnostics channel hooks help observe command and connection behavior. The monolithic redis package bundles stack modules for Bloom, JSON, search, and time series, or you can install narrower packages when you need fewer commands.
Key features
- Full Redis command coverage
- Cluster, sentinel, and TLS connections
- Pub/sub and scan async iterators
- MULTI and EXEC transactions
- Client-side caching with RESP3
- RedisClientPool for blocking commands
- OpenTelemetry metrics hook
- Modular @redis package family
Use cases
- Caching in Node.js services
- Pub/sub messaging between workers
- Talking to Redis Cluster deployments
- Session and rate-limit storage