Upstash Free Tier: Serverless Redis, Message Queues, and Vector Search for $0

Upstash Free Tier: Serverless Redis, Message Queues, and Vector Search for $0

Data Platform🛠 Upstash

Upstash's permanent free tier gives you serverless Redis (500K commands/mo), QStash message queues (1K/day), and Vector search (10K reqs/day). Complete setup guide with Next.js code examples.

free-tiersaasredisserverlessweb-devdeveloper-tools

Upstash Free Tier: Serverless Redis, Message Queues, and Vector Search for $0

If you’ve built a modern web app with Next.js, you’ve run into the data problem. Traditional databases need connections, connection pools, and persistence — things that don’t fit well in serverless functions that spin up and down in milliseconds. Upstash solves this with a connectionless, HTTP-based approach: every request is stateless, so there are no connection limits, no pool exhaustion, and no cold-start penalties.

This guide covers Upstash’s permanent free tier — what each product gives you, how to set everything up from scratch, real code examples for caching and rate limiting, and when you’ll need to upgrade.


What Is Upstash?

Upstash is a serverless data platform that re-architects traditional data infrastructure for the edge and serverless era. Instead of long-lived TCP connections, every SDK talks to Upstash over HTTP/REST. The platform includes five products:

  • Upstash Redis — A drop-in replacement for Redis that works without persistent connections. Supports all core Redis data structures, pub/sub, and Lua scripting.
  • QStash — A serverless message queue with at-least-once delivery, scheduling, and HTTP-based consumers. Think of it as a message broker that speaks HTTP.
  • Upstash Vector — A vector database built on DiskANN, optimized for AI/LLM workloads like semantic search and RAG (Retrieval-Augmented Generation).
  • Upstash Workflow — Durable function orchestration built on top of QStash. Write multi-step workflows with automatic retries, state persistence, and scheduling.
  • Upstash Search — A combined full-text + semantic search service that works out of the box with no infrastructure management.

The platform is especially popular in the Next.js / Vercel ecosystem because its HTTP-based SDK works seamlessly in Edge Functions, Server Components, and Route Handlers without the overhead of traditional Redis connections.


Free Tier Details: What You Get at $0

Upstash’s free tiers are permanent — they don’t expire, and most don’t require a credit card. Here’s the breakdown:

Redis Free Tier

Limit Value
Commands per month 500,000
Data storage 256 MB
Bandwidth 10 GB/month
Regions 1
Max command rate 10,000 commands/second

Source: Upstash Redis Pricing

This is enough for a moderately-trafficked side project, a staging environment, or a personal API. 500K commands covers hundreds of thousands of cache checks and writes, and 256 MB is plenty for session data, feature flags, or rate-limit counters.

QStash (Message Queue) Free Tier

Limit Value
Messages per day 1,000
Max message size 10 MB

Source: Upstash QStash Pricing

QStash messages are HTTP calls to your endpoints. 1,000 messages/day means you can queue email sends, webhook deliveries, image processing jobs, and other async tasks for a small-to-medium app.

Vector Free Tier

Limit Value
Requests per day 10,000
Free indexes Up to 10
Dimensions supported Up to 1536 (OpenAI ada-002 compatible)

Source: Upstash Vector Pricing

The Vector free tier is surprisingly generous — 10K requests/day is enough for a RAG chatbot demo, semantic search on a documentation site, or an AI agent with moderate traffic.

Workflow & Search Free Tiers

Upstash Workflow and Upstash Search also have prototype free tiers. Workflow gives you free durable execution steps (unlimited steps per day on free, with 50 GB bandwidth), and Search offers a free tier for low-volume full-text + semantic search.


Getting Started: Create a Database and Connect from Next.js

Let’s walk through the full setup.

Step 1: Create a Redis Database

  1. Go to upstash.com and sign up (no credit card needed).
  2. Click Create Database.
  3. Select Redis as the database type.
  4. Choose a region close to your deployment (Upstash has regions on AWS, GCP, and Fly.io).
  5. Click Create. You’ll get a UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.

Step 2: Install the SDK

npm install @upstash/redis

Step 3: Connect in Next.js

Create a Redis client module:

// lib/redis.ts
import { Redis } from "@upstash/redis";

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

Set your environment variables in .env.local:

UPSTASH_REDIS_REST_URL="https://your-region.upstash.io"
UPSTASH_REDIS_REST_TOKEN="your-token-here"

That’s it. No connection pool, no connect() call, no client.quit(). The SDK makes HTTP requests under the hood and works in every Next.js runtime — Server Components, Route Handlers, Edge Functions, and Middleware.


Caching Pattern: Cache-Aside with TTL

The cache-aside pattern is the most common Redis use case: check the cache first, fall back to the database, then write the result back to the cache with a TTL.

Here’s it in a Next.js Route Handler:

// app/api/users/[id]/route.ts
import { NextResponse } from "next/server";
import { redis } from "@/lib/redis";

export async function GET(
  request: Request,
  { params }: { params: { id: string } }
) {
  const cacheKey = `user:${params.id}`;

  // 1. Try cache first
  const cached = await redis.get(cacheKey);
  if (cached) {
    return NextResponse.json({ user: cached, source: "cache" });
  }

  // 2. Cache miss — fetch from database
  // (Replace this with your Prisma / Drizzle / SQL query)
  const user = await fetchUserFromDB(params.id);

  if (!user) {
    return NextResponse.json({ error: "Not found" }, { status: 404 });
  }

  // 3. Store in cache with 5-minute TTL
  await redis.set(cacheKey, user, { ex: 300 });

  return NextResponse.json({ user, source: "database" });
}

Each cache hit costs 1 command (a GET). Each cache miss costs 2 commands (one GET, one SET). At 500K commands/month, you can serve ~250K cache hits or ~166K full cache-miss round-trips before hitting the free tier limit.


Rate Limiting with @upstash/ratelimit

Upstash’s @upstash/ratelimit package is purpose-built for serverless rate limiting. It’s the only connectionless (HTTP-based) rate limiting library, designed for AWS Lambda, Vercel Edge Functions, Cloudflare Workers, and Deno.

Install it alongside the Redis SDK:

npm install @upstash/ratelimit @upstash/redis

Sliding Window Rate Limiter in Next.js Middleware

// middleware.ts
import { NextRequest, NextResponse } from "next/server";
import { Ratelimit } from "@upstash/ratelimit";
import { Redis } from "@upstash/redis";

const ratelimit = new Ratelimit({
  redis: Redis.fromEnv(),  // reads UPSTASH_REDIS_REST_URL and _TOKEN
  limiter: Ratelimit.slidingWindow(10, "10 s"),  // 10 requests per 10 seconds
  analytics: true,  // track rate limit hits
});

export async function middleware(request: NextRequest) {
  const ip = request.headers.get("x-forwarded-for") ?? "anonymous";
  const { success, limit, reset, remaining } = await ratelimit.limit(ip);

  const response = success
    ? NextResponse.next()
    : NextResponse.json({ error: "Too Many Requests" }, { status: 429 });

  // Set standard rate-limit headers
  response.headers.set("X-RateLimit-Limit", limit.toString());
  response.headers.set("X-RateLimit-Remaining", remaining.toString());
  response.headers.set("X-RateLimit-Reset", reset.toString());

  return response;
}

export const config = {
  matcher: "/api/:path*",
};

Each rate limit check is 2 commands (a sliding-window read and write). With 500K free commands, you can run ~250K rate limit checks per month for free. For a typical API handling 100K requests/month with rate limiting on every request, you’d use about 200K commands — well within the free tier.

You can also use fixed-window, token bucket, or cached sliding window strategies — see the @upstash/ratelimit docs for details.


Vector Search for AI / RAG

Upstash Vector lets you store embeddings and run semantic search without managing your own vector database. The free tier gives you 10,000 requests/day and up to 10 indexes — more than enough for a demo or low-traffic AI feature.

Storing Embeddings

import { Index } from "@upstash/vector";

const index = new Index({
  url: process.env.UPSTASH_VECTOR_REST_URL!,
  token: process.env.UPSTASH_VECTOR_REST_TOKEN!,
});

// Store embeddings from OpenAI
const embeddings = await openai.embeddings.create({
  model: "text-embedding-ada-002",
  input: ["Your document text here"],
});

await index.upsert([
  {
    id: "doc-1",
    vector: embeddings.data[0].embedding,
    metadata: { title: "Getting Started with Upstash", category: "docs" },
  },
]);
const queryEmbedding = await openai.embeddings.create({
  model: "text-embedding-ada-002",
  input: ["How do I get started?"],
});

const results = await index.query({
  vector: queryEmbedding.data[0].embedding,
  topK: 5,
  includeMetadata: true,
});

console.log(results); // Top 5 most semantically similar documents

This pairs naturally with the Vercel AI SDK for building RAG chatbots. Each index.query() call costs 1 request, and each index.upsert() call costs 1 request. At 10K requests/day free, you can run ~300 queries per minute in steady state — enough for a real-time documentation chatbot used by dozens of concurrent users.


Free Tier Gotchas & When to Upgrade

Even though Upstash’s free tier is generous, a few limits sneak up on you:

  1. Commands ≠ API requests. A single Redis MGET with 10 keys counts as 10 commands. If you batch operations, the command count multiplies fast.

  2. Bandwidth is shared. The free Redis tier’s 10 GB bandwidth includes both incoming and outgoing data. If you store and retrieve large JSON payloads (e.g., >100 KB), you’ll burn through bandwidth before hitting the command limit.

  3. QStash 1,000/day is per-queue. If you have multiple queues (email, image processing, webhooks), they share that 1,000 daily budget.

  4. No credit card = no auto-upgrade. By default, hitting limits causes errors rather than automatic upgrades. You can enable auto-upgrade to avoid sudden outages, but that requires adding a payment method.

  5. Single region on free. The free Redis tier is restricted to one region. Multi-region replication requires a paid plan.

When to upgrade:

  • You’re approaching your monthly command/bandwidth limits in steady state
  • You need multi-region replication for low-latency global access
  • You need >1,000 QStash messages/day in production
  • You’re running an AI feature that exceeds 10K vector queries/day
  • You want data durability guarantees (backups, point-in-time recovery)

Paid plans start at pay-as-you-go: Redis at $0.20/100K commands, QStash at $1/100K messages, and Vector at $0.40/100K requests. There are also fixed plans for predictable billing.


Comparison with Alternatives

Upstash vs. Redis Cloud Free Tier

Redis Cloud offers a free tier with 30 MB of storage — significantly less than Upstash’s 256 MB. Redis Cloud’s free tier also requires a credit card and limits you to a single database. Upstash is better for:

  • Larger data sets (256 MB vs 30 MB)
  • HTTP-based access (no connection pool management)
  • Serverless/edge environments where TCP connections are problematic
  • No credit card required

Winner for side projects: Upstash.

Upstash vs. Self-Hosted Redis

Self-hosting Redis on a $6/month VPS (like a Hetzner CX22) gives you unlimited commands and storage for a fixed price. But you’re on the hook for:

  • OS updates, Redis version upgrades, and security patches
  • Connection limits and TCP tuning
  • High availability and backups
  • Monitoring and alerting

Upstash’s free tier beats self-hosting for any project where your time is worth more than $0/month. Once you exceed 500K commands regularly, the comparison gets interesting — self-hosting a $6 VPS is cheaper than Upstash’s pay-as-you-go at high throughput.

Winner for simplicity and $0: Upstash. Winner at scale: self-hosted.

Upstash vs. Other Serverless Redis Providers

Providers like Redis on Railway and Redis on Render typically start at $5–$7/month with no permanent free tier. Upstash is the clear choice when you need $0 cost for as long as possible.


Final Thoughts

Upstash’s free tier is one of the best deals in serverless infrastructure. A single free Redis database can power caching, rate limiting, session storage, and feature flags for a side project. Add QStash for background jobs and Vector for AI features, and you have a complete data stack — all at $0, all with HTTP-based SDKs that work perfectly with serverless runtimes.

The 500K command limit and 256 MB storage are real constraints, but they’re generous enough to take a project from idea to production traffic before you need to pay. And when you do outgrow the free tier, the pay-as-you-go pricing scales smoothly without a painful jump from free to $50/month.

References

[1] Upstash [2] Next.js / Vercel ecosystem [3] Upstash Redis Pricing