Edge vs Node.js Runtime

Two Runtimes

Node.js runtime (default)Edge runtime
APIsAll Node.js APIs and npm packagesWeb APIs only (fetch, Request, crypto.subtle)
Where it runsYour server / serverless function in one regionMany locations close to users
Cold startSlowerVery fast
Database drivers / PrismaYesOnly HTTP-based drivers
Typical usePages, actions, most route handlersSimple redirects, geolocation, A/B, small APIs

Choosing

// app/api/geo/route.ts
export const runtime = 'edge';

export function GET(req: Request) {
  const country = req.headers.get('x-vercel-ip-country') ?? 'IN';
  return Response.json({ country, currency: country === 'IN' ? 'INR' : 'USD' });
}

Note: Edge is not automatically faster: if your database is in Mumbai, an edge function in Frankfurt still waits for Mumbai. Put compute close to your data. In Next.js 16 middleware (proxy.ts) runs on Node.js by default.