Netlify Edge Functions
Netlify Edge Functions are serverless functions built on the Deno runtime that execute at edge locations across Netlify's global network, allowing developers to modify requests and responses — such as personalization, redirects, and A/B…
Definition
Netlify Edge Functions are serverless functions built on the Deno runtime that execute at edge locations across Netlify's global network, allowing developers to modify requests and responses — such as personalization, redirects, and A/B testing — with low latency close to the visitor.
Overview
Netlify Edge Functions let developers run TypeScript or JavaScript code that intercepts and modifies HTTP requests and responses before they reach a static site or serverless function, executing at edge locations distributed globally rather than a single origin region. Unlike Netlify's standard Functions (which run on AWS Lambda in a specific region), Edge Functions are powered by Deno, a secure-by-default JavaScript/TypeScript runtime, giving them fast cold starts and access to modern Web APIs without a Node.js dependency footprint. Edge Functions are declared either via a configuration file (`netlify.toml`) mapping URL paths to function files, or using in-source configuration that exports a `config` object specifying a `path` pattern directly in the function file. Each function receives the incoming `Request` and a `Context` object exposing metadata like the visitor's geolocation, IP, and cookies, and can either transform the response, short-circuit with a custom response (e.g., a redirect or an A/B test variant), or pass the request through to the origin using `context.next()`. Because Edge Functions run before Netlify's CDN cache and origin, they are particularly well suited to request-path logic that needs to run on every visit — geolocation-based content, authentication gating, feature flagging, and dynamic redirects — without needing a full server round-trip. They complement rather than replace Netlify's standard serverless Functions, which remain the better choice for longer-running, more compute- or dependency-heavy backend logic. As a Deno-based runtime, Edge Functions support native TypeScript, npm compatibility via Deno's npm specifier support, and a security model that requires explicit permissions for filesystem, network, and environment access, aligning with the broader move among edge platforms toward lightweight, standards-based JavaScript runtimes.
Key Features
- Runs on Deno, giving fast cold starts and native TypeScript support
- Executes at edge locations globally, ahead of CDN cache and origin
- Configured via `netlify.toml` or in-source `config` exports with path patterns
- Provides request Context with geolocation, IP, and cookie data
- Can transform, redirect, or short-circuit responses before they reach origin
- Complements (not replaces) Netlify's standard AWS Lambda-based Functions
- Deno's npm compatibility allows many existing npm packages to run
- Well suited to personalization, feature flagging, and geo-based logic
Use Cases
Alternatives
Frequently Asked Questions
From the Blog
Python Functions Explained for Beginners
Functions are named, reusable blocks of code — learn to define them, pass arguments, and return values.
Read More AI & TechnologyWhat Is Edge AI and Why It Is Growing
Edge AI runs machine learning directly on devices instead of the cloud, cutting latency, protecting privacy, and working offline — key to its rapid growth.
Read More Cloud & CybersecurityServerless Computing Explained for Beginners
Serverless lets you run code without managing servers, paying only when it runs and scaling automatically. Learn how functions, triggers, and FaaS work here.
Read More AI & TechnologyWhat Are Activation Functions in Neural Networks
Activation functions add non-linearity to neural networks, letting them learn complex patterns instead of behaving like a simple linear model. Here's how they work.
Read More