Deploying to Cloudflare Workers
Learn how to deploy your web applications to the edge with Cloudflare Workers for blazing-fast global performance.
Cloudflare Workers run your code at the edge — in data centers around the world, close to your users. This means lower latency and faster response times compared to traditional centralized hosting.
Why Edge Computing?
Traditional server deployments run in one or a few regions. When a user in Tokyo requests a page from a server in Virginia, the round trip adds hundreds of milliseconds of latency.
Edge computing solves this by running your code in 300+ data centers worldwide.
Setting Up Wrangler
Wrangler is the CLI tool for managing Cloudflare Workers.
npm install -D wrangler
Configure your worker with wrangler.jsonc:
{
"name": "my-worker",
"compatibility_date": "2026-03-01",
"main": "src/index.ts"
}
Deploying an Astro Site
Astro has first-class support for Cloudflare Workers through the @astrojs/cloudflare adapter:
import cloudflare from '@astrojs/cloudflare'
import { defineConfig } from 'astro/config'
export default defineConfig({
adapter: cloudflare(),
output: 'server',
})
Deploy with a single command:
wrangler deploy
Your site is now running on the edge, serving users from the nearest data center. The combination of Astro’s minimal JavaScript output and Cloudflare’s global network creates an exceptionally fast experience.