Redis & Valkey
Stackpad provides managed Redis and Valkey instances as project services. Use them for caching, session storage, rate limiting, queues, and real-time features.
Creating a cache service
- Open your project in the dashboard
- Click Add Service → Cache
- Select Redis or Valkey
- Click Create
Both options include:
- Persistent storage — data survives container restarts
- Private network access at
redis:6379orvalkey:6379 - Automatic backups based on your plan
Redis vs. Valkey
Valkey is an open-source fork of Redis, maintained by the Linux Foundation. It’s fully compatible with Redis clients and commands.
| Redis | Valkey | |
|---|---|---|
| License | Source-available (SSPL) | BSD-3 (fully open source) |
| Compatibility | — | Drop-in Redis replacement |
| Performance | Excellent | Excellent |
Both work identically with any Redis client library. Choose Valkey if you prefer a fully open-source license.
Connecting from your application
Stackpad injects the REDIS_URL environment variable into your web services:
redis://redis:6379// Using ioredisimport Redis from 'ioredis';
const redis = new Redis(process.env.REDIS_URL!);await redis.set('key', 'value');const value = await redis.get('key');// Using @upstash/redis (works with any Redis)import { Redis } from '@upstash/redis';
const redis = new Redis({ url: process.env.REDIS_URL! });Common use cases
Session storage
import session from 'express-session';import RedisStore from 'connect-redis';import Redis from 'ioredis';
app.use(session({ store: new RedisStore({ client: new Redis(process.env.REDIS_URL!) }), secret: process.env.SESSION_SECRET!,}));Caching
const cached = await redis.get(`user:${id}`);if (cached) return JSON.parse(cached);
const user = await db.query.users.findFirst({ where: eq(users.id, id) });await redis.set(`user:${id}`, JSON.stringify(user), 'EX', 3600);return user;What’s next?
- Connecting services — how private networking works
- PostgreSQL — add a database to your project