• Stars
    star
    655
  • Rank 68,765 (Top 2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 3 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

HTTP based Redis Client for Serverless and Edge Functions

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

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://deno.land/x/upstash_redis/mod.ts";

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('key2', 'value2', {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 Deno

Database

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

Running tests

UPSTASH_REDIS_REST_URL=".." UPSTASH_REDIS_REST_TOKEN=".." deno test -A

Telemetry

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

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

UPSTASH_DISABLE_TELEMETRY=1

More Repositories

1

ratelimit-js

Rate limiting library for serverless runtimes
TypeScript
1,633
star
2

upsy

Your new mate on Discord and Slack. Powered by AI.
TypeScript
190
star
3

semantic-cache

A fuzzy key value store based on semantic similarity rather lexical equality.
TypeScript
184
star
4

roadmap

Build and deploy a roadmap voting app for your project/product.
TypeScript
169
star
5

rag-chat

Batteries included SDK for RAG development.
TypeScript
148
star
6

qstash-js

Message queue for serverless
TypeScript
145
star
7

degree-guru

AI chatbot for expert answers on university degrees
TypeScript
128
star
8

redis-examples

Sample applications implemented with serverless Redis
JavaScript
126
star
9

claps

Adds clap button (like medium) to any page for your Next.js apps.
TypeScript
104
star
10

kafka-js

HTTP based Kafka Client for Serverless and Edge Functions
TypeScript
100
star
11

feedback

Feedback Component for Next.js
TypeScript
90
star
12

queue

SQS like stream based queue on top of Redis
TypeScript
81
star
13

edge-flags

Feature flags for edge functions
TypeScript
69
star
14

faq-generator

Generate FAQ for your documentation. Powered by OpenAI, Vercel and Upstash.
TypeScript
59
star
15

chatbox

TypeScript
58
star
16

vector-js

Upstash Vector JS SDK
TypeScript
39
star
17

hackerdigest

Stay in the loop without the time sink. 🚀
TypeScript
36
star
18

examples

Examples how to use Upstash with various tech
TypeScript
29
star
19

query

Secondary indexing and query capabilities for Upstash Redis
TypeScript
29
star
20

waiting-room

A Waiting Room for your website with Cloudflare Workers and Serverless Redis
JavaScript
28
star
21

latency-comparison

Latency Comparison among Serverless Databases: DynamoDB, FaunaDB, MongoDB, Cassandra, Firestore and Upstash
JavaScript
26
star
22

redis-py

HTTP based Python Redis Client for Serverless and Edge Functions
Python
24
star
23

terraform-provider-upstash

Go
22
star
24

cli

Upstash CLI for serverless Redis and Kafka
TypeScript
20
star
25

ratelimit-py

Rate limiting library for serverless runtimes in Python
Python
20
star
26

react-ui

Various react components from our console
TypeScript
19
star
27

lock

TypeScript
18
star
28

core-analytics

Low level analytics building blocks for redis
TypeScript
15
star
29

vercel-note-taker-slackbot

Serverless Slackbot with Vercel
JavaScript
15
star
30

qstash-examples

TypeScript
11
star
31

qstash-py

Python SDK for Upstash QStash
Python
11
star
32

pulumi-upstash

Python
10
star
33

docs

Upstash documentation
MDX
9
star
34

vector-py

Upstash Vector Python SDK
Python
9
star
35

semantic-cache-py

A fuzzy key value store based on semantic similarity rather lexical equality. (python version)
Python
8
star
36

upstash-web

MDX
8
star
37

kafka-examples

Sample applications implemented with Serverless Kafka
JavaScript
8
star
38

stylegenie

JavaScript
7
star
39

serverless-birthday-slackbot

Python
6
star
40

vector-go

Upstash Vector Golang SDK
Go
6
star
41

qstash-go

Go SDK for Upstash QStash
Go
5
star
42

jstack

Confidently ship high-performance, low-cost Next.js apps
TypeScript
4
star
43

rdb

RDB file parser
Go
4
star
44

upstash-cloudformation

Cloudformation private types to provision Upstash infrastructure
TypeScript
3
star
45

upstash-heroku-todo-app

JavaScript
3
star
46

upstats

TypeScript
3
star
47

edge-caching-benchmark

JavaScript
2
star
48

sponsorship

1
star
49

purple-squirrel

TypeScript
1
star
50

transcriber

TypeScript
1
star
51

next-template

TypeScript
1
star
52

redis-connection-benchmark

benchmark the overhead of a Redis connection
JavaScript
1
star
53

QuickApply

A chatbot which will welcome job candidates, do prescreening and answer questions.
JavaScript
1
star
54

kafka-connectors

Kafka Connect with Upstash Kafka®
Shell
1
star
55

issues

Issue Tracker for Upstash
1
star