DEV Community

Alex Spinov
Alex Spinov

Posted on

Upstash Has a Free API: Serverless Redis and Kafka With HTTP Protocol

Upstash provides serverless Redis and Kafka with REST/HTTP APIs. No connections to manage, no servers to provision — just HTTP calls. Pay per request with a generous free tier (10K commands/day).

Why Upstash?

  • HTTP protocol — works in serverless, edge, Cloudflare Workers
  • No connections — stateless HTTP calls, no connection pooling
  • Free tier — 10K commands/day Redis, 10K messages/day Kafka
  • Global replication — multi-region with read replicas
  • Durable — data persisted to disk, not just memory

Upstash Redis

REST API (HTTP)

REDIS_URL="https://your-redis.upstash.io"
TOKEN="your-token"

# SET
curl "$REDIS_URL/set/mykey/myvalue" -H "Authorization: Bearer $TOKEN"

# GET
curl "$REDIS_URL/get/mykey" -H "Authorization: Bearer $TOKEN"

# Multiple commands in one request
curl -X POST "$REDIS_URL/pipeline" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '[
    ["SET", "user:1", "Alice"],
    ["SET", "user:2", "Bob"],
    ["GET", "user:1"],
    ["GET", "user:2"]
  ]'

# HASH
curl "$REDIS_URL/hset/user:1/name/Alice/email/alice@example.com" \
  -H "Authorization: Bearer $TOKEN"

curl "$REDIS_URL/hgetall/user:1" -H "Authorization: Bearer $TOKEN"
Enter fullscreen mode Exit fullscreen mode

TypeScript SDK

import { Redis } from '@upstash/redis';

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

// Works in Cloudflare Workers, Vercel Edge, Deno Deploy!
await redis.set('key', 'value');
const val = await redis.get('key');

// JSON
await redis.set('user', { name: 'Alice', age: 30 });
const user = await redis.get<{name: string, age: number}>('user');

// Rate limiting
import { Ratelimit } from '@upstash/ratelimit';

const ratelimit = new Ratelimit({
  redis,
  limiter: Ratelimit.slidingWindow(10, '10s'), // 10 requests per 10s
});

const { success } = await ratelimit.limit('user-ip');
if (!success) return new Response('Too Many Requests', { status: 429 });
Enter fullscreen mode Exit fullscreen mode

Upstash Kafka

KAFKA_URL="https://your-kafka.upstash.io"

# Produce message
curl -X POST "$KAFKA_URL/produce/my-topic" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"value": {"event": "signup", "user": "alice"}}'

# Consume messages
curl "$KAFKA_URL/consume/my-group/my-instance/my-topic" \
  -H "Authorization: Bearer $TOKEN"

# Commit offsets
curl -X POST "$KAFKA_URL/commit/my-group/my-instance" \
  -H "Authorization: Bearer $TOKEN"
Enter fullscreen mode Exit fullscreen mode

Upstash QStash (Message Queue)

import { Client } from '@upstash/qstash';

const qstash = new Client({ token: 'your-qstash-token' });

// Publish to endpoint (guaranteed delivery)
await qstash.publishJSON({
  url: 'https://your-app.com/api/webhook',
  body: { event: 'order_placed', orderId: '123' },
  retries: 3,
  delay: '10s',
});

// Schedule (cron)
await qstash.publishJSON({
  url: 'https://your-app.com/api/daily-report',
  body: {},
  cron: '0 9 * * *', // Daily at 9am
});
Enter fullscreen mode Exit fullscreen mode

Free Tier

Service Free Tier
Redis 10K commands/day, 256MB
Kafka 10K messages/day
QStash 500 messages/day
Vector 10K queries/day

Key Features

Feature Details
Protocol HTTP/REST (no TCP connections)
Replication Global, multi-region
Durability Persisted to disk
Edge-ready Works in Workers, Edge, Lambda
SDKs TypeScript, Python, Go

Resources


Building serverless apps? Check my Apify actors or email spinov001@gmail.com.

Top comments (0)