Cloudflare Workers

archived 21 Dec 2025 20:31:13 UTC

Everything we learned from powering 20% of the Internet—yours by default

Cloudflare is your AI Cloud with compute, AI inference, and storage — letting you ship applications instead of managing infrastructure.
Start building

The cloud that works for developers, not the other way around

Deploy serverless functions, frontends, containers, and databases to 330+ cities with one command.
Build AI agents on durable objects with code execution, inference, AI gateway all built-in
"Cloudflare provided everything from OAuth to out-of-the-box remote MCP support so we could quickly build, secure, and scale a fully operational setup."
Architecture inspired by
Atlassian
Build AI agents on durable objects with code execution, inference, AI gateway all built-in
"Cloudflare provided everything from OAuth to out-of-the-box remote MCP support so we could quickly build, secure, and scale a fully operational setup."
Architecture inspired by
Atlassian

Region: Earth

Our smart network positions your workloads optimally — close to users, close to data.
3D globe visualization requires hardware acceleration
Run everywhere
Run code in 330+ cities around the world, within 50ms of 95% of the world's population.
Run anywhere
Run code near the user, database, or near your APIs. Our smart network will schedule your requests to optimize for the best latency.
Run at massive scale
Run on Cloudflare's infrastructure, supporting 449 Tbps of network capacity, serving over 81 million HTTP requests per second.

Cloudflare powers
1 in 5 sites on the Internet

Trusted by the teams you trust. And thousands more...
doordash

Go from

in minutes

No DevOps. Minimal cold starts. No surprise bills.
From first line to full scale
Deploy working code in seconds or start from hundreds of templates — all built to scale.
See templates
Player 1
Player 2
forest
Hello World
import { routePartykitRequest, Server } from "partyserver";
  
import type { OutgoingMessage, Position } from "../shared";
import type { Connection, ConnectionContext } from "partyserver";

// This is the state that we'll store on each connection
type ConnectionState = {
  position: Position;
};

export class Globe extends Server {
  onConnect(conn: Connection<ConnectionState>, ctx: ConnectionContext) {
    // Whenever a fresh connection is made, we'll
    // send the entire state to the new connection
    
    // First, let's set up the connection state
    conn.setState({ position: { x: 0, y: 0 } });
    
    // Send current state to new connection
    this.broadcast(JSON.stringify({
      type: "user-joined",
      id: conn.id,
      position: conn.state.position
    }));
  }

  onMessage(message: string, sender: Connection<ConnectionState>) {
    const data = JSON.parse(message) as OutgoingMessage;
    
    if (data.type === "position-update") {
      sender.setState({ position: data.position });
      
      // Broadcast position update to all other connections
      this.broadcast(JSON.stringify({
        type: "position-update",
        id: sender.id,
        position: data.position
      }), [sender.id]);
    }
  }

  onClose(connection: Connection<ConnectionState>) {
    this.broadcast(JSON.stringify({
      type: "user-left",
      id: connection.id
    }));
  }
}
~/workspace/multiplayer-app git:(main)
> npx wrangler deploy
Enumerating objects: 1, done.
Counting objects: 100% (1/1), done.
Writing objects: 100%
Deploy with one command
Let it spike. We got you.
Your application runs globally, handles millions of requests, and scales without you thinking about it.
588k requests per second

Pay only when your code runs

(Not to keep servers warm.)
Wall Clock vs. CPU Time
Never pay for idle time waiting for slow APIs, LLMs, or humans. Cloudflare charges only for compute, not wall time, even during long agent workflows or hibernating WebSockets.
1ms
LLM Call 2500ms
0.5ms
API Call 300ms
0.75ms
Paid
Free

Free

No credit card needed
See more
10GB
/ R2 Storage
1 million
/ Class A requests
10 million
/ Class B requests
10GB
/ IA Storage

Paid

Starts at $5/month
See more
$0.015
/ GB-month
$4.50
/ million Class A requests
$0.36
/ million Class B requests
$0.01
/ GB-month

Why developers choose Cloudflare

Everything needed to build performant applications.

Fighting infra with “cloud”

"Egress costs just doubled this week — caching not working at edge. Can we fix this by EOD?"
STATUS: UNRESOLVED
2931 Open incidents
2931 Open incidents
P0
High Latency!!!!!!
~150–250ms RTT per request
P0
High Latency!!!!!!
~150–250ms RTT per request
P0
High Latency!!!!!!
~150–250ms RTT per request
"Origin IP exposed, getting hit with direct DDoS traffic. Need to lock down ASAP."
Bandwidth usage alert
You have exceeded your bandwidth limit for the month.
Bandwidth usage alert
You have exceeded your bandwidth limit for the month.
Summer Intern
"I fixed the errors by pushing the env file to production."

Shipping with
Cloudflare

Pushed
01234567890123456789
new updates today

Tailored to your working style

Always simple, fast, and reliable.
v30501Updated 12.21.25, 20:32
Queued
v30500Updated 12.21.25, 20:32
Deployed
v30499Updated 12.21.25, 20:32
Deployed
v30498Updated 12.21.25, 20:32
Deployed
v30497Updated 12.21.25, 20:32
Deployed
Fits into your existing workflows
Git, GitHub Actions, VS Code, and any framework. No proprietary tools or vendor lock-in.
Instant feedback loops
Our smart network positions your workloads optimally — close to users, close to data.
Observable by default
Built-in logs, metrics, and tracing. Understand your application's performance without setting up monitoring infrastructure.
Compatible with your stack
Use the languages and frameworks you know — JS, TS, Python, Rust, React, and more. Cloudflare works with your existing databases, APIs, and services.
<script>
  import { onMount, onDestroy } from 'svelte'
  import { writable } from 'svelte/store'
  
  let count = 0
  let user = { name: 'John Doe', email: 'john@example.com' }
  let isOnline = false
  
  const onlineUsers = writable([])
  
  function increment() {
    count += 1
  }
  
  function toggleOnline() {
    isOnline = !isOnline
  }
  
  onMount(() => {
    console.log('Profile component mounted')
    // Simulate checking online status
    setTimeout(() => isOnline = true, 1000)
  })
  
  onDestroy(() => {
    console.log('Profile component destroyed')
  })
</script>

<div class="container">
  <header class="profile-header">
    <h1>User Profile</h1>
    <div class="status" class:online={isOnline}>
      {isOnline ? 'Online' : 'Offline'}
    </div>
  </header>
  
  <div class="profile-info">
    <h2>{user.name}</h2>
    <p>{user.email}</p>
  </div>
  
  <div class="actions">
    <button on:click={increment} class="btn">
      Count: {count}
    </button>
    <button on:click={toggleOnline} class="btn secondary">
      {isOnline ? 'Go Offline' : 'Go Online'}
    </button>
  </div>
</div>

<style>
  .container {
    padding: 2rem;
    max-width: 400px;
    margin: 0 auto;
  }
  
  .profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
  }
  
  .status {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    background: #ef4444;
    color: white;
    font-size: 0.875rem;
  }
  
  .status.online {
    background: #10b981;
  }
  
  .profile-info {
    margin-bottom: 1.5rem;
  }
  
  .actions {
    display: flex;
    gap: 0.5rem;
  }
  
  .btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.25rem;
    background: #3b82f6;
    color: white;
    cursor: pointer;
  }
  
  .btn.secondary {
    background: #6b7280;
  }
</style>

Build without boundaries

Join thousands of developers who've eliminated infrastructure complexity and deployed globally with Cloudflare. Start building for free — no credit card required.
No cold starts or region complexity Deploy to 330+ cities instantly Predictable pricing without surprises Battle-tested infrastructure powering millions No cold starts or region complexity Deploy to 330+ cities instantly Predictable pricing without surprises Battle-tested infrastructure powering millions No cold starts or region complexity Deploy to 330+ cities instantly Predictable pricing without surprises Battle-tested infrastructure powering millions No cold starts or region complexity Deploy to 330+ cities instantly Predictable pricing without surprises Battle-tested infrastructure powering millions
0%
10%
20%
30%
40%
50%
60%
70%
80%
90%
100%