Quick Tip
Need a scheduled job but don't want to pay for a VPS or keep a laptop awake? Cloudflare Workers' free tier gives you cron triggers — 100,000 requests/day, $0.
wrangler.toml:
name = "nightly-cleanup"
main = "src/index.js"
compatibility_date = "2026-01-01"
[triggers]
crons = ["0 3 * * *"] # every day at 03:00 UTC
src/index.js:
export default {
async scheduled(event, env, ctx) {
// runs on the cron schedule — no HTTP request needed
const res = await fetch("https://api.example.com/cleanup", {
method: "POST",
headers: { "Authorization": `Bearer ${env.API_TOKEN}` }
});
console.log("cleanup status:", res.status);
}
};
Deploy:
npx wrangler deploy
The Numbers That Matter
| Cloudflare Workers free | GitHub Actions cron | $5 VPS | |
|---|---|---|---|
| Cost | $0 | $0 (public repos) | $60/yr |
| Min interval | 1 minute | ~5+ min (often delayed) | 1 minute |
| Cold start | 0ms (no cold starts) | 30-60s runner spin-up | none |
| Max runtime | 30s CPU (free) | 6 hours | unlimited |
The killer detail: Workers have zero cold start. Unlike Lambda, your cron fires instantly at the scheduled second.
Gotchas (Learned the Hard Way)
-
Cron runs in UTC only —
0 3 * * *is 3am UTC, not your timezone. I had a "midnight cleanup" running at 8pm local for a week. - 30-second CPU limit on free tier — fine for API calls and cleanup, not for batch processing. Long jobs: split with Queues.
-
Secrets need
wrangler secret put— don't commit tokens towrangler.toml.
npx wrangler secret put API_TOKEN
I've replaced a $5/month VPS with 4 of these cron Workers. Total monthly bill: $0, and the jobs run faster than they did on the VPS.
More free-stack tricks I actually use: https://ly.cyberserval.tech/iIETXiF
What's the dumbest thing you're still paying a server to do on a schedule? Drop it below — I'd bet there's a free tier that covers it.
Top comments (0)