Database & Cache
redis

Redis

COpen SourceSelf-hostedManaged

The most widely used in-memory data store. Redis powers caching, session storage, pub/sub messaging, rate limiting, leaderboards, and job queues. Blazing fast (sub-millisecond) and incredibly versatile.

License

RSALv2 / SSPL

Language

C

93
Trust
Excellent

Why Redis?

You need a high-performance cache to reduce database load

You need session storage, rate limiting, or pub/sub messaging

You're building a job queue or real-time leaderboard

Signal Breakdown

What drives the Trust Score

npm downloads
14.2M / wk
Commits (90d)
184 commits
GitHub stars
67k ★
Stack Overflow
57k q's
Community
Very High
Weighted Trust Score93 / 100

Download Trend

Last 12 months

Tradeoffs & Caveats

Know before you commit

You need durable primary storage — Redis is best as a cache or secondary store

Memory cost is a concern at very large data sizes

Pricing

Free tier & paid plans

Free tier

Open-source self-host free · Redis Cloud: 30MB free

Paid

$7/mo Essentials (250MB)

Upstash: $0.2/100K commands (serverless)

Often Used Together

Complementary tools that pair well with Redis

bullmq

BullMQ

Background Jobs

83Strong
View
upstash

Upstash

Database & Cache

64Fair
View
supabase

Supabase

Database & Cache

95Excellent
View
nextjs

Next.js

Frontend & UI

98Excellent
View
express

Express.js

Backend Frameworks

87Strong
View

Learning Resources

Docs, videos, tutorials, and courses

Get Started

Repository and installation options

View on GitHub

github.com/redis/redis

brewbrew install redis
dockerdocker run -p 6379:6379 redis

Quick Start

Copy and adapt to get going fast

import { createClient } from 'redis';

const client = createClient({ url: process.env.REDIS_URL });
await client.connect();

// Cache a database result for 1 hour
await client.set('user:123', JSON.stringify(userData), { EX: 3600 });
const cached = await client.get('user:123');

// Rate limiting
const requests = await client.incr(`rate:${userId}`);
await client.expire(`rate:${userId}`, 60);
if (requests > 100) throw new Error('Rate limit exceeded');

Code Examples

Common usage patterns

Session store

Store Express sessions in Redis

import session from 'express-session';
import RedisStore from 'connect-redis';
import { createClient } from 'redis';

const redisClient = createClient({ url: process.env.REDIS_URL });
await redisClient.connect();

app.use(session({
  store: new RedisStore({ client: redisClient }),
  secret: process.env.SESSION_SECRET!,
  resave: false,
  saveUninitialized: false,
  cookie: { secure: true, maxAge: 86400000 },
}));

Pub/Sub messaging

Broadcast messages between services with Redis pub/sub

import { createClient } from 'redis';

const publisher = createClient({ url: process.env.REDIS_URL });
const subscriber = publisher.duplicate();

await Promise.all([publisher.connect(), subscriber.connect()]);

// Subscribe
await subscriber.subscribe('notifications', (message) => {
  console.log('Received:', JSON.parse(message));
});

// Publish from another service
await publisher.publish('notifications', JSON.stringify({ type: 'user.signup', userId: 42 }));

Sorted set leaderboard

Implement a real-time leaderboard with sorted sets

// Add score
await client.zAdd('leaderboard', [{ score: 1500, value: 'user:42' }]);

// Increment score
await client.zIncrBy('leaderboard', 100, 'user:42');

// Top 10 players
const top10 = await client.zRangeWithScores('leaderboard', 0, 9, { REV: true });

// Player rank
const rank = await client.zRevRank('leaderboard', 'user:42');

Community Notes

Real experiences from developers who've used this tool