Coyier’s Edge Law

Brian Rinaldi: Does the Serverless Edge Live Up to the Hype?

Your edge function – or middleware as some frameworks call it – will be called when the request comes in before it hits the origin server. It can modify that request, redirect it – so no need for slower server-side or client-side redirects or you can even handle access and authentication at this point.

The edge function can even fulfill the response itself. For example, if you have static assets like HTML, CSS, images and more cached on the edge, you can simply respond without hitting the origin server.

I wasn’t aware that serverless functions are generally regarded as not having lived up to their hype. I’m still pretty hyped on it. Nearly every project I do, major or minor, uses them in some way.

But remember edge functions are a distinct form of serverless function. They don’t have an origin, they execute geographically close to users, on computers connected to fat internet pipes specifically designed to run code quickly. Hype!

I wonder how a sentence like this will live up over time. Let’s call it Coyier’s Edge Law:

Any fetch request that client-side JavaScript would make immediately as the page loads should be an edge function.

There is a 100% chance that an edge function will perform that fetch faster than your little hand computer on domestic internet will and give you the opportunity to return more “Real HTML.”



I work on CodePen! I'd highly suggest you have a PRO account on CodePen, as it buys you private Pens, media uploads, realtime collaboration, and more.

Get CodePen PRO

One response to “Coyier’s Edge Law”

  1. Thanks so much for the link! I think I ultimately do answer the question affirmatively. I do feel for web devs the promise of reduced latency can be overstated due to considerations around data, but other than that I think it is really exciting.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to Top ⬆️