Cloudflare is a CDN, DNS, and edge-computing platform built and run by Cloudflare Inc., offered as a freemium service with a generous free tier alongside paid plans. It ranks #12 among cloud/dev tools in usage surveys at roughly 20.1% share, and its network sits in front of a large share of all websites on the internet. Developers use it to speed up and protect sites (caching, DDoS mitigation, DNS) and to run serverless JavaScript at edge locations close to users via Cloudflare Workers.
Cloudflare Workers run plain JavaScript (or WASM) at edge locations, handling a request before it ever reaches an origin server.
export default {
async fetch(request, env, ctx) {
const url = new URL(request.url);
// simple edge routing + cached JSON response
if (url.pathname === '/api/hello') {
return Response.json({ message: 'Hello from the edge' });
}
return new Response('Not found', { status: 404 });
}
};
Point your domain's nameservers at Cloudflare for free CDN/DNS, or use the Wrangler CLI to build and deploy a Worker.
# install the Wrangler CLI
npm install --global wrangler
# log in and scaffold a new Worker project
wrangler login
wrangler init my-worker
# deploy it to Cloudflare's edge
wrangler deploy