ConfigsJul 16, 2026·3 min read

node-redis — Official Redis Client for Node.js

High-performance Redis client for Node.js with TypeScript support, auto-pipelining, Lua scripting, and cluster/sentinel support.

Agent ready

Safe staging for this asset

This asset is staged first. The copied prompt tells the agent to inspect the staged files and ask before activating scripts, MCP config, or global config.

Stage only · 29/100Policy: stage
Agent surface
Any MCP/CLI agent
Kind
CLI Tool
Install
Single
Trust
Trust: Established
Entrypoint
node-redis Overview
Safe staging command
npx -y tokrepo@latest install d7dc01bf-8135-11f1-9bc6-00163e2b0d79 --target codex

Stages files first; activation requires review of the staged README and plan.

Introduction

node-redis is the official Redis client for Node.js, maintained by Redis Ltd. Version 4+ provides a modern async/await API with full TypeScript type definitions, automatic command pipelining, and support for Redis modules like RediSearch, RedisJSON, and RedisTimeSeries. It connects to standalone Redis, Sentinel, and Cluster deployments.

What node-redis Does

  • Connects to Redis standalone, Sentinel, and Cluster topologies
  • Executes all Redis commands via a fully typed async API
  • Pipelines commands automatically to reduce round-trip latency
  • Supports Pub/Sub, streams, transactions, and Lua scripting
  • Integrates with Redis modules for JSON, search, time-series, and graph operations

Architecture Overview

node-redis uses a single TCP connection per client (or a pool in cluster mode) and communicates via the RESP protocol. Commands are queued and flushed in batches using automatic pipelining, which groups multiple commands into a single network write. The client handles reconnection with configurable backoff, and in cluster mode it discovers the slot map and routes commands to the correct shard automatically.

Setup & Configuration

  • Install via npm install redis (includes TypeScript types)
  • Connect with createClient({ url: 'redis://localhost:6379' })
  • Enable auto-pipelining (on by default in v4+) for batched command execution
  • For Sentinel, use createClient({ sentinel: { ... } }) with master name and sentinels list
  • For Cluster, use createCluster({ rootNodes: [...] }) to connect to Redis Cluster

Key Features

  • Automatic pipelining batches commands for higher throughput
  • Full TypeScript type definitions for all Redis commands
  • Built-in support for Redis Cluster and Sentinel topologies
  • Pub/Sub with dedicated subscriber connections
  • Extensible module support for RediSearch, RedisJSON, and RedisTimeSeries

Comparison with Similar Tools

  • ioredis — mature community client with similar features, node-redis is the official library maintained by Redis Ltd
  • redis-py — official Python client, node-redis serves the same role for Node.js
  • Jedis — synchronous Java client, node-redis is async-first for the Node.js event loop
  • Lettuce — reactive Java client, node-redis uses async/await native to JavaScript

FAQ

Q: What changed between node-redis v3 and v4? A: v4 switched to async/await, added TypeScript types, introduced auto-pipelining, and added module support. The callback API was removed.

Q: How does auto-pipelining work? A: Commands issued in the same event loop tick are batched into a single network write, reducing round trips without requiring explicit pipeline calls.

Q: Can I use node-redis with Valkey or DragonflyDB? A: Yes. node-redis communicates via the standard RESP protocol, which Valkey and DragonflyDB implement.

Q: How do I handle connection drops? A: node-redis reconnects automatically with exponential backoff. Listen to the error and reconnecting events for visibility.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets