@upstash/redis

HTTP/REST-based Redis client built for serverless and edge runtimes

SDK
npm
v1.39.0
974 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
78 /100 Good
Development Activity 76
Maintenance 80
Community 60
Maturity 56
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
81 /100 Excellent
Architecture 82
Code Quality 84
Innovation 80
Learning Curve 78

@upstash/redis is the official TypeScript client for Upstash’s HTTP REST API in front of Redis. Instead of holding a persistent TCP connection like traditional Redis drivers, every command is sent as a single HTTPS request, which makes it a natural fit for AWS Lambda, Cloudflare Workers, Fastly Compute@Edge, Vercel Functions, and other short-lived or connectionless execution environments.

The client covers the full Redis command surface — strings, hashes, lists, sets, sorted sets, geo, bitmaps, RedisJSON, and Redis Functions/scripts — with typed method signatures, plus pipelining, transactions, retries, and optional read-your-writes consistency.

What You Get

  • A Redis client class with 200+ typed command methods covering strings, hashes, lists, sets, sorted sets, streams, geo, bitmaps, and RedisJSON
  • Platform-specific builds for Node.js, Cloudflare Workers, and Fastly Compute@Edge exported from dedicated subpaths
  • Pipeline and multi/transaction APIs plus an automatic request-batching proxy for reducing round trips
  • Built-in retry-with-backoff, base64 response decoding, and optional read-your-writes consistency tracking

Common Use Cases

  • Caching database query results and API responses in serverless functions
  • Rate limiting and request throttling at the edge
  • Session storage and feature flagging for jamstack and single-page applications
  • Lightweight pub/sub and streaming via server-sent events for real-time features

Under The Hood

Architecture — The library is centered on a Redis class (pkg/redis.ts) that composes roughly 200 typed *Command classes (e.g. GetCommand, HSetCommand, ZAddCommand under pkg/commands/) with a single HttpClient (pkg/http.ts) that implements the Requester interface. Each command serializes its Redis arguments into a JSON body and calls requester.request(), which POSTs to the Upstash REST endpoint, retries on network failure with exponential backoff, and decodes base64-encoded results back into native JS types (pkg/http.ts, decode()/base64decode()). Pipeline and Script/ScriptRo (pkg/pipeline.ts, pkg/script.ts) reuse the same command classes but batch them into one HTTP call, and auto-pipeline.ts wraps the Redis instance in a Proxy that auto-batches same-tick calls, distinguishing read/write commands via a READ_COMMANDS set for read-your-writes correctness. Three thin platform entry points (platforms/nodejs.ts, cloudflare.ts, fastly.ts) construct the same Redis core with runtime-appropriate fetch/agent options.

Tech Stack — Pure TypeScript, built with tsup into CJS/ESM/.d.ts bundles (tsup.config.ts), tested with Bun’s built-in test runner (bun test). The published package has exactly one runtime dependency, uncrypto (for cross-runtime crypto), keeping the client lightweight and tree-shakeable. The repo is a pnpm workspace (pnpm-workspace.yaml) housing @upstash/redis alongside sibling search-redis/search-ioredis packages, released via a Changesets-driven GitHub Actions pipeline with separate stable and canary publish flows.

Code Quality — Very high test density: 213 *.test.ts files sit directly alongside their corresponding pkg/commands/*.ts implementation files (e.g. redis.test.ts, pipeline.test.ts, auto-pipeline.test.ts, read-your-writes.test.ts), plus dedicated integration tests for Redis Functions. Error handling is centralized in three purpose-built classes (UpstashError, UrlError, UpstashJSONParseError in pkg/error.ts) that wrap raw REST failures with actionable messages, and the HTTP layer’s retry, backoff, and base64-decoding paths are exercised directly in http.test.ts. Naming is consistent throughout — every command file exports a single <Name>Command class extending a shared Command base.

API Design — The public API deliberately mirrors familiar Redis client conventions (redis.get(), redis.hset(), redis.zadd()), so anyone who has used ioredis or redis-py can be productive immediately; getting started requires only new Redis({ url, token }) with no connection lifecycle to manage. Extensive inline TSDoc comments on option types (RetryConfig, HttpClientConfig) and 26 runnable examples spanning Next.js, Cloudflare Workers, AWS Lambda, Azure Functions, and more keep the barrier to entry low despite the large command surface.

Used by 13 apps in this directory

TypeScript
49%
MPL 2.0

Artillery

Developer Tools · Devops

9,083

Cloud-scale load testing and functional testing for APIs, WebSockets, gRPC, and headless browsers, distributed across AWS Lambda or Fargate with zero infrastructure to manage.

View details
89
Repo Health
73
Technical
68
Dependency
Built with
TypeScript 49%
JavaScript 48%
Updated 2 weeks ago
TypeScript
96%
Other

Cal.diy

Scheduling

48,697

The 100% MIT-licensed, community-driven scheduling platform — self-host your own booking infrastructure with no enterprise strings attached.

View details
91
Repo Health
86
Technical
65
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
TypeScript
100%
Other

Dub

Analytics · Marketing

24,835

The open-source link attribution platform for short links, conversion tracking, and affiliate programs — powering 100M+ clicks monthly.

View details
81
Repo Health
78
Technical
62
Dependency
Built with
TypeScript 100%
Updated 1 weeks ago
TypeScript
62%
Other

Flowise

AI Development · Automation · Developer Tools

55,490

Drag-and-drop visual builder for AI agents, RAG pipelines, and multi-agent systems—deploy anywhere in minutes.

View details
82
Repo Health
77
Technical
63
Dependency
Built with
TypeScript 62%
JavaScript 27%
Updated 1 months ago
TypeScript
99%
Apache 2.0

Mastra Code

AI Code Assistants

28,378

"A coding agent that never compacts" — a terminal-based AI coding agent built on the Mastra framework, with Observational Memory instead of context compaction, multi-model support, and OAuth login for Claude Max or ChatGPT Plus.

View details
90
Repo Health
73
Technical
65
Dependency
Built with
TypeScript 99%
Updated 1 weeks ago
TypeScript
96%
AGPL 3.0

Midday

Invoicing Finance · Productivity

15,042

All-in-one AI-powered business operations platform for freelancers and solo entrepreneurs to manage invoicing, time tracking, banking, and financial intelligence.

View details
53
Repo Health
78
Technical
67
Dependency
Built with
TypeScript 96%
Updated 3 months ago
TypeScript
82%
AGPL 3.0

OpenStatus

Devops · Monitoring

9,143

Open-source status pages and uptime monitoring with global synthetic checks, monitoring-as-code, and AI agent integration via MCP.

View details
77
Repo Health
82
Technical
69
Dependency
Built with
TypeScript 82%
MDX 15%
Updated 1 weeks ago
TypeScript
75%
MIT

OpenCode

AI Code Assistants

210,460

A fully open-source AI coding agent built for the terminal, with a TUI, desktop app, web client, plugin system, and SDK — one of the most-starred AI coding agents on GitHub.

View details
89
Repo Health
76
Technical
67
Dependency
Built with
TypeScript 75%
MDX 22%
Updated 1 weeks ago
TypeScript
99%
Other

Papermark

Digital Signiture · File Storage

9,218

Open-source DocSend alternative with page-by-page analytics, secure data rooms, and custom domains for document sharing.

View details
82
Repo Health
63
Technical
67
Dependency
Built with
TypeScript 99%
Updated 1 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers