Edge Functions on Vercel: Fast by Default
Vercel Edge Functions run in V8 isolates at 100+ locations worldwide. They start in under a millisecond and are perfect for personalisation, A/B tests, and lightweight APIs.
Definition
Edge Runtime
A V8-isolate execution environment that runs at 100+ global PoPs. Cold-start time is under 1ms — orders of magnitude faster than traditional serverless functions.
How they differ from serverless functions
| Serverless | Edge | |
|---|---|---|
| Runtime | Node.js | V8 isolate |
| Cold start | ~100ms | <1ms |
| Location | One region | Global (100+ PoPs) |
| Node APIs | Full | Subset only |
When to use them
Edge Functions shine for:
- Geolocation redirects — send users to the right regional site instantly.
- A/B testing — rewrite the URL at the edge without a round-trip to origin.
- Auth middleware — validate JWTs before the request reaches your app.
- Lightweight APIs — small, fast endpoints with no database reads.
"Running code at the edge means your response is generated at the same data centre as your user."
Example: locale redirect
// middleware.ts
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
export function middleware(request: NextRequest) { const country = request.geo?.country ?? "US"; if (country === "DE") { return NextResponse.redirect(new URL("/de", request.url)); } return NextResponse.next(); }
Next.js Middleware runs on the Edge runtime by default — no extra configuration required on Vercel.