Skip to content

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

  1. Open your project in the dashboard
  2. Click Add Service → Cache
  3. Select Redis or Valkey
  4. 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:6379 or valkey: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.

RedisValkey
LicenseSource-available (SSPL)BSD-3 (fully open source)
CompatibilityDrop-in Redis replacement
PerformanceExcellentExcellent

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 ioredis
import 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:

ParameterValueDescription
maxmemory90% of RAMMaximum memory before eviction
maxmemory-policynoevictionDefault 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):

Terminal window
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?