TDocs/
search
Engineering··schedule5 min read

Getting Started with Cloudflare Workers

Learn how to build and deploy serverless functions to Cloudflare's edge network with Workers.

Introduction

Cloudflare Workers let you deploy serverless functions to the edge. In this guide, we'll explore how to build and deploy your first Worker.

Why Workers?

  • Global distribution: Your code runs in 300+ data centers worldwide
  • Zero cold starts: V8 isolates start in under 5ms
  • Free tier: 100,000 requests per day

Setting Up

First, install Wrangler CLI:

npm install -g wrangler
wrangler login

Your First Worker

Create a new project:

export default {
  async fetch(request: Request): Promise<Response> {
    return new Response("Hello from the edge!")
  }
}

Deploying

wrangler deploy

That's it! Your Worker is now live on Cloudflare's global network.