Definition
An edge function is server-side code that runs at a CDN edge location physically close to the visitor, instead of at a single origin server. Platforms like Cloudflare Workers, Vercel Edge Functions, Netlify Edge Functions and Deno Deploy execute code in a lightweight V8 isolate or Deno runtime at hundreds of points of presence worldwide, so a request never travels back to a central origin for simple personalisation, redirects, authentication checks, or A/B-test routing. Deployment is typically a small JavaScript or WebAssembly module pushed globally within seconds. The trade for that speed is a constrained runtime: edge functions cannot use the full Node.js API, are time-limited (often a few seconds of CPU time or less depending on plan), and have small memory budgets, commonly 128MB or less, compared with traditional serverless functions. They suit latency-sensitive logic run on every request, not heavy computation, long jobs, or large dependency trees.
How it works
Edge functions execute on the same fleet of servers that serves cached content from a CDN. Code is typically deployed as small JavaScript or WebAssembly modules. Common use cases: rewriting URLs, injecting personalisation, checking auth tokens, geo-routing, image optimisation triggers.
Why it matters
For latency-sensitive logic (auth, A/B routing, edge personalisation), edge functions eliminate a round-trip to the origin and improve TTFB and Core Web Vitals globally. For heavy backend work, traditional serverless or a real server is still the better fit.