
I deployed my first Cloudflare Worker in 2023 because I wanted to block bot traffic before it hit my origin server. The Worker saved me from rewriting application logic - I just added 15 lines of JavaScript and the problem went away.
That experience convinced me edge computing is worth understanding. Not for every use case, but for a specific class of problems, it's the cleanest solution available.
"Edge" just means running code closer to your users. Instead of all requests going to one server in us-east-1, edge functions run in data centers spread around the world. A user in Tokyo gets served from a node in Tokyo. A user in London from London. The distance the request travels is much shorter.
Edge is not about replacing your database or doing heavy computation. It's about handling specific tasks - auth, routing, simple transforms - in a place where latency to the user is minimal.
The main providers are Cloudflare Workers, Vercel Edge Functions, and Deno Deploy. They all share similar constraints: tiny memory limits, no filesystem, a V8 isolate runtime instead of full Node.js, and cold starts measured in milliseconds rather than seconds.
After two years of deploying edge functions in production, these are the ones I reach for without hesitation:
JWT Token Validation - Verifying a token before the request hits your origin. A 401 response from the edge is 30ms. The same validation at your origin adds a full round-trip. For high-traffic APIs, this compounds.
A/B Testing and Feature Flags - Assigning users to variants before any server-side rendering. No JavaScript flickering, no delayed layout shifts. The edge makes the routing decision and the user gets a consistent experience from first byte.
Geolocation Routing - Redirecting to regional endpoints, blocking access by country, or serving localized content without application code changes. The request headers from Cloudflare include geo data for free.
Bot Detection - Pattern-matching on request headers and behavior. Legitimate users pass through instantly. Bots get blocked before they hit your server.
Response Caching with Smart Invalidation - Caching API responses at the edge with granular control over what triggers a cache purge. Much faster than waiting for your origin to respond on every request.
export default {
async fetch(request) {
const url = new URL(request.url);
// Only check protected routes
if (!url.pathname.startsWith('/api/')) {
return fetch(request);
}
// Validate at the edge before touching origin
const token = request.headers.get('Authorization');
if (!token || !isValidToken(token)) {
return new Response(
JSON.stringify({ error: 'Unauthorized' }),
{ status: 401, headers: { 'Content-Type': 'application/json' } }
);
}
// Pass through to origin
return fetch(request);
}
};
function isValidToken(token) {
// JWT signature check - stateless, no database needed
const [, payload] = token.replace('Bearer ', '').split('.');
const decoded = JSON.parse(atob(payload));
return decoded.exp > Date.now() / 1000;
}
This runs before any origin request. Unauthenticated requests never touch my server.
What's the main advantage of running code at the edge?
| Good for Edge | Bad for Edge | |
|---|---|---|
| Request validation | Stateless token checks | Database session lookups |
| Authentication | JWT verification | OAuth flows with redirects |
| Routing logic | Geolocation, A/B flags | Complex business rules |
| Compute | Simple transforms, header manipulation | Image processing, ML inference |
Nobody tells you these things until you've already hit them:
No Node.js APIs - V8 isolates don't give you the full Node runtime. fs, path, crypto (the Node version), and most native modules won't work. Check the Cloudflare docs for what's available.
npm compatibility is partial - Most npm packages assume a Node environment. Some work. Many don't. You find out at deploy time.
Database connections don't persist - You can't keep a database connection warm between requests. Every invocation is cold from a connection standpoint. Use connection poolers (PlanetScale, Neon, Supabase) that are built for this.
Memory limits are strict - 128MB typical. I once tried to use a reasonably-sized WASM module in a Worker and hit the limit immediately.
Debugging is harder - console.log goes to a dashboard, not your terminal. Local development works but isn't always faithful to production behavior.
People try to move their entire application to the edge. It doesn't work. Your database is in one region. Your heavy computation needs real memory. The edge is a filter and router, not a replacement for your backend.
The mental model that works: your origin server handles everything it always did. The edge layer intercepts specific requests and handles them without the full round-trip. These two things work together - they're not alternatives.
Start with one endpoint. Pick something stateless - a rate limiter, an auth check, a bot filter. Deploy it to Cloudflare Workers or Vercel Edge, measure the before/after latency, and see if it matters for your use case.
For most web apps, the biggest wins from edge computing come from the three simple use cases: auth validation, A/B routing, and response caching. Start there before you try anything exotic.
Edge Computing PerformanceClean AI CLI logs, build cron expressions, decode JWTs, and calculate chmod permissions offline.

Exploring how Edge Computing has matured beyond CDNs, powering modern applications from real-time AI inference to distributed multiplayer gaming.
Read more
Exploring how WebAssembly (Wasm) and WASI 0.2 are redefining edge computing with microsecond cold starts, capability-based security, and Rust components.
Read more
A comprehensive architectural comparison of serverless computing and edge runtimes: latency profiles, cold start mitigation, data gravity, and cost tradeoffs.
Read more