Serverless Computing with Cloudflare Workers®

The Network is the Computer®

Build serverless applications on Cloudflare's global cloud network spanning 194 cities across over 90 countries. Cloudflare Workers provides a lightweight JavaScript execution environment that allows developers to augment existing applications or create entirely new ones without configuring or maintaining infrastructure.

Already a customer? Activate Today

workers illustration
"With Workers we’ve been able to push routing and caching to the edge, allowing us to scale further while improving npm's performance for millions of developers. Migrating away from VCL means we can spend more time in JavaScript, which we love."
Laurie Voss
Co-founder and Chief Data Officer at npm

Why go serverless?

Building and maintaining applications that easily scale to support spikes in demand or a global user base has generally required a large amount of both upfront engineering work and ongoing operational support. Developers were forced to spend significant time on writing supporting code rather than building the application itself. With Cloudflare Workers developers can build serverless applications that scale without needing to spend time and effort on infrastructure or operations.

"At Postmates, customer trust is the most important thing. We needed a way to do a high volume of redirects without dedicating additional internal resources. Cloudflare Workers gave us a simpler way to build flexibility and fine-grained control into our systems at the edge."
Aabhas Sharma
Infrastructure Lead at Postmates

Building serverless applications with Cloudflare Workers

Cloudflare Workers lets developers deploy serverless JavaScript applications on Cloudflare's global cloud network, where they are seamlessly scalable and closer to end users. Based on the Service Workers API, Workers receive events for every HTTP(S) request made to an application. Workers then run application logic and can make subsequent requests to the Cloudflare Cache, Cloudflare Workers KV, or an application origin to return data to the user. The location of Workers on Cloudflare's global cloud network creates the following use cases for serverless:

personalize workers

Deliver personalized user experiences

Cache and modify lightweight static HTML pages while incorporating dynamic content based on user location, device type or time of day using the Cache API. Build responses from multiple background service requests either to the Cloudflare cache, application origin, or third party APIs.

workers api responses

Increase API responsiveness

Create a flexible API gateway to aggregate responses from multiple endpoints and return as a single response, eliminating the need for each endpoint to compile individual responses. Each request can also be split into multiple parallel requests then combined into a single response.

Implement custom application security

Build conditional responses for inbound requests that can assess and subsequently block or reroute malicious or unauthorized requests. Set parameters that can identify and authorize legitimate application traffic.


addEventListener('fetch', event => {
  event.respondWith(fetchAndApply(event.request))
})

async function fetchAndApply(request) {
  if (request.headers.get('user-agent').includes('annoying_robot')) {
    return new Response('Sorry, this page is not available.',
      { status: 403, statusText: 'Forbidden' })
  }

  return fetch(request)
}

workers ab test

Improve A/B testing performance

Enable randomized page selection by intercepting inbound HTTP(S) requests and serving content requests from the Cloudflare cache to specific control and test groups.

workers onboarding

Get started quickly

Start with an extensive library of code snippets and recipes. Join the Cloudflare Workers community site to learn from other users.

Deploy at scale

Manage Workers deployments at scale with integrations into popular frameworks.

terraform
serverless

Key Features

High-performance V8 JavaScript Engine

High-performance V8 JavaScript Engine

Based on the web standard Service Workers API

Based on the web standard Service Workers API

Securely sandboxed

Securely sandboxed

Prescripted deployment recipes

Prescripted deployment recipes

Apply custom logic expressions for routing and caching at the edge

Apply custom logic expressions for routing and caching at the edge

Fast startup times at all locations

Fast startup times at all locations

Deployed across Cloudflare's 194-city network within seconds

Deployed across Cloudflare's 194-city network within seconds

Fast key-value storage with Cloudflare Workers KV

Fast key-value storage with Cloudflare Workers KV

Workers WebAssembly Support

Workers WebAssembly Support

"Cloudflare Workers saves us a great deal of time. Managing bot traffic without Workers would consume valuable development and server resources that are better spent elsewhere."
John Thompson
Senior System Administrator at MaxMind

Everyone can start using Cloudflare Workers

To start using Cloudflare Workers either sign up for a workers.dev subdomain or use a domain attached to an existing Cloudflare plan.

Activate Today Already a customer?

Cloudflare Workers Free Tier

Free

100k requests per day (UTC+0)

check logo

Deploy up to 30 scripts

check logo

Runs on all 194 data centers

check logo

Free workers.dev subdomain

check logo

< 10ms CPU time per request

check logo

Lowest latency after first request

Cloudflare Workers Unlimited Tier

$0.5/million requests

(Minimum charge of $5/mo)

check logo

Deploy up to 30 scripts

check logo

Runs on all 194 data centers

check logo

Free workers.dev subdomain

check logo

< 50ms CPU time per request

check logo

Always lowest latency

check logo

Workers KV Support

Cloudflare Workers Enterprise Tier

Custom

Annual billing available

check logo

Custom number of scripts

check logo

Runs on all 194 data centers

check logo

Free workers.dev subdomain

check logo

Negotiable CPU time limits

check logo

Always lowest latency

check logo

Workers KV Support