About this project

Node-Redis is the official Redis client for Node.js, installed with `npm install redis`. The umbrella package bundles Redis Stack module support; modular packages are also published separately: `@redis/client` (base client and cluster), `@redis/bloom`, `@redis/json`, `@redis/search`, `@redis/time-series`, and `@redis/entraid` for Microsoft Entra ID token authentication. Clients are created with `createClient()` and support `redis://` and `rediss://` connection URLs, discrete parameters, UNIX sockets, and TLS. `isReady` and `isOpen` expose connection state. The client is an EventEmitter that emits `connect`, `ready`, `end`, `error`, `reconnecting`, `terminated`, `invalidate`, and sharded-channel events; an `error` listener is required to avoid process termination. The API covers all built-in Redis commands, exposed both as raw names (`HSET`) and camelCase aliases (`hSet`), with command modifiers passed as JavaScript objects and replies transformed into native structures (for example hashes become objects). Binary data is supported through `withTypeMapping` mapping RESP blob strings to `Buffer`. Unknown commands can be sent with `sendCommand()`. Other documented capabilities include: - Transactions via `multi()`/`exec()` and optimistic locking with `watch()`. - Pub/Sub, including sharded channels. - Async iterators for `SCAN`, `HSCAN`, `SSCAN`, and `ZSCAN` with `MATCH`, `COUNT`, and `TYPE` options. - Automatic pipelining of commands issued in the same event-loop tick. - `RedisClientPool` in v5 for pools of isolated connections, useful for blocking commands. - Server-assisted client-side caching over RESP3 with configurable TTL, entry limits, and LRU/FIFO eviction. - Dedicated guides for Redis Cluster and Sentinel deployments. - Compare-and-set/delete (CAS/CAD) operations introduced in Redis 8.4, plus a local XXH3 `digest` helper that requires the optional `@node-rs/xxhash` peer dependency. - OpenTelemetry metrics instrumentation through `OpenTelemetry.init()` (requiring `@opentelemetry/api` and a configured SDK), and telemetry published through Node.js `diagnostics_channel` for APM integration. - Programmability support for Lua scripts and functions. The README provides ESM and CommonJS examples, client configuration details, and migration guides from v3 to v4 and v4 to v5. Notable v5 API changes include `close()` replacing `quit()` and `destroy()` replacing `disconnect()`. The repository is MIT licensed.