Skip to main content

Deno Deploy

This is a step-by-step guide on how to use Upstash Redis to create a view counter in your Deno deploy project.

Create a database

Create a Redis database using Upstash Console or Upstash CLI. Select the global to minimize the latency from all edge locations. Copy the UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN for the next steps.

Create a Deno deploy project

Go to and create a new playground project.

2. Edit the handler function

Then paste the following code into the browser editor:

import { serve } from "";
import { Redis } from "";

serve(async (_req: Request) => {

if( ! _req.url.endsWith("favicon.ico") ) {
const redis = new Redis({
url: '',
token: 'AXV0NzFjNjQtZjg1Yy00YTgdfg765tyjhZDg3MmUyYmQ6765MDg',

const counter = await redis.incr("deno-counter");
return new Response(JSON.stringify({ counter }), { status: 200 });


3. Deploy and Run

Simply click on Save & Deploy at the top of the screen.