• DevOps
  • Serverless

Netlify chooses Deno rather than Node.js to power new Edge Functions

Netlify chooses Deno rather than Node.js to power new Edge Functions
deno

Netlify, a company which offers a hosted platform for websites built with Jamstack (Javascript, API and Markup) architecture, has introduced a public beta of Edge Functions, for server-side logic that runs on an Edge network for low latency.

Edge functions replaces a preview offering called Edge Handlers, which the company said failed to meet its goals. “It suffered from the same flaws as other proprietary edge compute offerings that don’t integrate well with today’s modern web frameworks. It was also clear that you need much more than just programmable routing at the edge. You need full serverless functions,” said Netlify Staff Product Manager Joey Aiello in a post today.

A Netlify Edge Function

Edge Functions are built on Deno, a project co-authored by Ryan Dahl, the creator of Node.js, to fix “design mistakes in Node”, as Dahl described it. Deno 1.0 appeared in May 2020, and the project has attracted increasing attention though usage is small compared to that of Node, which is deeply embedded in the development process for many projects. Deno has built in support for TypeScript and is coded in Rust.

Why Deno rather than Node for Edge Functions? “As a runtime that is built around security and isolation, Deno is much better suited for the task of running multi-tenant code at the network edge,”  Aiello told DevClass. “Furthermore, Deno replaces Node-specific APIs with standard web APIs, so it’s easy for web frameworks to use server-side rendering for the same code that they may have previously run in the client’s browser. This is why so many web frameworks have started building features that use Deno natively. And that’s how we’ve been able to validate seven different frameworks for Netlify Edge Functions at launch.”

Those seven frameworks are Astro, Eleventy, Hydrogen (from Shopify), Next.js, Nuxt, Remix and SvelteKit.

Edge Functions are one of several serverless options on Netlify’s platform, the others being Netlify Functions (built on AWS Lambda), asynchronous Background Functions, and Scheduled Functions. Netlify CEO Matt Biilmann described Edge Functions as a “programmable, streaming edge layer” that should enable high performance dynamic content. Other uses are for A/B testing, OAuth authentication, localization, and hosting React Server components.