Cloudflare Demo Shop

Workers — Edge Computing

Serverless JavaScript, TypeScript, Python, and WASM running in every Cloudflare location worldwide. Cold starts measured in milliseconds. Pay per request, not per idle hour.

Why is your code running in one region when your users are everywhere?

Centralized serverless (AWS Lambda, GCP Functions) runs in a single region. Users in other regions pay round-trip latency on every request. Cold starts add hundreds of milliseconds because containers have to spin up. Pricing models charge for memory you reserved, not memory you used. Building globally-fast applications means juggling multi-region deployments, custom edge caching, and complex routing — when really you just want to run a function close to the user.

How it fits together

Diagram coming soon

Architecture diagram for this solution will be added here.

How Cloudflare solves it

Common questions

What can't I do in a Worker?
Workers can't open raw TCP sockets to non-HTTP services (use Hyperdrive for databases, TCP/UDP sockets for specific cases). They have a 30s CPU time limit per invocation (configurable up to 5 min on paid plans). They can't write to a filesystem (use R2 or KV). Outside those edges, anything you'd build on Node.js you can build on Workers.
How is this different from AWS Lambda@Edge or CloudFront Functions?
Lambda@Edge runs in CloudFront regional edge caches (a dozen or so locations) and has multi-second cold starts. CloudFront Functions runs everywhere but only allows 1ms of CPU and very limited capabilities. Workers runs everywhere AND has 30s of CPU budget AND has full JS runtime AND has bindings to KV/R2/D1/AI. It's a category beyond what edge functions offered until recently.
Can Workers talk to my existing origin or database?
Yes. Workers can fetch any URL (your origin in AWS, your SaaS API, anywhere). For databases, Hyperdrive provides pooled, accelerated connections to Postgres/MySQL from Workers without exhausting connection limits.
What about long-running tasks or scheduled jobs?
Workflows (durable execution) handle long-running multi-step tasks with automatic retries. Cron Triggers run Workers on a schedule. Queues let one Worker enqueue work that another Worker consumes. All built into the platform.

Try it live

This site itself is built on Workers/Pages — but here's a quick LLM call running via Workers AI through this site's existing Worker pipeline.

Send a prompt below. With RAG off, the request goes browser → /api/chat → AI Gateway → Workers AI (Llama 3.3 70B). With RAG on, it goes browser → /api/aboutme-rag → AI Search (AutoRAG) → Vectorize + R2 → Workers AI.

Routed via AI Gateway Routed via AI Search (AutoRAG)

Error

Docs & blogs

← Back to all solutions