Infrastructure
Edge function
Code that runs on CDN servers near the user instead of in one central region.
An edge function is a serverless function that executes at the 'edge' — the same globally distributed locations a CDN uses — so it runs just milliseconds from the visitor. That makes it great for lightweight, latency-sensitive work: auth checks, redirects, A/B tests, or personalizing a page right before it loads. The catch is that edge runtimes are stripped down (short execution limits, no full Node.js APIs, awkward with direct database connections), so it's not where you run a heavy backend. Example: reading a user's cookie and redirecting logged-out visitors before the page ever renders.