Installation
Import directly from a CDN:- esm.sh (Recommended)
- Specific Version
- deno.land/x
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
- From Environment
- With Credentials
UPSTASH_REDIS_REST_URLorKV_REST_API_URLUPSTASH_REDIS_REST_TOKENorKV_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
- Go to your project settings
- Navigate to Environment Variables
- Add:
UPSTASH_REDIS_REST_URL: Your Redis REST URLUPSTASH_REDIS_REST_TOKEN: Your Redis REST token
2
Local Development (.env)
Create a Load it using:
.env file: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 usingfromEnv())
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:Platform Detection
The SDK detects Deno and reports appropriate telemetry. To disable:Related
- Deno Example - Complete example on GitHub
- Deno Deploy Documentation - Official Deno Deploy docs
- Configuration - Complete configuration reference