DEV Community

Alex Spinov
Alex Spinov

Posted on

Upstash Has a Free API You Should Know About

Upstash provides serverless Redis and Kafka with per-request pricing. No servers to manage, no idle costs — you pay only for what you use.

Why Upstash is Perfect for Serverless

A developer using Vercel serverless functions needed rate limiting. Traditional Redis required a persistent connection — impossible with serverless. Upstash's HTTP-based Redis worked perfectly with zero connection overhead.

Key Features:

  • Serverless Redis — HTTP-based, no persistent connections needed
  • Global Replication — Multi-region for low-latency reads
  • Per-Request Pricing — Pay only for commands you execute
  • REST API — Works from edge functions, serverless, and browsers
  • Free Tier — 10,000 commands/day, 256MB storage

Quick Start

npm install @upstash/redis
Enter fullscreen mode Exit fullscreen mode
import { Redis } from "@upstash/redis"

const redis = new Redis({
  url: "https://your-endpoint.upstash.io",
  token: "your-token"
})

await redis.set("user:1", { name: "Alice", email: "alice@example.com" })
const user = await redis.get("user:1")
Enter fullscreen mode Exit fullscreen mode

Rate Limiting

import { Ratelimit } from "@upstash/ratelimit"
import { Redis } from "@upstash/redis"

const ratelimit = new Ratelimit({
  redis: Redis.fromEnv(),
  limiter: Ratelimit.slidingWindow(10, "10 s")
})

const { success } = await ratelimit.limit("user-123")
if (!success) return new Response("Too many requests", { status: 429 })
Enter fullscreen mode Exit fullscreen mode

Why Choose Upstash

  1. True serverless — no connections, no idle costs
  2. Edge-ready — works from Vercel Edge, Cloudflare Workers
  3. Rich ecosystem — rate limiting, caching, messaging built-in

Check out Upstash docs to get started.


Need web scraping solutions? Check out my Apify actors or email spinov001@gmail.com for custom data extraction.

Top comments (0)