What is Serverless and Edge Runtime?

May 4, 2025

serverlessedge runtimeweb developmentcloud computing

Hey friends 👋,

If you're a web developer like me - working with React, Node, or the MERN stack - you've probably come across words like "serverless" and "edge runtime." At first, these terms confused me too, so I decided to dig in and write this simple explanation.


1. What's a Server?

Whenever someone visits your website or hits your API, a computer somewhere (called a server) handles that request and sends back a response.

In the traditional way of building backends, we:

  • Set up servers (like with Node.js + Express)
  • Host them on platforms like Heroku or AWS
  • Manage them ourselves (scale, crash handling, updates)

It's powerful, but takes time and energy.


2. What is Serverless?

Now here's the twist:

Serverless means you don't manage servers yourself. You just write small functions, and a cloud platform runs them for you — only when they're needed.

It's like magic. You write a function like:

export default function handler(req, res) {
  res.json({ message: "Hello World" });
}

And platforms like Vercel, Netlify, or Cloudflare Workers take care of running it on-demand. You don't pay for idle time, and it scales automatically.

Example

Let's say you want to build:

GET /api/hello returns "Hello from my app"

Instead of creating a full Express server, you can write just this one function and deploy it as a serverless function.

export default function handler(req, res) {
  res.json({ message: "Hello from my app" });
}

Then, you deploy it to a serverless platform like Vercel or Netlify. They handle everything for you.

Done. No backend boilerplate, no server setup. It's fast and clean.


3. What is Edge Runtime?

This is where things get even cooler.

Edge Runtime means your serverless functions run from locations closest to the user — not from a single centralized server.

Cloud platforms have data centers all around the world. With edge runtime, your code runs in whichever location is closest to the person visiting your site.

Faster response time = better user experience.

Think of it like this:

  • Normal Serverless: You have one big pizza shop in one city. Everyone waits for their pizza from that city.
  • Edge Runtime: You have hundreds of mini pizza stalls around the world. Each customer gets their pizza from the nearest stall - fast and hot.

4. Who Gives You This Power?

Some platforms that support edge runtime:

  1. Cloudflare Workers
  2. Vercel Edge Functions
  3. Deno Deploy

These are amazing if you want to build fast, global APIs, authentication handlers, redirects, or even entire websites.


5. What Are the Benefits?

  • You can create backend endpoints without Express or servers
  • Your app loads faster globally
  • You save money — you only pay when your code runs
  • No more worrying about server crashes or scaling

⚠️ But Wait:

While edge functions are amazing, they do have some limits:

  • No access to Node.js modules like fs or net
  • Can't do heavy tasks like image processing (unless supported)
  • DB connections might have latency, since your DB may not be close to the edge

Still, for most lightweight APIs, auth, caching, and middleware logic - they're perfect.


6. Conclusion

Serverless = you don't manage server
Edge Runtime = your code runs close to users
serverlessedge runtimeweb developmentcloud computing