
node-redis
A Redis client library for Node.js, written in TypeScript, for talking to Redis from JavaScript code.
- Stars
- 17.6k
- Forks
- 2k
- Licence
- MIT
- Language
- TypeScript
- Last update
- 4 days ago
- Type
- Library
What it is
node-redis is a client library that lets Node.js programs connect to a Redis server and run its commands, such as storing and reading keys. Redis is a data store often used for caching and fast temporary data. The library exposes Redis commands in both their raw names and camel-cased JavaScript versions, and supports transactions, pub/sub, and connections to clusters.
- Store and fetch key-value data with set and get from a Node.js service
- Run several Redis commands atomically using multi and exec transactions
- Subscribe to channels with the Pub/Sub API
- Iterate over large key sets with the SCAN iterator
Great for
- Node.js developers who need to read and write Redis data from an application
- Teams building caching or session storage on top of Redis
- Projects that want optional Redis modules such as JSON, search, or time-series through add-on packages
- Developers who need to connect to Redis clusters, TLS, or UNIX sockets
Not ideal for
- People who want a graphical Redis admin tool; this is code, not an app with a UI
- Projects that need an object-mapping layer; the README points to redis-om-node for that
- Anyone without a running Redis server, since the library needs one to connect to
How to get it
- 1
Install with a package manager
You'll need: Node.js · npm · Redis server (the README uses Docker to run one)
Start a Redis server with Docker
docker run -p 6379:6379 -d redis:8.0-rc1Install the node-redis package
npm install redis - 2
Run it
- Start a Redis server locally, for example with the Docker command in the README.
- Install the redis package with npm install redis.
- Create a file with the Basic Example code, which calls createClient, connect, set, and get.
- Run the file with node; it should print 'value' if the connection works.
- 3
Get the most out of it
- Use a connection URL or discrete parameters to target a different host, port, or database, as described in the client configuration guide.
- Use withTypeMapping to receive replies as Buffers when working with binary data.
- Use the transaction API with multi and exec to group commands, or watch to abort on changed keys.
- Install individual packages such as @redis/json or @redis/search if you only need certain modules.
Downloads
Strengths
- Supports all standard Redis commands, with a fallback sendCommand method for anything not yet wrapped
- Offers both raw and camel-cased command names, plus typed reply transformation
- Installs as one package, with separate packages available if you need only part of it
Trade-offs
- Requires a running Redis server; the library alone does nothing without one
- The README notes some API differences in cluster mode and a pitfall with spreading arguments into commands like hDel, so careful reading is needed
- Version 5 and 6 changes, such as the pool API, mean older examples may not match the current version
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| node-redis (this) | 17.6k | Library | intermediate | 4 days ago | Node.js developers who need to read and write Redis data from an application |
| ioredis | 15.4k | Library | beginner | 4 days ago | Node.js backend developers who already run Redis and want a full-featured client |
| redis-py | 13.7k | Library | beginner | 4 days ago | Python developers who need to read and write data in a Redis server |
| jedis | 12.4k | Library | intermediate | 4 days ago | Java developers who need to read and write data in Redis from an application |
| AnotherRedisDesktopManager | 34.8k | App | beginner | 3 months ago | Developers who prefer a visual interface over redis-cli for inspecting keys |
| codis | 13.2k | Dev tool | advanced | 2.6 years ago | Teams running Redis that have outgrown a single server |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.