ioredis is a free, open source databases project written in TypeScript and released under MIT. It has 15,339 GitHub stars, 1,251 forks and 202 open issues, and was last pushed 4 days ago. On this registry it ranks #41 of 81 tracked projects in Databases, with 5 head-to-head comparisons available. It gained 2 stars over the last 3 tracked days.

What is ioredis?

ioredis is a robust, performance-focused and full-featured Redis client for Node.js, written entirely in TypeScript and released under the MIT licence, intended for Node.js developers and platform teams that need their applications to talk to Redis reliably.

What it is

ioredis lives in the Node.js ecosystem and targets the Redis server itself. It supports Redis >= 2.6.12 and is completely compatible with Redis 7.x. The library is 100% TypeScript and ships official type declarations, so consumers get typed APIs without a separate @types package. It is published under the MIT licence, carries version lines for 4.x, 5.x and 6.x, and is filed in this registry under Infrastructure & Operations / Databases.

The concrete problem it solves is that talking to Redis from an application is rarely just a socket and a command. A production Node.js service has to hold a connection open across topology changes, route commands to the right node, manage failover, batch work, run server-side scripts, subscribe to channels that may carry binary payloads, and secure the link. ioredis packages those concerns into a single client instead of leaving each team to assemble them by hand. Within the Node.js ecosystem it occupies the same slot as node-redis, the other Redis JavaScript client, and the README explicitly recommends node-redis for new projects β€” so ioredis is best understood as the established, general-purpose client rather than the default first choice.

Key capabilities

  • Protocol and topology coverage for Redis Cluster, Sentinel, Streams and Pipelining, alongside Lua scripting, Redis Functions and Pub/Sub with support for binary messages.
  • Both Node.js callbacks and native promises are supported, so the same client fits either style of application code.
  • Transformation of command arguments and replies, plus transparent key prefixing.
  • An abstraction for Lua scripting that allows custom commands to be defined on the client.
  • TLS support, Redis ACL support, NAT mapping, an offline queue and ready checking.
  • Support for ES6 types such as Map and Set, GEO commands, and binary data.
  • Autopipelining and a sophisticated error handling strategy.

Who uses it and how

  • The README states that ioredis is used at Alibaba and many other companies, which indicates deployment at very large online commerce scale.
  • Teams running a sharded Redis deployment use it through the redis-cluster topic, letting the client handle cluster routing.
  • Teams that need high availability rather than sharding use it with Sentinel, covered by the redis-sentinel topic.
  • Projects that extend the server with redis-module workloads use it as the access layer from Node.js.
  • Version choice tracks the runtime: 6.x.x on the main branch requires Node.js >= 20 with Redis 6.2 to latest, 5.x on the v5 branch requires Node.js >= 12, and 4.x on the v4 branch requires Node.js >= 8.

Getting started

The library is consumed as the ioredis package inside a Node.js project, with 6.x.x as the latest line. API documentation is published for the Redis and Cluster classes at redis.github.io/ioredis, and version history lives in CHANGELOG.md, which also covers upgrade paths from v5 to v6 and v4 to v5.

How it compares

The only comparable tool named in the facts is node-redis, which the README describes as the open-source (MIT licence) Redis JavaScript client library redesigned from the ground up and actively maintained. Both are MIT-licensed and neither imposes a paid tier or a hosted dependency, so the difference is scope rather than licence: node-redis supports new and future commands, including hash-field expiration, and the capabilities available in Redis Stack and Redis 8 such as search, JSON, time-series and probabilistic data structures. The maintainers therefore point new projects at node-redis while continuing to support ioredis for existing users.

When to use it β€” and when not to

A self-hoster still runs the Redis server, its Cluster or Sentinel topology if used, and the TLS certificates that the client's TLS options require β€” ioredis is a client library and operates none of that. Teams starting a new project should follow the README's own advice and evaluate node-redis first, particularly if they need Redis Stack or Redis 8 features such as search, JSON, time-series or probabilistic data structures. The honest limitation is maintenance posture: the README states that ioredis is stable but maintained on a best-effort basis for relevant issues, and the repository carries 202 open issues, with recent activity dated 2026-09-14.

project readme (upstream, from github) β€” read inline

ioredis

Build Status Coverage Status Commitizen friendly semantic-release

Discord Twitch YouTube Twitter

A robust, performance-focused and full-featured Redis client for Node.js.

Supports Redis >= 2.6.12. Completely compatible with Redis 7.x.

ioredis is a stable project and maintenance is done on a best-effort basis for relevant issues (contributions to ioredis will still be evaluated, reviewed, and merged when they benefit the project). For new projects, node-redis is the recommended client library. node-redis is the open-source (MIT license) Redis JavaScript client library redesigned from the ground up and actively maintained. node-redis supports new (hash-field expiration) and future commands and the capabilities available in Redis Stack and Redis 8 (search, JSON, time-series, probabilistic data structures).

Features

ioredis is a robust, full-featured Redis client that is used in the world's biggest online commerce company Alibaba and many other awesome companies.

  1. Full-featured. It supports Cluster, Sentinel, Streams, Pipelining, and of course Lua scripting, Redis Functions, Pub/Sub (with the support of binary messages).
  2. High performance πŸš€.
  3. Delightful API πŸ˜„. It works with Node callbacks and Native promises.
  4. Transformation of command arguments and replies.
  5. Transparent key prefixing.
  6. Abstraction for Lua scripting, allowing you to define custom commands.
  7. Supports binary data.
  8. Supports TLS πŸ”’.
  9. Supports offline queue and ready checking.
  10. Supports ES6 types, such as Map and Set.
  11. Supports GEO commands πŸ“.
  12. Supports Redis ACL.
  13. Sophisticated error handling strategy.
  14. Supports NAT mapping.
  15. Supports autopipelining.

100% written in TypeScript and official declarations are provided:

Versions

Version Branch Node.js Version Redis Version
6.x.x (latest) main >= 20 6.2 ~ latest
5.x.x v5 >= 12 2.6.12 ~ latest
4.x.x v4 >= 8 2.6.12 ~ 7

Refer to CHANGELOG.md for features and bug fixes introduced in v5.

πŸš€ Upgrading from v5 to v6

πŸš€ Upgrading from v4 to v5

Links


Quick Start

Install

npm install ioredis

In a TypeScript project, you may want to add TypeScript declarations for Node.js:

npm install --save-dev @types/node

Basic Usage

// Import ioredis.
// You can also use `import { Redis } from "ioredis"`
// if your project is a TypeScript project,
// Note that `import Redis from "ioredis"` is still supported,
// but will be deprecated in the next major version.
const Redis = require("ioredis");

// Create a Redis instance.
// By default, it will connect to localhost:6379.
// We are going to cover how to specify connection options soon.
const redis = new Redis();

redis.set("mykey", "value"); // Returns a promise which resolves to "OK" when the command succeeds.

// ioredis supports the node.js callback style
redis.get("mykey", (err, result) => {
  if (err) {
    console.error(err);
  } else {
    console.log(result); // Prints "value"
  }
});

// Or ioredis returns a promise if the last argument isn't a function
redis.get("mykey").then((result) => {
  console.log(result); // Prints "value"
});

redis.zadd("sortedSet", 1, "one", 2, "dos", 4, "quatro", 3, "three");
redis.zrange("sortedSet", 0, 2, "WITHSCORES").then((elements) => {
  // ["one", "1", "dos", "2", "three", "3"] as if the command was `redis> ZRANGE sortedSet 0 2 WITHSCORES`
  console.log(elements);
});

// All arguments are passed directly to the redis server,
// so technically ioredis supports all Redis commands.
// The format is: redis[SOME_REDIS_COMMAND_IN_LOWERCASE](ARGUMENTS_ARE_JOINED_INTO_COMMAND_STRING)
// so the following statement is equivalent to the CLI: `redis> SET mykey hello EX 10`
redis.set("mykey", "hello", "EX", 10);

See the examples/ folder for more examples. For example:

All Redis commands are supported. See the documentation for details.

Connect to Redis

When a new Redis instance is created, a connection to Redis will be created at the same time. You can specify which Redis to connect to by:

new Redis(); // Connect to 127.0.0.1:6379
new Redis(6380); // 127.0.0.1:6380
new Redis(6379, "192.168.1.1"); // 192.168.1.1:6379
new Redis("/tmp/redis.sock");
new Redis({
  port: 6379, // Redis port
  host: "127.0.0.1", // Redis host
  username: "default", // needs Redis >= 6
  password: "my-top-secret",
  db: 0, // Defaults to 0
});

You can also pass a connection string as the first constructor argument. Use a redis:// URL or rediss:// URL when using TLS encryption:

// Connect to 127.0.0.1:6380, db 4, using password "authpassword":
new Redis("redis://:[email protected]:6380/4");

// Username can also be passed via URI.
new Redis("redis://username:[email protected]:6380/4");

See API Documentation for all available options.

Pub/Sub

Redis provides several commands for developers to implement the Publish–subscribe pattern. There are two roles in this pattern: publisher and subscriber. Publishers are not programmed to send their messages to specific subscribers. Rather, published messages are characterized into channels, without knowledge of what (if any) subscribers there may be.

By leveraging Node.js's built-in events module, ioredis makes pub/sub very straightforward to use. Below is a simple example that consists of two files, one is publisher.js that publishes messages to a channel, the other is subscriber.js that listens for messages on specific channels.

// publisher.js

const Redis = require("ioredis");
const redis = new Redis();

setInterval(() => {
  const message = { foo: Math.random() };
  // Publish to my-channel-1 or my-channel-2 randomly.
  const channel = `my-channel-${1 + Math.round(Math.random())}`;

  // Message can be either a string or a buffer
  redis.publish(channel, JSON.stringify(message));
  console.log("Published %s to %s", message, channel);
}, 1000);
// subscriber.js

const Redis = require("ioredis");
const redis = new Redis();

redis.subscribe("my-channel-1", "my-channel-2", (err, coun

readme truncated β€” read the full docs on github

Frequently asked questions

Is ioredis free to use?

ioredis is open source under the MIT licence. There is no licence fee and no seat count β€” you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does ioredis do?

πŸš€ A robust, performance-focused, and full-featured Redis client for Node.js.

What is ioredis written in?

ioredis is primarily written in TypeScript. Its source is publicly available at https://github.com/redis/ioredis, and it has 15,339 GitHub stars.