Where are the real billing cliffs on Cloudflare Workers, D1, and R2?
Cloudflare's $5/month Workers Paid plan absorbs 10M dynamic requests, 30M CPU milliseconds, and 25B D1 rows read, meaning surprise bills almost always stem from unindexed D1 table scans, chatty per-item R2 Class A writes, or invoking Worker JS in front of static assets.
Cloudflare's serverless stack is famously inexpensive compared with traditional cloud providers, largely because Workers bills only active CPU execution time (not I/O wait time) and R2 charges $0.00 for egress bandwidth. However, moving from the Free plan (capped daily at 100,000 Worker requests and 5 million D1 rows_read per day) to production traffic exposes three distinct unit-economic cliffs:
- Daily Free Caps vs. Monthly Paid Allowances: On the Free tier, quotas reset every 24 hours UTC, a single Hacker News spike or unindexed SQL query hitting 5.1 million
rows_readwill return hard errors until midnight UTC even if your monthly average is tiny. Upgrading to the $5/month Workers Paid base unlocks monthly pooled allowances (10M Worker requests, 30M CPU ms, 25B D1 rows read, 50M D1 rows written) before overage metering begins. - D1
rows_readAmplification: D1 meters every row inspected by SQLite's query engine, not the number of rows returned to your client. ExecutingSELECT * FROM events WHERE slug = ? ORDER BY created_at DESC LIMIT 20without a composite index(slug, created_at DESC)forces SQLite to scan every row inevents. On a 50,000-row table, just 100 requests scan 5,000,000 rows: exhausting the entire daily Free tier in seconds, or burning 50 billionrows_read($25 overage) at 1M monthly requests. - R2 Class A Mutation Storms: While 100 TB of R2 public CDN egress costs $0 (saving ~$9,000/month vs uncached AWS S3 egress at $0.09/GB), R2 bills Class A operations (
PUT,POST,COPY,LIST) at $4.50 per million beyond the 1M monthly free tier. Writing tiny analytics JSON blobs or per-chunk logs directly to R2 without batching can cost 10x more in Class A ops than the underlying GB-month storage itself.
Does serving Next.js static exports on Workers cost request fees?
No, requests matched directly by Cloudflare Workers Static Assets (assets.directory) are served free without consuming Worker request or CPU quotas, provided you do not force run_worker_first: true across static paths.
When you deploy a Next.js output: 'export' site with wrangler.jsonc assets, Cloudflare's edge serves HTML, CSS, JS bundles, and WebP images straight from the static asset layer at zero per-request charge. Your Worker entrypoint (main: "worker/index.js") only executes (and only increments billable Worker requests) when a route misses static files (such as POST /api/feedback or dynamic redirects) or if you explicitly intercept static routes.
| Resource | Free Tier Cap | Workers Paid ($5/mo) Included | Paid Overage Rate | Primary Optimization Lever |
|---|---|---|---|---|
| Worker Requests | 100K / day | 10M / month | $0.30 / 1M requests | Keep HTML/assets in Static Assets; cache GET APIs |
| Worker CPU Time | 10 ms / request | 30M CPU ms / month | $0.02 / 1M CPU ms | Stream JSON/HTML (TransformStream); avoid sync crypto |
| D1 Rows Read | 5M / day | 25B / month | $0.001 / 1M rows | Verify SEARCH ... USING COVERING INDEX via EXPLAIN |
| D1 Rows Written | 100K / day | 50M / month | $1.00 / 1M rows | Batch high-frequency counters in memory or Queues |
| R2 Storage & Ops | 10 GB, 1M A / 10M B | 10 GB, 1M A / 10M B | $0.015/GB, $4.50/M A, $0.36/M B | Bundle small writes; cache Class B reads on CDN |