We’re pleased to announce that Edge Functions is now available in public beta on the Netlify platform. Edge Functions enables you to run serverless JavaScript/TypeScript functions right from Netlify’s Edge network. It’s a full runtime environment, with complete control to transform requests and responses, stream server rendered content, or even run an entire application—all right from the network edge.
Because Edge Functions is built on Deno, an open source, standards-based runtime, it works out-of-the-box with web frameworks that support these capabilities. And because it’s available from the Netlify platform, it’s a seamless part of the powerful workflow you already know. You use it the same way you do Netlify’s other serverless capabilities. They’re built, deployed, and versioned right alongside your frontend code.
You may recall that we took a first swing at this over a year ago with a product called Edge Handlers. However, we learned as developers tested it in the wild, that it wasn’t moving the developer experience forward. It suffered from the same flaws of 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 that transform content and responses using familiar web standard APIs.
As destiny would have it, at the same time we were considering our new path forward, Deno was establishing itself as the new open standard for JavaScript and TypeScript runtimes, empowering developers to leverage the JavaScript primitives they already know, like Request
and Response
, and the power of Deno’s APIs. It was a perfect match for Netlify and the idea for Edge Functions was born.
Edge Functions is a clean-sheet rewrite for Netlify. They work as their own endpoints, enabling:
- streaming edge rendering
- React Server Components
- content rewrites
- user redirection
- A/B testing
- OAuth authentication
- geolocation
- localization/globalization
- and more!
And even without writing your own edge functions, you can easily take advantage of the latest server-side rendering (SSR) and middleware features from frameworks like Astro, 11ty, Hydrogen, Next.js, Nuxt, Remix, and SvelteKit.
Getting Started
Writing your first Edge Function is as easy as adding a hello.js
to netlify/edge-functions
in your repository:
export default () => new Response("Hello world")
and registering it in your netlify.toml
:
[[edge_functions]]
function = "hello"
path = "/test"
Check out more examples here