Redis

Serverless Redis over REST and TCP, in one command.

AI/LLM: this page is available in plain markdown at /docs/resources/redis.md

npx extraorbital add redis
✓ Provisioned redis/default (us-east-1)
✓ Wrote 3 variables to .env

  UPSTASH_REDIS_REST_URL, UPSTASH_REDIS_REST_TOKEN, REDIS_URL

A project that mentions REDIS_URL or either UPSTASH_REDIS_REST_* variable gets this from extraorbital provision without naming it.

What it writes

VariableExample
UPSTASH_REDIS_REST_URLhttps://redis.extraorbital.dev/cosmic-otter-default
UPSTASH_REDIS_REST_TOKENAX8aACQg…
REDIS_URLrediss://default:…@redis.extraorbital.dev:6379

Two ways in for the same database: an Upstash-compatible REST API for serverless and edge runtimes, and a standard TCP URL for anything that speaks the Redis protocol.

Options

npx extraorbital add redis [--slug <name>] [--region <region>]
FlagDefaultDescription
--slugdefaultA second, fully separate database in the same project
--regionus-east-1One of us-east-1, eu-central-1, ap-southeast-1

Prototype allowance

256 MB, 500K commands per month and 10 GB of bandwidth free on the Prototype plan, counted across your whole account and shared by up to five databases. Past it, $0.20/100K commands and $0.25/GB-mo — our own cost, with nothing added — on a paid plan.

Use it

Over REST, which works in serverless functions and at the edge:

cache.ts
import { Redis } from "@upstash/redis";

const redis = Redis.fromEnv(); // reads UPSTASH_REDIS_REST_URL and _TOKEN

await redis.set("session:brave-fox", { step: 3 }, { ex: 3600 });
const session = await redis.get("session:brave-fox");

Or over TCP, with any standard client:

queue-worker.ts
import { createClient } from "redis";

const redis = createClient({ url: process.env.REDIS_URL });
await redis.connect();
await redis.lPush("jobs", JSON.stringify({ id: 1 }));

Next

  • QStash — queues with delivery guarantees over HTTP
  • Pricing — plans, allowances and rates