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:
- Auto-generated password — Redis and Valkey services are password-protected by default
- Persistent storage — data survives container restarts
- Private network access at
redis:6379orvalkey:6379 - Automatic backups based on your plan
- Version choice — Redis 6 or 7, Valkey latest
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;Performance tuning
Redis and Valkey services are automatically tuned based on their allocated RAM:
| Parameter | Value | Description |
|---|---|---|
maxmemory | 90% of RAM | Maximum memory before eviction |
maxmemory-policy | noeviction | Default policy (configurable) |
Override these from the service Settings tab.
Connecting from outside Stackpad
Enable Public access in the service settings to connect from your local machine. Public connections are TLS-encrypted on the standard Redis port (6379):
redis-cli -u "rediss://default:password@{serviceId}.db.stackpad.eu:6379"Works with Redis Insight, TablePlus, or any Redis client that supports TLS (rediss://).
Version management
Change the Redis or Valkey version from the service settings:
- Redis: versions 6 and 7
- Valkey: latest version
- Pick the version, save, and the service restarts
What’s next?
- Connecting services — how private networking and public access work
- PostgreSQL — add a database to your project