Sourcemap Explorer
Stack · npm package

@upstash/redis

An HTTP/REST based Redis client built on top of Upstash REST API.

latest 1.38.0· MIT· 1,052 versions publishedView on npm

About

An HTTP/REST based Redis client built on top of Upstash REST API.

redisdatabaseserverlessedgeupstash

Live mirror of the GitHub README. Updated whenever the repo's default branch changes.

Upstash Redis

@upstash/redis is an HTTP/REST based Redis client for typescript, built on top of Upstash REST API.

Tests npm (scoped) npm bundle size

[!NOTE]
This project is in GA Stage.

The Upstash Professional Support fully covers this project. It receives regular updates, and bug fixes. The Upstash team is committed to maintaining and improving its functionality.

It is the only connectionless (HTTP based) Redis client and designed for:

  • Serverless functions (AWS Lambda ...)
  • Cloudflare Workers (see the example)
  • Fastly Compute@Edge (see the example)
  • Next.js, Jamstack ...
  • Client side web/mobile applications
  • WebAssembly
  • and other environments where HTTP is preferred over TCP.

See the list of APIs supported.

[!TIP] Need a Redis database fast? Skip the signup and dashboard — POST to https://upstash.com/start-redis to get an endpoint and token in a single HTTP request. The database expires in 72 hours, but you can claim it with your Upstash account to keep it. Especially useful for AI agents that need scratch storage on the fly.

Quick Start

Install

Node.js
npm install @upstash/redis
Deno
import { Redis } from "https://esm.sh/@upstash/redis";

Create database

Create a new redis database on upstash

Basic Usage:

import { Redis } from "@upstash/redis"

const redis = new Redis({
  url: <UPSTASH_REDIS_REST_URL>,
  token: <UPSTASH_REDIS_REST_TOKEN>,
})

// string
await redis.set('key', 'value');
let data = await redis.get('key');
console.log(data)

await redis.set('key3', 'value3', {ex: 1});

// sorted set
await redis.zadd('scores', { score: 1, member: 'team1' })
data = await redis.zrange('scores', 0, 100 )
console.log(data)

// list
await redis.lpush('elements', 'magnesium')
data = await redis.lrange('elements', 0, 100 )
console.log(data)

// hash
await redis.hset('people', {name: 'joe'})
data = await redis.hget('people', 'name' )
console.log(data)

// sets
await redis.sadd('animals', 'cat')
data  = await redis.spop('animals', 1)
console.log(data)

Troubleshooting

We have a dedicated page for common problems. If you can't find a solution, please open an issue.

Docs

See the documentation for details.

Release Workflow

Stable Release

  1. Create a changeset (pnpm changeset) describing your changes and merge it to main
  2. Changeset workflow runs on push to main. If changesets are pending, it opens a "Version Packages" PR. When that PR is merged, the workflow runs again, publishes git tags, creates GitHub releases, and uploads a release-meta artifact
  3. Router workflow detects the Changeset completion via workflow_run, downloads the release-meta artifact, and calls the npm Publish workflow with prerelease: false and the resolved version
  4. npm Publish checks out the released commit, builds, and publishes to npm under the latest tag

Canary Release

  1. Trigger the Canary Release workflow manually from the Actions tab, selecting the package
  2. It creates a snapshot version (x.y.z-canary.{timestamp}), creates a GitHub prerelease, and uploads a release-meta artifact
  3. Router picks it up the same way, calling npm Publish with prerelease: true
  4. npm Publish publishes to npm under the canary tag

CI Tests

On every pull request, push to main, and daily schedule, the Router workflow runs the Tests workflow (unit tests, lint, build, and example integration tests).

Contributing

Install Bun

Database

Create a new redis database on upstash and copy the url and token

Running tests

bun run test

Building

bun run build

Telemetry

This library sends anonymous telemetry data to help us improve your experience. We collect the following:

  • SDK version
  • Platform (Deno, Cloudflare, Vercel)
  • Runtime version (node@18.x)

You can opt out by setting the UPSTASH_DISABLE_TELEMETRY environment variable to any truthy value.

UPSTASH_DISABLE_TELEMETRY=1

Alternatively, you can pass enableTelemetry: false when initializing the Redis client:

const redis = new Redis({
  // ...,
  enableTelemetry: false,
});

Quick facts

Latest version1.38.0
LicenseMIT
AuthorAndreas Thomas
Installnpm install @upstash/redis
Direct dependencies1

How Sourcemap Explorer detects @upstash/redis

We catch @upstash/redis from two complementary signals: bundled source paths and the embedded package.json. Modern bundlers (webpack, Vite, esbuild, Rollup, Turbopack) preserve the original node_modules/@upstash/redis/ paths inside the JavaScript sourcemap's sources[] array — that's the canonical signal. When the matching package.json is also captured in sourcesContent[], we read the exact version field — patch number included. No regex guessing, no version inference.

  1. 1

    Confirm the site exposes sourcemaps

    In DevTools Network, check the response headers of any application script for `SourceMap` or `X-SourceMap`. Failing that, fetch the script's last 4 KB and look for a `//# sourceMappingURL=` comment.

  2. 2

    Find the package in the bundle

    Open DevTools → Network → reload. Click any application script and look at its sourcemap. Inside, search `sources[]` for entries matching `node_modules/@upstash/redis/` — every match confirms the package is bundled. The matching `sourcesContent[i]` for `node_modules/@upstash/redis/package.json` gives you the exact installed version.

  3. 3

    Read the version directly from package.json

    Run `jq -r '. as $m | $m.sources | to_entries[] | select(.value | endswith("node_modules/@upstash/redis/package.json")) | $m.sourcesContent[.key] | fromjson | .version' bundle.js.map`. Sourcemap Explorer automates the same query in the popup.

Recent versions

Version
Released
0.1.1
0.1.11
0.1.2
0.1.21
0.1.22
0.1.3
0.1.4
0.1.5

FAQ

What is @upstash/redis used for?

An HTTP/REST based Redis client built on top of Upstash REST API.

How can I tell if a website is using @upstash/redis?

Open the page in Chrome with the Sourcemap Explorer extension installed and read the Stack tab. We catch `@upstash/redis` from two complementary signals: `node_modules/@upstash/redis/` paths inside the JavaScript sourcemap, and the embedded `package.json` we read for exact-version detection. Without the extension you can do the same lookup manually in DevTools — the steps are listed in the "How Sourcemap Explorer detects" section above.

What is the latest version of @upstash/redis?

1.38.0, as published on the npm registry. The "Recent versions" table on this page lists the most recent 8 releases with their release dates. Sourcemap Explorer reports the version actually bundled into a site, which can lag the latest release by months on real-world deployments.

Where can I read more?

Project homepage: https://github.com/upstash/upstash-redis#readme. Source code: https://github.com/upstash/redis-js. Published on npm: https://www.npmjs.com/package/@upstash/redis. Licensed as MIT.

Keep reading on Sourcemap Explorer

Practical guides

Detected by Sourcemap Explorer

When a bundle ships sourcemaps, we read the embedded package.json for @upstash/redis and report the precise version. Without sourcemaps, an import / require in the page's scripts is enough to flag it.

Install free on Chrome