DevTools

Cloudflare Workers: Run Code at the Edge — Free for 100K Requests/Day

You don’t need a server to run code — just Cloudflare Workers.

By YureiBlog • November, 2025 • 5 min read

Imagine deploying a full backend in under a minute, with zero servers, zero maintenance, and global speed — all for free.

What Are Cloudflare Workers?

Cloudflare Workers are **serverless functions** that run JavaScript (or Rust/WebAssembly) on Cloudflare’s global edge — not on a distant VPS. They intercept HTTP requests before they hit your origin, letting you modify responses, route traffic, call APIs, or serve dynamic content — all in under 10ms worldwide. No cold starts, no scaling worries, and **100% free up to 100,000 requests/day**.

  • Use Cases: URL shorteners, auth, A/B tests, API gateways, JSON APIs.
  • Free Tier: 100K req/day, 10ms CPU each — enough for most hobby projects.
Key Point: Workers run *closer to users* than any traditional server — global latency under 50ms.
1

Install Wrangler CLI (Takes 1 Minute)

  1. Open your computer’s Terminal (Mac/Linux) or Command Prompt / PowerShell (Windows).
  2. Paste this command and press Enter:
    npm create cloudflare@latest
  3. Wait 10–20 seconds — it downloads the tool.
  4. You’ll see prompts:
    • Project name? → Type: hello-world → press Enter
    • Select a template: → Choose Hello World Worker → press Enter
    • Install dependencies? → Type y → press Enter
  5. Done! A folder called hello-world is created with everything ready.
Success: Wrangler is now installed and your project is set up.
2

Edit the Code (No Experience Needed)

  1. Open the hello-world folder in any code editor:
    • Free: VS Code (recommended)
    • Or use Notepad (Windows) / TextEdit (Mac)
  2. Inside the folder, open the file: src/index.js
  3. Delete everything and paste this simple code:
    export default {
      async fetch(request) {
        return new Response("Hello from Cloudflare Workers! 🚀", {
          headers: { "content-type": "text/plain" },
        });
      }
    };
  4. Save the file (Ctrl+S or Cmd+S).
Pro Tip: This code returns a message when someone visits your Worker URL.
3

Deploy — Go Live in 10 Seconds

  1. Back in your Terminal, make sure you’re inside the hello-world folder:
    cd hello-world
  2. Paste this command and press Enter:
    npm run deploy
  3. Wait 5–10 seconds. You’ll see:
    Deployed to: https://hello-world.yourname.workers.dev
    Published!
  4. Copy the URL → open in browser → see your message live!
Congratulations! Your first Cloudflare Worker is live on the internet — globally, instantly, for free.

Next: Test & Share

Send the URL to a friend in another country — they’ll see it load instantly. That’s the power of the **edge**.

Want to return JSON? Change "text/plain" to "application/json" and return:

JSON.stringify({ message: "Hello API!", status: "ok" })

Cloudflare Workers are the future of lightweight backends — no servers, no DevOps, just code that runs everywhere. A single Worker can power a URL shortener, protect a form with CAPTCHA, redirect old links, or serve personalized JSON — all from the same infrastructure that powers 20% of the internet. The free tier isn’t a trial: **100,000 requests/day is real usage**, enough for a blog API, webtools quote generator, or travel tracker. And when you grow? It scales to millions without changing a line. Pair with **Workers KV** (free 1GB storage) or **D1** (SQLite at the edge) for full apps. For learners and indie makers, Workers remove the biggest barrier to building: infrastructure. You write JS, hit deploy, and it just works — globally, instantly, freely.

Full disclosure: I haven’t used Workers in production yet. I know it lets you run JavaScript at the edge with zero servers (100k free requests/day), and I’ve seen people build APIs, redirects, and A/B tests with it — but I’m still learning. Once I need dynamic features without a backend, Workers will be my first choice because it’s free and crazy fast. For now, I stick to static pages — but I’m excited to try it soon!

Related Reads