DEV Community

Alex Spinov
Alex Spinov

Posted on

Cloudflare Workers Has a Free Tier — 100K Requests/Day at the Edge With KV, R2, and D1

A developer in our Discord ran into a classic problem: their API needed to serve users in 40+ countries, but their single-region server meant 200-400ms latency for most of the world. They didn't want to manage multi-region infrastructure.

Cloudflare Workers solved it. Code runs at 300+ edge locations worldwide. First request from Tokyo? 15ms. São Paulo? 20ms. The free tier handles 100,000 requests per day.

What You Get Free

No credit card. The free tier is production-ready:

  • 100,000 requests/day — resets at midnight UTC
  • 10ms CPU time per invocation — enough for most API logic
  • Workers KV — 100K reads/day, 1K writes/day, 1GB storage
  • R2 — 10GB storage, 10M reads/month, 1M writes/month (S3-compatible)
  • D1 — 5M rows read/day, 100K rows written/day, 5GB storage (SQLite at edge)
  • Durable Objects — 400K requests/month (stateful edge computing)
  • Queues — 1M operations/month
  • 300+ edge locations — your code runs everywhere
  • Custom domains — route Workers to any domain on Cloudflare

Quick Start

# Install Wrangler CLI
npm create cloudflare@latest my-worker

# Local development
cd my-worker
npx wrangler dev

# Deploy globally
npx wrangler deploy
Enter fullscreen mode Exit fullscreen mode

From zero to globally deployed in under 2 minutes.

Real Example: Edge API with D1 Database

// src/index.js
export default {
  async fetch(request, env) {
    const url = new URL(request.url);

    if (url.pathname === '/api/items' && request.method === 'GET') {
      const { results } = await env.DB.prepare(
        'SELECT * FROM items ORDER BY created_at DESC LIMIT 50'
      ).all();
      return Response.json(results);
    }

    if (url.pathname === '/api/items' && request.method === 'POST') {
      const { name, description } = await request.json();
      const result = await env.DB.prepare(
        'INSERT INTO items (name, description) VALUES (?, ?) RETURNING *'
      ).bind(name, description).first();
      return Response.json(result, { status: 201 });
    }

    return new Response('Not found', { status: 404 });
  }
};
Enter fullscreen mode Exit fullscreen mode
# wrangler.toml
name = "my-api"
main = "src/index.js"

[[d1_databases]]
binding = "DB"
database_name = "my-db"
database_id = "your-db-id"
Enter fullscreen mode Exit fullscreen mode

Deploy: npx wrangler deploy. Your API runs at 300+ locations with a SQLite database at the edge. Free.

What You Can Build

1. Global API — REST/GraphQL endpoints that run at the edge. Sub-50ms responses worldwide.

2. URL shortener — Workers KV for storage. Millions of redirects on free tier.

3. Image optimization proxy — transform images on-the-fly with Workers + R2.

4. Authentication middleware — JWT validation at the edge before requests hit your origin.

5. Webhook processor — receive, validate, transform, and forward webhooks globally.

Free Tier Limits

100K requests/day is the wall. That's ~1.15 requests/second average. Fine for side projects, not for anything viral.

10ms CPU time. This is CPU time, not wall clock. Network requests (fetch, KV reads) don't count. But heavy computation will hit this.

Workers KV is eventually consistent. Writes take up to 60 seconds to propagate globally. Not for real-time data.

D1 is beta. SQLite at the edge is powerful but still maturing. Check the docs for current limitations.

No WebSockets on free tier. Durable Objects support WebSockets but the free tier is limited.

The Edge Computing Advantage

Cloudflare Workers isn't just "serverless" — it's a fundamentally different model. Your code doesn't run in one region. It runs everywhere, simultaneously. No cold starts (V8 isolates, not containers). No region selection. No load balancers.

For latency-sensitive APIs, this is the biggest free lunch in cloud computing.


Need custom web automation? Email spinov001@gmail.com

More free tiers: 41+ Free APIs Every Developer Should Bookmark

Also in this series: Fly.io | Railway | Render | Netlify | Vercel

Top comments (0)