A practical field guide from Automation Ace.
The short answer
Cloudflare Workers are small pieces of JavaScript (or TypeScript or Python) that run on Cloudflare's global network whenever something happens: an HTTP request arrives, a schedule fires, or an email lands. That makes them a capable, low-cost way to automate tasks without Zapier: receive webhooks, call APIs, run scheduled jobs, process email, and add AI, all in code you control. The trade-off is that you write and maintain that code yourself.
This site itself is deployed on Cloudflare Workers, so these patterns come from hands-on use. If you are brand new, start with Cloudflare Workers for beginners.
What is a Cloudflare Worker?
A Worker is serverless code: you deploy it, and Cloudflare runs it on demand, near the user or event, without you managing servers. A Worker exposes handlers for different kinds of events:
// src/index.js — a Worker with three entry points
export default {
// Runs on every HTTP request (webhooks, APIs, forms)
async fetch(request, env, ctx) {
return new Response('Hello from my automation!');
},
// Runs on a schedule (Cron Triggers)
async scheduled(controller, env, ctx) {
console.log('Scheduled run at', new Date(controller.scheduledTime).toISOString());
},
// Runs when an email arrives (Email Routing + Email Workers)
async email(message, env, ctx) {
await message.forward('me@example.com');
},
};
- fetch handles HTTP requests: webhooks, API endpoints, and form posts.
- scheduled handles Cron Triggers.
- email handles incoming email via Email Routing.
Cloudflare Workers vs Zapier
| Zapier | Cloudflare Workers | |
|---|---|---|
| Trigger | App trigger (polling or instant) | HTTP request (fetch), schedule (scheduled), email (email), queue message |
| Actions | Pre-built app actions | Any API call you write with fetch() |
| Logic | Filters, Paths, Formatter, Code steps | Full JavaScript or TypeScript (Python is also supported) |
| State | Storage by Zapier, Zapier Tables | KV, D1 (SQL), R2 (files), Durable Objects |
| Multistep, long-running | Multi-step Zaps, Delay | Cloudflare Workflows with durable steps, retries, and sleeps |
| AI | AI steps and app integrations | Workers AI models via a binding |
| Pricing model | Tasks per plan | Requests and CPU time, with a free daily allowance |
| Who can maintain it | Non-developers | People comfortable with code |
They are complementary more than competitive. Many teams keep Zapier for app-to-app workflows that non-developers maintain, and use Workers for high-volume endpoints, custom logic, and jobs that outgrow Code by Zapier. See 5 reasons to move custom code to Workers and Zapier vs Make vs n8n for the wider landscape.
The Cloudflare automation building blocks
- Workers: the code that runs.
- Cron Triggers: run a Worker on a schedule.
- Email Routing and Email Workers: run code when mail arrives at your domain.
- KV: simple key-value storage for settings, cursors, and dedupe keys. Compare key-value vs tables.
- D1: a SQL database for records and logs.
- R2: object storage for files.
- Queues: buffer work and process it reliably.
- Workflows: durable multistep automations with retries and waits. See Cloudflare Workflows.
- Workers AI: run AI models from your Worker. See getting started with Workers AI.
- Secrets: encrypted environment variables for API keys.
Getting started in five steps
- Create a free Cloudflare account.
- Install Node.js, then scaffold a project with
npm create cloudflare@latest. - Write your handler in
src/index.js(or.ts). - Test locally with
npx wrangler dev. - Deploy with
npx wrangler deploy; store keys withnpx wrangler secret put NAME.
Every step is walked through in your first API automation.
When Workers are the right choice
- High volume: thousands of events a day where per-task pricing adds up. See tasks vs operations pricing.
- Custom logic: parsing, transformation, signature verification, or algorithms that are awkward in no-code steps.
- Speed: endpoints that must respond instantly, like webhook receivers.
- APIs without integrations: connect anything with an API. See connecting two apps.
- Cost control: many small automations fit in the free plan. See 10 free-plan automations.
When to stay with Zapier
- Non-developers need to build or change the workflow.
- You need many pre-built app integrations with OAuth handled for you.
- Volume is low and speed of building matters more than cost.
- You want built-in run history and retries without writing monitoring. See Zapier error handling.
Many businesses use both, with Zapier calling Workers or Workers calling Zapier webhooks. For help deciding, see custom API integrations.
Frequently asked questions
What is a Cloudflare Worker?
A Cloudflare Worker is serverless JavaScript, TypeScript, or Python code that runs on Cloudflare's network in response to events such as HTTP requests, schedules (Cron Triggers), or incoming email, without you managing servers.
Can Cloudflare Workers replace Zapier?
For many code-friendly tasks, yes: Workers can receive webhooks, call APIs, run scheduled jobs, process email, and use AI. They do not provide Zapier's thousands of pre-built integrations or a no-code editor, so many teams use both.
Is Cloudflare Workers free?
Cloudflare offers a Workers Free plan with a daily request allowance (100,000 requests per day at the time of writing) and CPU time limits per invocation. Paid plans raise limits. Check Cloudflare's pricing page for current details.
What language are Cloudflare Workers written in?
Mainly JavaScript and TypeScript. Cloudflare also supports Python Workers and WebAssembly.
How do I deploy a Cloudflare Worker?
Scaffold a project with npm create cloudflare@latest, test locally with npx wrangler dev, store secrets with npx wrangler secret put, and deploy with npx wrangler deploy.
Disclaimer: Zapier features, plan availability, and settings can change. Confirm current details in Zapier's help documentation and Cloudflare's developer documentation and pricing pages. Limits and plan features change over time. Code samples are simplified starting points; add your own validation, error handling, and security review before production use before relying on a specific setting. This article may include links to apps, products, or services; some links may be affiliate links, which means Automation Ace may earn a commission at no extra cost to you.