Skip to content

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
Step-by-step guide: how to use node-redisInstall, first run, examples, tips and FAQs

How to get it

  1. 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-rc1

    Install the node-redis package

    npm install redis
  2. 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. 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

ProjectStarsTypeLevelUpdatedBest for
node-redis (this)17.6kLibraryintermediate4 days agoNode.js developers who need to read and write Redis data from an application
ioredis15.4kLibrarybeginner4 days agoNode.js backend developers who already run Redis and want a full-featured client
redis-py13.7kLibrarybeginner4 days agoPython developers who need to read and write data in a Redis server
jedis12.4kLibraryintermediate4 days agoJava developers who need to read and write data in Redis from an application
AnotherRedisDesktopManager34.8kAppbeginner3 months agoDevelopers who prefer a visual interface over redis-cli for inspecting keys
codis13.2kDev tooladvanced2.6 years agoTeams 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.