← Glossary·Build & hosting
Edge Function
Also known as: edge runtime · edge compute
A serverless function that runs at the CDN edge instead of a centralized region. Lower latency, smaller runtime.
An edge function is server-side code that runs in a lightweight runtime distributed across the CDN’s points of presence — physically close to the user instead of in a single data center. Vercel, Cloudflare Workers, and Deno Deploy all offer edge runtimes for the same shape of compute.
The headline win is latency: a user in Tokyo hitting an edge function gets a response from a Tokyo POP rather than a round trip to Virginia. The headline cost is runtime constraints: edge functions typically run V8 isolates rather than full Node.js, so Node-only APIs (most of `node:fs`, certain crypto operations, large npm packages) are unavailable.
Edge functions are the right tool for short, latency-sensitive work: A/B test routing, header-based personalization, lightweight authentication checks, simple API gateways. They’re the wrong tool for heavy compute, large dependencies, or anything that needs a database connection pool.