---
type: note
tags: [code, concept, definition, note]
created: 2026-01-16T11:42:13.29+00:00
updated: 2026-04-06T11:04:59.377235+00:00
---# what is an edge function?

An edge function is a small piece of code that runs close to the user, on a distributed network of servers (“the edge”) rather than on one central origin server.

The point is to reduce latency and give you programmatic control over requests before they hit your main backend.

What edge functions are typically used for

Common, practical use cases:

Request routing

Send users to different backends based on location, device, or cookies.

Authentication / access control

Check tokens before letting a request reach your server.

A/B testing

Split traffic at the edge rather than inside your app.

Personalization

Rewrite pages or headers per user without touching your main app.

Caching logic

Decide what can be served instantly vs. what needs backend processing.

Security filtering

Block bots, bad IPs, or malicious requests early.

Notice something important:
👉 These are mostly traffic-control and policy decisions, not heavy application logic.




---
**Keywords:** code, concept, definition, note
