Skip to content
Glossary · Hosting and delivery

Edge function

Also called edge compute, edge worker.

Definition

A small piece of server code that runs on a CDN's servers around the world, close to the user, instead of in one central region.

Last updated

What it is.

Edge functions run in many locations at once and handle a request before, or instead of, your main server. They usually run on lightweight runtimes, start very quickly and have limits on run time, memory and which libraries can be used.

They are a kind of serverless compute that sits inside the CDN. Good uses include redirects, auth checks, A/B routing, personalising cached pages and simple APIs.

Why it matters

Running logic near the user cuts delay for every request it handles. But if the function has to call a database in one far-away region, the time saved is lost on that call. Edge is a fit for logic that needs little data or data that is copied close by.

In a product build

We put routing, auth checks and caching logic at the edge, and keep data-heavy work next to the database. Edge code is kept small and tested against the platform's runtime limits, and logs from every location feed into the same observability tools.

Watch out

Common mistakes.

  1. 01

    Calling a single-region database from every edge location, which makes it slower than before.

  2. 02

    Expecting full server libraries to work in a limited runtime.

  3. 03

    Hiding business logic in edge code nobody remembers is there.

Related

Related terms.

Building something with this? Ask an engineer.

OceanLab designs and builds production software. Tell us what you are planning and we will reply with how we would approach it.

OceanLab

Enterprise Software Engineering - Human + AI

Languages

Locations

Global Headquarters

21 Merchant Road, 3rd Floor, Singapore 058267

Main corporate office and leadership operations

North America Office

548 Market Street, PMB 12472, San Francisco, CA 94104

Client operations and business development

India Office

402 Shivalik Shilp II, SG Highway, Ahmedabad 380015

Engineering and delivery center

© 2026 - Copyright. All Rights reserved OceanLab