Cloudflare Workers for business 2026: a practical guide
If your site is on Cloudflare CDN, you're one click away from a powerful tool many people don't use. Cloudflare Workers is code that runs on 330+ edge locations around the world, with no server of your own. In this article: what it is, 5 typical business use cases, a comparison with AWS Lambda and Vercel, and common mistakes.
What Workers is and the ecosystem
Cloudflare Workers is serverless edge compute. You write a function in JavaScript/TypeScript (or Rust/Python via Pyodide), deploy it via CLI or git, and it instantly runs in 330+ cities around the world – Cloudflare itself deploys it to the server closest to the user.
edge locations worldwide for code deployment
requests free on the free plan
typical Worker response time
paid plan: 10 million requests per month
The key difference from classic clouds: code runs on the same network as the CDN. There's no concept of "instance", "region", or "availability". There's almost no cold start – V8 isolate starts up in 5ms.
Around Workers, Cloudflare has built a whole ecosystem of services:
- KV (Key-Value) – distributed storage for cache, sessions, feature flags. Free up to 100K reads per day.
- R2 (Object Storage) – S3-compatible storage for files. The key feature: free egress (with AWS S3 you pay for every byte sent out).
- D1 (SQL Database) – SQLite at the edge. $5/month for 10GB. Suitable for most web applications up to 10M requests.
- Durable Objects – objects with consistent state. For chat rooms, queues, WebSocket applications.
- Queues – message queues for asynchronous processing.
- Workers AI – running open-source models (Llama, Mistral, embeddings) directly at the edge. Without sending data to third parties.
- Hyperdrive – accelerated connection to external PostgreSQL/MySQL/MongoDB.
5 use cases for business
1. Telegram bot without your own server
The most common use case. A Telegram bot via webhook is an HTTP endpoint that receives POST requests. A Worker handles this perfectly. Session state goes in KV (free 100K reads/day). Integrations with CRM or OpenAI – via fetch to their API. No VPS, no PM2 or systemd – deploy and forget.
2. Processing forms from your site
A request form on a static landing → Worker → forward to the manager's Telegram chat / email / CRM. Spam protection (honeypot, rate-limit) is a couple of lines on the Worker. One Worker can serve forms for 10 sites in parallel. The free plan is more than enough for the average business.
3. AI proxy for protecting API keys
Want to give users access to ChatGPT/Claude through your UI? You can't call OpenAI/Anthropic directly from the browser – the API key would leak. A Worker as a proxy: the frontend calls the Worker, the Worker adds the API key from environment variables and calls OpenAI. The key never leaves the server.
4. Image optimization on-the-fly
Cloudflare Images or your own Worker with the Polish library: image optimization "on the fly". You upload the original to R2, the Worker resizes it, converts it to WebP/AVIF, adds a watermark – via URL parameters. PageSpeed +20-30 points on sites with lots of images.
5. Geo-routing and A/B testing
A Worker sees the country, region, and browser language of the user. You can route Russians to `tema.name/`, Germans to `/de/`, Poles to `/pl/`. Same for A/B tests: different page versions without a separate service. All "experiment = second page" logic is handled at the edge, before the request hits your origin.
Comparison with alternatives
| Parameter | Cloudflare Workers | AWS Lambda | Vercel Functions |
|---|---|---|---|
| Regions | 330+ edge locations | One region (you pick manually) | Edge + regions |
| Cold start | ~5ms | 200-2000ms (Node.js), worse on Java | 50-300ms |
| Languages | JS/TS/Rust/Python (Pyodide) | Node.js/Python/Go/Java/Ruby/.NET | JS/TS, Python |
| Free plan | 100K requests/day | 1M requests/month | 100K requests/month |
| Cost of 10M requests | $5/month | ~$20/month + GB-seconds | ~$20/month |
| Lock-in | Cloudflare ecosystem | AWS ecosystem (S3, DynamoDB...) | Vercel + Next.js focus |
| Idle to first request | Instant | Up to 2 seconds (cold start) | Up to 300ms |
My recommendations:
- If you're already on Cloudflare – Workers is a "free extension" to what you already pay for. Fewer bills, fewer providers.
- If you have a heavy AWS stack (RDS, DynamoDB, SQS) – Lambda is more convenient, everything in one VPC.
- If your frontend is Next.js / Nuxt / Astro on Vercel – Vercel Functions is more convenient, server code in the same repo.
- If you have a global audience – Workers wins thanks to edge locations (the CDN places code in the data center closest to the user).
Launching your first Worker in an hour
A realistic timeline for launching your first production Worker from scratch:
- Setup10 min
- Code15 min
- Deploy5 min
- Routes10 min
- Tests20 min
Setup (10 min). Register a Cloudflare account (if you don't have one), install the `wrangler` CLI (`npm install -g wrangler`), `wrangler login` – it opens the browser for authorization. At this stage you already have a working environment.
Code (15 min). `wrangler init my-worker` creates a template. A basic Worker is 10 lines of TypeScript code: takes an HTTP request, returns a Response. For a Telegram bot you add JSON handling and a call to the Telegram API via fetch.
Deploy (5 min). `wrangler deploy` – the Worker is immediately available at `*.workers.dev`. Logs via `wrangler tail`. No Docker, no CI/CD, no Kubernetes.
Routes (10 min). If you already have a domain on Cloudflare – in the Workers dashboard you add a Route: `api.yourdomain.com/*` → your Worker. From this point on, requests to this URL go to the Worker.
Tests (20 min). Local testing with `wrangler dev`. You connect KV/D1/R2 via `wrangler.toml` bindings. Edge cases: what the Worker returns on an empty request, on a huge one, on a request with broken JSON. Deploy with `wrangler deploy --env production`.
7 common mistakes
These pitfalls I've seen with clients and stepped on myself.
- Storing state in a global variable. Worker is stateless – each request can hit a different server. State goes in KV/D1/Durable Objects, not in a variable.
- Ignoring the CPU limit. 10ms on free, 50ms on paid. Heavy cryptography or a big JSON.parse may not finish in time. Profile with `wrangler dev --remote`.
- Not using Wrangler secrets for keys. Putting an OpenAI API key in code = it ends up in git. Use `wrangler secret put` – the key is stored encrypted at Cloudflare.
- Doing sync operations on every request. Every fetch to an external API costs time. Cache reusable data in KV or the Cache API.
- Forgetting about Origin headers. CORS blocks requests from the frontend. The Worker must explicitly return `Access-Control-Allow-Origin` – the user won't see the response without it.
- Deploying without tests. The Worker goes to production instantly. Make a separate environment for staging: `wrangler deploy --env staging`.
- Not enabling analytics. Cloudflare has free Workers Analytics – requests, errors, latency by region. Without it you have no idea what's going on.
Frequently asked questions
What is Cloudflare Workers in simple terms?
It's code that runs on Cloudflare servers around the world, close to the user. You write a JavaScript/TypeScript function, deploy it, and it works in 330+ cities worldwide. No need for your own server, no Docker, no PM2. There's almost no cold start – response in 5-50ms. Suitable for APIs, forms, Telegram bots, proxies, auth, image processing.
How much does Cloudflare Workers cost?
Free plan: 100,000 requests per day for free, up to 10ms CPU per request. This is enough for most projects up to 100K visits per month. Paid plan: $5 per month for 10 million requests, up to 50ms CPU. This is many times cheaper than AWS Lambda for the same volume.
How is Workers different from AWS Lambda?
Lambda runs in one AWS region, Workers – on 330+ edge locations. Lambda has a cold start of 200-2000ms, Workers – less than 10ms. Lambda – Node.js/Python/Go/Java/Ruby, Workers – JavaScript/TypeScript/Rust/Python (via Pyodide). For global APIs and web applications, Workers is faster and simpler; for heavy tasks (video processing, ML inference), Lambda is more flexible.
Can you connect a database to Workers?
Yes. Cloudflare has its own services: D1 (SQLite at the edge, $5/month for 10GB), KV (key-value, for cache and sessions), R2 (S3-compatible storage with no egress fees), Durable Objects (state consistency). You can also connect to external databases via Hyperdrive (accelerated PostgreSQL) or directly through the connection API.
Is Workers suitable for a Telegram bot?
It's perfect. A Telegram bot via webhook is an HTTP endpoint that receives requests from the Telegram API. Workers handle this load even on the free plan up to 100K messages per day. Session state can be stored in KV (free 100K reads/day), CRM/OpenAI integrations – via fetch to their API. No VPS needed.
Need a Telegram bot or API on Workers?
I'll design and deploy it for your task: bot, form, AI proxy, image optimizer. Free technical briefing within 24 hours.