DEV Community

Alex Spinov
Alex Spinov

Posted on

Upstash Has a Free API: Serverless Redis and Kafka With Per-Request Pricing

Redis costs $15/month minimum on AWS. Kafka costs $200/month on Confluent. Upstash starts at $0 and you pay per request.

What Is Upstash?

Upstash provides serverless Redis, Kafka, QStash (message queue), and Vector (embeddings) with per-request pricing. Perfect for serverless and edge.

Serverless Redis

import { Redis } from '@upstash/redis'

const redis = new Redis({
  url: process.env.UPSTASH_REDIS_REST_URL,
  token: process.env.UPSTASH_REDIS_REST_TOKEN,
})

// Works over HTTP — no TCP connection needed!
await redis.set('user:123', { name: 'Alice', visits: 1 })
const user = await redis.get('user:123')

// Rate limiting
await redis.incr('ratelimit:api:user123')
await redis.expire('ratelimit:api:user123', 60)
Enter fullscreen mode Exit fullscreen mode

HTTP-based Redis means it works in Cloudflare Workers, Vercel Edge, Netlify Functions — anywhere that doesn't support TCP.

QStash (Message Queue)

import { Client } from '@upstash/qstash'

const qstash = new Client({ token: process.env.QSTASH_TOKEN })

// Send a message to be processed
await qstash.publishJSON({
  url: 'https://myapp.com/api/process',
  body: { userId: '123', action: 'send-welcome-email' },
  retries: 3,
  delay: '10s'  // Delayed delivery
})

// Schedule recurring
await qstash.publishJSON({
  url: 'https://myapp.com/api/daily-report',
  cron: '0 9 * * *'  // Every day at 9 AM
})
Enter fullscreen mode Exit fullscreen mode

QStash calls YOUR endpoint. No always-running consumer needed. Perfect for serverless.

Upstash Workflow

import { serve } from '@upstash/workflow/nextjs'

export const { POST } = serve(async (context) => {
  // Step 1: Each step is durable — survives crashes
  const user = await context.run('get-user', async () => {
    return await db.user.findUnique({ where: { id: context.requestPayload.userId } })
  })

  // Step 2: Wait (free — no compute used)
  await context.sleep('wait', 60 * 60) // 1 hour

  // Step 3: Send email
  await context.run('send-email', async () => {
    await sendEmail(user.email, 'Welcome!')
  })
})
Enter fullscreen mode Exit fullscreen mode

Free Tier

Product Free tier
Redis 10K commands/day
Kafka 10K messages/day
QStash 500 messages/day
Vector 10K queries/day

Why Upstash

  • Pay per request — $0 when idle (vs $15+/month for managed Redis)
  • HTTP-based — works in edge/serverless (no TCP connections)
  • Global replication — multi-region read replicas
  • Durable workflows — Temporal-like durability without infrastructure

Building serverless apps? Check out my developer tools or email spinov001@gmail.com.

Top comments (0)