Upstash Serverless Redis/Kafka
Use Upstash for serverless Redis and Kafka with per-request pricing and global replication for edge computing.
Overview
The @upstash/redis client provides a fully typed API for all Redis commands, with built-in support for automatic serialization/deserialization of JSON values. Upstash Redis supports all standard Redis data structures and commands, plus global replication for low-latency reads worldwide. The platform includes built-in rate limiting (@upstash/ratelimit) and vector search (@upstash/vector) packages.
Upstash Kafka provides serverless Kafka with the same HTTP-first, pay-per-request model. It enables event streaming, message queuing, and log aggregation without managing Kafka clusters. The QStash service offers HTTP-based message queuing with guaranteed delivery, scheduling, and retry logic, designed specifically for serverless workflows. All Upstash services include a generous free tier suitable for development and small production workloads.
Who Is This For?
- Add Redis caching to serverless functions without connection issues
- Implement rate limiting for API endpoints with @upstash/ratelimit
- Build event-driven architectures with serverless Kafka
- Schedule background tasks with QStash message queue
Installation
npm install @upstash/redis Configuration
import { Redis } from "@upstash/redis"
const redis = new Redis({
url: process.env.UPSTASH_REDIS_REST_URL!,
token: process.env.UPSTASH_REDIS_REST_TOKEN!,
})
// Works in edge/serverless (HTTP-based)
await redis.set("user:123", { name: "John", plan: "pro" }, { ex: 3600 })
const user = await redis.get("user:123")
// Rate limiting
import { Ratelimit } from "@upstash/ratelimit"
const ratelimit = new Ratelimit({
redis,
limiter: Ratelimit.slidingWindow(10, "10 s"),
})
const { success } = await ratelimit.limit("user:123") Explore AI Tools
Discover the best AI tools that complement your skills
Read AI & Design Articles
Tips and trends in the world of design and AI
Related Servers
Sentry Error Tracking
Monitor errors and performance issues in production with Sentry. AI agents can triage alerts and suggest fixes based on stack traces.
PostHog Product Analytics
Track product usage, manage feature flags, and analyze user behavior with PostHog, an open-source product analytics platform.
Database Query Builder
Generate and optimize SQL queries with AI assistance. Build complex queries, analyze execution plans, and improve database performance.