Guides

Managed Redis

Create a Redis-compatible Valkey instance, choose a preset, and connect from your app.

Redis on Bytstack is Redis (Valkey-compatible). It is your cache, session store, or job queue. It is not the platform’s internal queue, and your app never receives that URL.

Open a project → Redis → create an instance for the active deployment environment. The first instance in that environment is injected as REDIS_URL. Another instance uses REDIS_URL_<NAME> unless you set a custom env key. If that key already exists, Bytstack does not overwrite it.

PR preview environments do not get their own Redis.

Presets

PresetUse it forEvictionDisk
CacheLoss-tolerant dataallkeys-lruoff
Job queueBullMQ and similar workersnoevictionAOF and RDB
SessionsLogin sessionsvolatile-lruAOF and RDB
AdvancedYou choose both settingsyou chooseyou choose

Job queue uses noeviction so a full memory limit returns an error instead of deleting jobs. Cache uses allkeys-lru and persistence off for data you can recompute.

Free is 32 Mi, persistence off, no snapshots, and no high availability. Starter adds 256 / 512 / 1024 Mi, every persistence mode, and 7-day snapshots. Pro adds 1–8 Gi, 30-day snapshots, and an optional high-availability add-on. Prices are on Pricing & limits.

Internal and external

Internal is how your deployed services connect. The URL is redis://, authentication is always on, and the host is only reachable inside the project.

External is for your laptop or CI. The rediss:// URL works as soon as the instance is ready. An empty allowlist allows any IP. Add CIDRs only to limit who can connect.

bytstack redis url <id>
bytstack redis url <id> --external
bytstack redis access <id> --cidr 203.0.113.10/32

After a credential rotation, redeploy services that read REDIS_URL so they pick up the new password.

Persistence is not a backup

Persistence writes to the instance disk so data survives a pod restart. Snapshots are separate copies in object storage used for restore. Persistence is not a backup.

Free plans cannot take snapshots. Starter and Pro can:

bytstack redis backups <id> --create
bytstack redis restore <id> --backup <backupId> --yes

Restore keeps the same hostname and password.

Recipes

These are the same snippets the dashboard Quick connect panel and bytstack redis --help print. They read the injected env key (REDIS_URL below).

ioredis

import Redis from 'ioredis';

export const redis = new Redis(process.env.REDIS_URL!, {
  maxRetriesPerRequest: null,
});

node-redis

import { createClient } from 'redis';

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

BullMQ

Use the Job queue preset. BullMQ requires maxRetriesPerRequest: null on the shared connection.

import { Queue, Worker } from 'bullmq';
import Redis from 'ioredis';

// BullMQ requires maxRetriesPerRequest: null on the shared connection.
const connection = new Redis(process.env.REDIS_URL!, { maxRetriesPerRequest: null });

export const emails = new Queue('emails', { connection });

new Worker('emails', async (job) => {
  await send(job.data);
}, { connection });

Nest cache

import { CacheModule } from '@nestjs/cache-manager';
import { Module } from '@nestjs/common';
import { redisStore } from 'cache-manager-redis-yet';

@Module({
  imports: [
    CacheModule.registerAsync({
      isGlobal: true,
      useFactory: async () => ({
        store: await redisStore({ url: process.env.REDIS_URL }),
        ttl: 60_000,
      }),
    }),
  ],
})
export class AppModule {}

Express sessions

Use the Sessions preset. The client is the same ioredis connection as Quick connect.

import session from 'express-session';
import RedisStore from 'connect-redis';
import Redis from 'ioredis';

const redis = new Redis(process.env.REDIS_URL!, {
  maxRetriesPerRequest: null,
});

app.use(
  session({
    store: new RedisStore({ client: redis }),
    secret: process.env.SESSION_SECRET!,
    resave: false,
    saveUninitialized: false,
  }),
);

High availability

Pro can add a replica. Your app keeps the same REDIS_URL. Failover is best-effort, about 30 seconds, not a contractual SLA. Free and Starter cannot enable it.

bytstack redis ha enable <id>

The high-availability add-on is a separate monthly line equal to the memory price, so the instance total doubles. Credits do not reduce the Redis charge.

Managed Redis — Bytstack Docs