Skip to main content
The Upstash Redis SDK works seamlessly with Deno and Deno Deploy without any additional configuration.

Installation

Import directly from a CDN:
Using @latest ensures you always get the newest version. For production, consider pinning to a specific version.

Quick Start

1

Import the SDK

2

Create a Redis instance

This reads from:
  • UPSTASH_REDIS_REST_URL or KV_REST_API_URL
  • UPSTASH_REDIS_REST_TOKEN or KV_REST_API_TOKEN
3

Use Redis in your handler

Configuration Options

Deno uses the Node.js implementation, supporting all standard configuration options:

Using fromEnv() with Options

Complete Example

Environment Variables

Set environment variables for your Deno Deploy project:
1

Via Deno Deploy Dashboard

  1. Go to your project settings
  2. Navigate to Environment Variables
  3. Add:
    • UPSTASH_REDIS_REST_URL: Your Redis REST URL
    • UPSTASH_REDIS_REST_TOKEN: Your Redis REST token
2

Local Development (.env)

Create a .env file:
Load it using:
3

Via CLI

Permissions

Deno requires explicit permissions. Your script needs:
  • --allow-net: Required for HTTP requests to Upstash Redis
  • --allow-env: Required for reading environment variables (when using fromEnv())

Deployment to Deno Deploy

1

Install deployctl

2

Deploy your project

3

Set environment variables

Use the Deno Deploy dashboard to add your UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.

Type Safety

The SDK includes TypeScript definitions. Deno will automatically use them:

Testing

Example test file:
Run tests:

Platform Detection

The SDK detects Deno and reports appropriate telemetry. To disable:
Or set the environment variable: