What if you could use Redis from Cloudflare Workers, Vercel Edge, or any serverless function — without TCP connections?
Upstash Redis is a serverless Redis service with an HTTP/REST API. It works everywhere, including environments that do not support TCP.
Why Upstash Redis
- HTTP-based — no TCP connections, works in edge/serverless
- Pay per request — $0 when idle, no fixed costs
- Global replication — multi-region read replicas
- Redis compatible — all Redis commands via REST or SDK
- Durable — data persists, unlike in-memory Redis
- Free tier — 10K commands/day, 256MB storage
Quick Start
npm install @upstash/redis
import { Redis } from "@upstash/redis";
const redis = Redis.fromEnv(); // Reads UPSTASH_REDIS_REST_URL and TOKEN
// All standard Redis operations
await redis.set("user:123", { name: "Alice", plan: "pro" });
const user = await redis.get("user:123");
// Rate limiting
const requests = await redis.incr("ratelimit:ip:1.2.3.4");
await redis.expire("ratelimit:ip:1.2.3.4", 60);
if (requests > 100) {
return new Response("Rate limited", { status: 429 });
}
Rate Limiting Library
import { Ratelimit } from "@upstash/ratelimit";
import { Redis } from "@upstash/redis";
const ratelimit = new Ratelimit({
redis: Redis.fromEnv(),
limiter: Ratelimit.slidingWindow(10, "10 s"), // 10 requests per 10 seconds
});
// In your API handler
const { success, limit, remaining } = await ratelimit.limit("user:123");
if (!success) return new Response("Too many requests", { status: 429 });
Real Use Case
A Vercel Edge Function needed session caching. Traditional Redis requires TCP — not available on the edge. Upstash Redis works over HTTP — the Edge Function stores sessions with sub-millisecond reads from the nearest region. No infrastructure change, just npm install and go.
When to Use Upstash Redis
- Edge/serverless environments needing Redis
- Rate limiting and session management
- Caching for serverless APIs
- Any Redis use case where you want zero ops
Get Started
Visit upstash.com/redis — free tier, global, serverless.
Need custom data pipelines or scraping solutions? Check out my Apify actors or email me at spinov001@gmail.com for custom solutions.
Top comments (0)