vercel-edge-functions

Solid

Build and deploy Vercel Edge Functions for ultra-low latency at the edge. Use when creating API routes with minimal latency, geolocation-based routing, A/B testing, or authentication at the edge. Trigger with phrases like "vercel edge function", "vercel edge runtime", "deploy edge function", "vercel middleware", "@vercel/edge".

AI & Automation 2,266 stars 315 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Vercel Edge Functions ## Overview Edge Functions run on Vercel's Edge Network (V8 isolates) close to the user with no cold starts. They use Web Standard APIs (Request, Response, fetch) instead of Node.js APIs. Ideal for authentication, A/B testing, geolocation routing, and low-latency API responses. ## Prerequisites - Completed `vercel-install-auth` setup - Familiarity with Web APIs (Request/Response) - Node.js 18+ for local development ## Instructions ### Step 1: Create an Edge Function ```typescript // api/edge-hello.ts // Export `runtime = 'edge'` to run on the Edge Runtime export const config = { runtime: 'edge' }; export default function handler(request: Request): Response { return new Response( JSON.stringify({ message: 'Hello from the Edge!', region: request.headers.get('x-vercel-ip-city') ?? 'unknown', timestamp: Date.now(), }), { status: 200, headers: { 'Content-Type': 'application/json' }, } ); } ``` ### Step 2: Edge Function with Geolocation Vercel injects geolocation headers into every edge request: ```typescript // api/geo.ts export const config = { runtime: 'edge' }; export default function handler(request: Request): Response { const city = request.headers.get('x-vercel-ip-city') ?? 'unknown'; const country = request.headers.get('x-vercel-ip-country') ?? 'unknown'; const region = request.headers.get('x-vercel-ip-country-region') ?? 'unknown'; const latitude = request.headers.get('x-vercel-ip-lat...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category