DEV Community

Cover image for Deno on ZEIT Now
Luca Casonato
Luca Casonato

Posted on • Updated on


Deno on ZEIT Now

Deno is a secure runtime for JavaScript and TypeScript. It aims to provide a productive and secure scripting environment for the modern programmer. It is built on top of V8, Rust, and TypeScript.

ZEIT Now is a deployment platform that can be used to serve static assets and lambda functions in a very simple and user friendly way. It is capable of running Node.js, Go, Ruby, Python, Rust and PHP functions.

So what happens when you combine these? A lot of good things. Starting today you can also use deno in ZEIT Now using the now-deno community runtime.

By adding just a few lines to your now.json file you can enable support for deno:

  "functions": {
    "api/**/*.ts": {
      "runtime": "now-deno@0.2.0"

note: this will use deno for all .ts files. If you are also using node functions you might want to use a different file extension and matcher for deno (e.g. api/**/*.deno.ts).

Now you can add a simple function to the api directory:

// api/hello.ts
import { APIGatewayProxyEvent, APIGatewayProxyResult, Context } from '';

export async function handler(
  event: APIGatewayProxyEvent,
  context: Context
): Promise<APIGatewayProxyResult> {
  return {
    statusCode: 200,
    body: `Welcome to deno ${Deno.version.deno} πŸ¦•`,
    headers: {
      'content-type': 'text/html; charset=utf-8',

The final step is to deploy the function by running the now command. If you do not have now installed there are instructions here.

After 10-20 seconds you should get a URL back from the now command. You can use it to view your deployed page. Just append /api/hello to run the hello.ts function. You can see what this should look like here so you can try it out.

So, within a minute we deployed a simple deno program to the cloud - that is cool right? If you want to look at or contribute to the now-deno runtime, check out this repo.


A huge thanks to the deno contributors for creating such an awesome tool. For this specific project @hayd was a huge help as he got deno running in AWS Lambdas in the first place (ZEIT Now is based on AWS Lambda). You can check out his repo here.

This post was updated on the 9th of February 2020 to reflect changes in the now-deno runtime.

Top comments (3)

ajerni profile image
ajerni • Edited

Can we serve something like this from vercel/now?

import { serve } from "";
const s = serve({ port: 8000 });
for await (const req of s) {
req.respond({ body: "Hello World - want to see this vom Vercel!\n" });

ajerni profile image

How can this be done on vercel (former Zeit)?

gr2m profile image
Gregor Martynus

Woah thanks for sharing Luca, I didn't know it is that easy to use Deno on Zeit!