Upstash provides a serverless Redis service with HTTP-based access, per-request pricing, and global replication. Unlike traditional Redis, Upstash works in serverless and edge environments (Vercel Edge, Cloudflare Workers) because it uses HTTP instead of persistent TCP connections. It also offers QStash for serverless message queues and rate limiting utilities.
Cache API responses and database queries from Vercel Edge Functions or Cloudflare Workers using HTTP-based Redis that works where TCP connections are not available.
Implement API rate limiting with the @upstash/ratelimit library, which provides sliding window and token bucket algorithms backed by serverless Redis.
Store user sessions in globally replicated Redis for low-latency session access regardless of where users connect from.
import { Redis } from "@upstash/redis";import { Ratelimit } from "@upstash/ratelimit";const redis = new Redis({url: process.env.UPSTASH_REDIS_REST_URL!,token: process.env.UPSTASH_REDIS_REST_TOKEN!,});const ratelimit = new Ratelimit({redis,limiter: Ratelimit.slidingWindow(10, "60 s"),analytics: true,});export async function checkRateLimit(identifier: string) {const { success, limit, remaining, reset } = await ratelimit.limit(identifier);return { allowed: success, limit, remaining, resetAt: new Date(reset) };}
Seamless integration, great documentation. Set up in under 10 minutes.
2 days ago
Works well for our use case. Would love to see more webhook event types.
1 week ago
Excellent compliance coverage. HIPAA audit trail works perfectly.
2 weeks ago
| Key | Description | Example |
|---|---|---|
| UPSTASH_REDIS_REST_URL | REST URL for Upstash Redis | https://xxxx-xxxx.upstash.io |
| UPSTASH_REDIS_REST_TOKEN | REST token for Upstash Redis authentication | AxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxQ== |
Upstash Redis is a serverless Redis service that works in edge and serverless environments through its HTTP-based API. It provides per-request pricing, global replication, and zero idle costs. The companion libraries for rate limiting (@upstash/ratelimit) and message queuing (QStash) make it the go-to caching and messaging layer for serverless-first architectures.