Skip to main content
We support various platforms, such as nodejs, cloudflare and fastly. Platforms differ slightly when it comes to environment variables and their fetch api. Please use the correct import when deploying to special platforms.

Node.js / Browser

Examples: Vercel, Netlify, AWS Lambda If you are running on nodejs you can set UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN as environment variable and create a redis instance like this:
If you are running on nodejs v17 and earlier, fetch will not be natively supported. Platforms like Vercel, Netlify, Deno, Fastly etc. provide a polyfill for you. But if you are running on bare node, you need to either specify a polyfill yourself or change the import path slightly:

Cloudflare Workers

Cloudflare handles environment variables differently than Node.js. Please add UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN using wrangler secret put ... or in the cloudflare dashboard. Afterwards you can create a redis instance:

Fastly

Fastly introduces a concept called backend. You need to configure a backend in your fastly.toml. An example can be found here. Until the fastly api stabilizes we recommend creating an instance manually:

Deno

Examples: Deno Deploy, Netlify Edge