Serverless deployment with Deno and Netlify

In this guide, we'll show you how to deploy Deno serverless functions using Netlify.

Creating the project

You can create a new Deno project with a single command.

npx create-nx-workspace@latest denoapp --preset=@nrwl/deno

Once the command is finished, you can cd into the workspace.

cd denoapp

To serve the functions locally, run nx serve-functions and the server will start on http://localhost:8888. The Hello function is available on http://localhost:8888/api/geo.

For existing projects, see the next section, otherwise you can skip to deployment.

Configure existing projects

Skip this step if you are not configuring an existing project.

For existing workspaces, you will need to install the @nrwl/deno package.

npm i -D @nrwl/deno

Now, you can generate a Deno project.

nx g @nrwl/deno:app denoapp

You are now ready to deploy the project.

Deploying to Netlify

First, you'll need to run the generator to set up your project.

nx g @nrwl/deno:setup-serverless --platform=netlify

This will add a netlify.toml file and install the netlify-cli package. You can deploy your app with the following command.

npx netlify deploy

You will be prompted to set up the project when deploying for the first time. Once deployed, the production URL will be logged out, and you can see the Hello function by visiting https://<deploy-id>.netlify.app/api/geo.