v1.25.1-canary-2
HTTP based Redis Client for Serverless and Edge Functions
Attributes
Extremely Popular
Repository
Current version released
a year ago
Versions
- v1.34.3Latest
- 1.34.3-canary-2
- 1.34.3-canary
- v1.34.2
- v1.34.1
- v1.35.0-canary
- v1.34.0
- v1.33.1-canary
- v1.33.0
- v1.32.0
- v1.31.6
- v1.31.5
- v1.31.4
- v1.31.4-canary
- v1.31.3
- v1.31.3-canary
- v1.31.2
- v1.31.2-canary
- v1.31.1
- v1.31.1-canary
- v1.31.0
- v1.30.1
- v1.30.0
- v1.29.0
- v1.28.4
- v1.28.4-canary
- v1.28.3
- v1.28.2
- v1.28.1
- v1.28.0
- v1.27.1
- v1.27.0
- v1.26.0
- v1.25.3-canary
- v1.25.2
- v1.25.1
- v1.25.1-canary-2
- v1.21.5-canary-release
- v1.25.1-canary
- v1.25.0
- v1.24.3
- v1.24.2
- v1.24.1
- v1.24.0
- v1.24.0-next.3
- v1.24.0-next.2
- v1.24.0-next.1
- v1.23.4
- v1.23.3
- v1.23.2
- v1.23.1
- v1.23.0
- v1.23.0-next.1
- v1.22.1
- v1.22.0
- v1.21.0
- v1.20.7-next.1
- v1.20.6
- v1.20.5
- v1.20.5-canary.0
- v1.20.4
- v1.20.3
- v1.20.2
- v1.20.1
- v1.20.0
- v1.20.0-canary.0
- v1.19.3
- v1.19.2
- v1.19.1
- v1.19.0
- v1.18.5
- v1.18.5-rc.0
- v1.18.4
- v1.18.3
- v1.18.2
- v1.18.2-rc.1
- v1.18.2-rc.0
- v1.18.1
- v1.18.1-rc.0
- v1.18.0
- v1.17.0
- v1.16.1-next.1
- v1.16.1
- v1.16.1-rc.4
- v1.16.1-rc.3
- v1.16.1-rc.2
- v1.16.1-rc.1
- v1.16.1-rc.0
- v1.16.0
- v1.16.0-next.3
- 1.15.1
- v1.16.0-next.2
- v1.16.0-next.1
- v1.15.0
- v1.15.0-next.1
- v1.14.0
- v1.14.0-next.1
- v1.13.1
- v1.13.0
- v1.13.0-next.1
- v1.12.0
- v1.12.0-rc.1
- v1.12.0-next.1
- v1.12.0-rc.0
- v1.11.0
- v1.11.0-next.1
- v1.10.2
- v1.10.1
- v1.10.0
- v1.10.0-next.1
- v1.9.1-next.1
- v1.9.0
- v1.9.0-next.1
- v1.8.0
- v1.7.1-next.1
- v1.7.0
- v1.6.1
- v1.6.1-next.1
- v1.6.0
- v1.5.0
- v1.4.0
- v1.4.0-next.2
- v1.4.0-next.1
- v1.3.5
- v1.3.4
- v1.3.3
- v1.3.3-alpha.1
- v1.3.3-alpha.0
- v1.3.2
- v1.3.2-alpha.2
- v1.3.2-alpha.1
- v1.3.2-alpha.0
Upstash Redis
@upstash/redis
is an HTTP/REST based Redis client for typescript, built on top
of Upstash REST API.
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.
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.
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