Quick Tip: Deploy a Scheduled Job on Cloudflare Workers for $0 — No Server Needed
I used to pay $5/month for a VPS whose only job was running a cron task every hour. Then I moved it to Cloudflare Workers with Cron Triggers — free tier gives you 100,000 requests/day and up to 1,000 scheduled triggers per account. My bill went to $0.
Here's the whole thing:
// worker.js
export default {
async scheduled(event, env, ctx) {
// runs on the cron schedule below
const res = await fetch("https://api.example.com/ping", {
headers: { "Authorization": `Bearer ${env.API_TOKEN}` }
});
console.log("status:", res.status);
},
};
# wrangler.toml
name = "hourly-job"
main = "worker.js"
compatibility_date = "2026-08-01"
[vars]
# non-secret config here
[triggers]
crons = ["0 * * * *"] # every hour, standard cron syntax
Deploy with one command:
npx wrangler deploy
npx wrangler secret put API_TOKEN
Why this beats a VPS for small jobs:
| $5 VPS | Cloudflare Workers Free | |
|---|---|---|
| Monthly cost | $5 | $0 |
| Cold start | none (always on) | ~0ms (V8 isolates) |
| Maintenance | you patch the OS | none |
| Cron limit | your uptime | 1,000 triggers/account |
| Failure alerting | DIY | built-in logs via wrangler tail
|
The catch: a Worker execution is capped at 30 seconds of wall-clock CPU time on the free plan (CPU time limit is 10ms default, configurable up to 30s). If your job is a nightly batch that chews data for 10 minutes, keep the VPS. For webhooks, pings, cache warm-ups, and API polling, this is strictly better.
I draft and test Worker scripts with this free AI coding assistant before deploying: https://ly.cyberserval.tech/iIETXiF
What's the smallest thing you still run a whole server for?
Top comments (0)