# Edge function

**Source:** https://promtable.com/glossary/edge-function

> An edge function is a small serverless function that runs at the network edge — geographically close to the user — typically on Cloudflare Workers, Deno Deploy, Vercel Edge, or AWS Lambda@Edge.

---
An edge function is a small serverless function that runs at the network edge — geographically close to the user — typically on Cloudflare Workers, Deno Deploy, Vercel Edge, or AWS Lambda@Edge.

Edge functions run closer to users than traditional serverless functions, cutting latency by 50-150ms for global apps. They commonly handle authentication, AB testing, geolocation, rewrites, and lightweight LLM gateways. Limits: short execution time (often 30s max), limited memory, restricted Node.js compatibility (V8 isolates instead of Node), no direct file system. For AI apps in 2026 edge functions are commonly used for LLM gateway logic — auth, routing, rate limiting — while the actual LLM inference runs in a region closer to the model provider.

## When to use

- Auth, AB testing, geolocation logic.
- LLM gateway and routing.
- Lightweight personalisation.

## Common mistakes

- Trying to run heavy compute at the edge — short runtimes hurt.
- Forgetting cold-start in long-running edge regions.

## Related terms

- [cold-start](https://promtable.com/glossary/cold-start)
- [serverless-database](https://promtable.com/glossary/serverless-database)
- [ai-router-fallback](https://promtable.com/glossary/ai-router-fallback)

*Last updated: 2026-06-01*
---

Original page: https://promtable.com/glossary/edge-function
Maintained by Promtable (https://promtable.com). Content: CC BY 4.0. Cite as "Promtable — https://promtable.com/glossary/edge-function".
Contact: info@vibecodingturkey.com.