Overview
Cloudflare Workers is an edge computing platform designed to run developers' code directly on Cloudflare's global network of over 300 cities in more than 120 countries. This architecture positions compute resources geographically closer to end-users, which can reduce latency for web applications and APIs by processing requests at the network edge rather than routing them to a centralized origin server. The platform supports a variety of programming languages, including JavaScript, TypeScript, Rust, Python, and Go, leveraging the WebAssembly (Wasm) runtime for compiled languages and the V8 JavaScript engine for script-based functions.
Workers are suitable for a range of use cases, from transforming HTTP requests and responses, to building full-stack applications. It functions as a serverless platform, meaning developers do not manage underlying infrastructure like servers or operating systems. Instead, they deploy code, and Cloudflare handles scaling, load balancing, and execution. The platform integrates with other Cloudflare services, such as Workers KV (a key-value store), Durable Objects (stateful serverless primitives), R2 Storage (object storage), and Cloudflare D1 (a serverless SQL database), enabling the construction of entire applications that operate at the edge.
Target users for Cloudflare Workers include developers building high-performance web applications, API backends requiring low latency, and event-driven architectures where rapid response times are critical. Its capabilities also extend to content personalization, A/B testing, and security enhancements by allowing custom logic to run before traffic reaches an origin server. The platform's integrated tooling, including the Wrangler CLI for local development and deployment, aims to provide a streamlined developer experience. For example, similar to Vercel Edge Functions, Cloudflare Workers emphasize rapid deployment and execution close to the user.
Key features
- Global Edge Network Execution: Code runs across Cloudflare's network in over 300 cities, minimizing latency by executing logic close to users.
- Multi-language Support: Supports JavaScript, TypeScript, Rust, Python, and Go, enabling developers to use their preferred languages for edge functions.
- Serverless Architecture: Eliminates server management, with automatic scaling and infrastructure handling by Cloudflare.
- Workers KV: A distributed key-value store designed for low-latency reads at the edge, suitable for caching and storing user preferences.
- Durable Objects: Provides globally consistent, stateful singletons that can manage state and coordinate interactions across the network.
- R2 Storage: S3-compatible object storage that charges no egress fees, allowing developers to store and retrieve large amounts of data at the edge.
- Cloudflare D1: A serverless SQL database built on SQLite, designed for edge applications requiring persistent storage and SQL querying.
- Cloudflare Pages: A platform for JAMstack sites and static assets, tightly integrated with Workers for dynamic functionality.
- Wrangler CLI: A command-line interface for local development, testing, and deployment of Workers projects.
- WebSockets and Streaming: Support for real-time communication and efficient handling of large data streams.
Pricing
Cloudflare Workers offers a free tier and various paid plans with increased allowances for requests, compute time, and storage.
| Plan | Requests per Month | Compute Time per Month | Workers KV | R2 Storage | Price (as of 2026-05-08) |
|---|---|---|---|---|---|
| Free Tier | 100,000 (daily limit) | 10 ms avg / 50 ms max CPU time per request | 1,000,000 reads, 100,000 writes | 1 GB storage, 1 GB data egress | Free |
| Workers Paid | 10,000,000 | 50 ms avg / 300 ms max CPU time per request | Additional reads/writes beyond free tier | Additional storage/egress beyond free tier | Starts at $5/month |
For detailed and up-to-date pricing information, refer to the Cloudflare Workers pricing page.
Common integrations
- Cloudflare Pages: For deploying static sites and JAMstack applications, allowing Workers to add dynamic functionality. Cloudflare Pages with Workers guide.
- Workers KV: A low-latency key-value store for caching and storing edge-specific data. Workers KV API reference.
- Durable Objects: For building stateful applications and managing consistent state at the edge. Durable Objects documentation.
- R2 Storage: Object storage with no egress fees, integrated for storing static assets and large files. Cloudflare R2 developer documentation.
- Cloudflare D1: A serverless SQL database for persistent data storage in edge applications. Cloudflare D1 documentation.
- Third-party APIs: Workers can fetch from and interact with any external HTTP API, such as payment gateways, authentication providers, or content management systems. Workers Fetch API documentation.
Alternatives
- Vercel Edge Functions: Serverless functions deployed globally, integrated with Vercel's platform for frontend development.
- AWS Lambda@Edge: Extends AWS Lambda to run code closer to users at CloudFront edge locations, often used for content customization.
- Fastly Compute: A serverless compute environment at the edge, offering fine-grained control over requests and responses.
- Deno Deploy: A global serverless platform for JavaScript, TypeScript, and WebAssembly, built on the Deno runtime.
- Netlify Edge Functions: Serverless functions that run on Netlify's global edge network, integrated into their build and deploy workflow.
Getting started
To get started with Cloudflare Workers, you typically use the Wrangler CLI. Below is a basic "Hello World" example in JavaScript.
// 1. Install Wrangler CLI globally
// npm install -g wrangler
// 2. Log in to Cloudflare (runs in your terminal after install)
// wrangler login
// 3. Create a new Worker project
// wrangler generate my-worker-app https://github.com/cloudflare/worker-starter-js
// cd my-worker-app
// 4. Edit src/index.js (or similar, based on starter template)
// You can also create index.js manually and add the following content:
export default {
async fetch(request) {
return new Response("Hello, Cloudflare Workers!");
},
};
// 5. Deploy your Worker
// wrangler deploy
// After deployment, Wrangler will provide a URL where your Worker is accessible.
This code defines a default export with an asynchronous fetch method, which is the entry point for handling HTTP requests in a Worker. It returns a simple HTTP response with the text "Hello, Cloudflare Workers!". For more complex applications, you can add routing logic, interact with Cloudflare's data services like KV or D1, and integrate with external APIs. Refer to the Cloudflare Workers Quickstarts for detailed guides.