Cache expensive database query results in Redis from a Node.js API to speed up repeated requests.
Store and retrieve user session data in Redis for a Node.js web application.
Implement a pub/sub event broadcast or background job queue between Node.js services using Redis.
Requires a running Redis instance, local via Docker or a cloud Redis URL.
node-redis is the official Node.js client library for Redis. Redis is a fast, in-memory data store that applications use as a cache, a message queue, a session store, or a key-value database. A client library is what your app uses to talk to it, node-redis lets server-side JavaScript or TypeScript send commands to a Redis instance and get results back. The basic flow is small. You import createClient, connect it (by default to localhost on the standard Redis port, or to any URL you give it including with TLS, a username and password, or a UNIX socket), then call methods that mirror Redis's commands, set, get, hSet, hGetAll. Each Redis command is exposed in two forms: the raw uppercase name and a friendlier camelCase version. Replies come back as JavaScript values (hash reads become objects, list reads become arrays), and Buffers are supported for binary data. Transactions are done by chaining commands after multi() and calling exec(). Pub/Sub messaging, scan-iteration helpers, and connection pooling for blocking commands are also built in. If you need a command the library does not yet wrap, sendCommand lets you call it raw. You would use node-redis any time a Node.js application needs to talk to Redis, caching expensive results, storing sessions, queueing background jobs, or broadcasting events between services. The package ships as a "whole in one" install that bundles the base client plus extensions for the Redis Stack add-ons: Bloom filters, JSON documents, RediSearch full-text search, Time-Series, and Entra ID authentication. You can also install only the pieces you need. The library is written in TypeScript. The full README is longer than what was provided.
← redis on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.