AWS Lambda has cold starts. Vercel Edge Functions are tied to Vercel. Deno Deploy is Deno-only. You want serverless that's fast globally, runs standard JavaScript, and has a generous free tier.
Cloudflare Workers execute at 300+ edge locations worldwide with zero cold starts — your code runs in milliseconds, everywhere.
Free Tier
- 100,000 requests/day
- 10ms CPU time per request
- Workers KV: 100,000 reads/day, 1,000 writes/day
- R2 storage: 10 GB
- D1 database: 5 GB
Quick Start
npm create cloudflare@latest my-worker
cd my-worker && npx wrangler dev
Basic Worker
export default {
async fetch(request: Request, env: Env): Promise<Response> {
const url = new URL(request.url);
if (url.pathname === "/api/hello") {
return Response.json({ message: "Hello from the edge!" });
}
if (url.pathname === "/api/geo") {
// Cloudflare provides geo data automatically
const cf = request.cf;
return Response.json({
country: cf?.country,
city: cf?.city,
timezone: cf?.timezone,
});
}
return new Response("Not Found", { status: 404 });
},
};
KV Storage
// wrangler.toml
// [[kv_namespaces]]
// binding = "CACHE"
// id = "abc123"
export default {
async fetch(request: Request, env: Env) {
const cached = await env.CACHE.get("products", "json");
if (cached) return Response.json(cached);
const products = await fetchFromDB();
await env.CACHE.put("products", JSON.stringify(products), { expirationTtl: 3600 });
return Response.json(products);
},
};
D1 Database (SQLite at the Edge)
export default {
async fetch(request: Request, env: Env) {
const { results } = await env.DB
.prepare("SELECT * FROM users WHERE active = ? LIMIT 20")
.bind(true)
.all();
return Response.json(results);
},
};
Cloudflare Workers vs Lambda vs Vercel Edge
| Feature | Workers | Lambda | Vercel Edge |
|---|---|---|---|
| Cold starts | None | 100-500ms | None |
| Edge locations | 300+ | 30 regions | ~30 |
| Free tier | 100K req/day | 1M req/month | 100K req/month |
| Runtime | V8 isolates | Containers | V8 isolates |
| Max execution | 30s (free) | 15 min | 30s |
| KV storage | Built-in | DynamoDB | KV (via Workers) |
Choose Workers for global edge computing with zero cold starts. Choose Lambda for long-running tasks and AWS ecosystem.
Start here: workers.cloudflare.com
Need custom data extraction, scraping, or automation? I build tools that collect and process data at scale — 78 actors on Apify Store and 265+ open-source repos. Email me: Spinov001@gmail.com | My Apify Actors
Top comments (0)