[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"blog-en-githubcron-free-serverless-cron-jobs":3},{"id":4,"title":5,"author":6,"body":7,"cover":722,"description":723,"draft":724,"extension":725,"locale":726,"meta":727,"navigation":216,"path":728,"publishedAt":729,"seo":730,"seoTitle":731,"slug":732,"stem":733,"tags":734,"__hash__":740},"blog\u002Fen\u002Fblog\u002Fgithubcron-free-serverless-cron-jobs.md","Cron without a server: GitHub Actions calling your API (scheduled webhook)","Manuel Tardivo",{"type":8,"value":9,"toc":712},"minimark",[10,29,52,62,67,120,127,132,139,302,323,333,337,382,386,406,413,429,447,454,649,659,663,702,708],[11,12,13,17,18,21,22,25,26,28],"p",{},[14,15,16],"strong",{},"Problem you solve:"," your app runs on ",[14,19,20],{},"Vercel \u002F Netlify \u002F Cloudflare"," and you need periodic work (reports, sync, reminders) ",[14,23,24],{},"without"," a 24\u002F7 VPS and ",[14,27,24],{}," jumping straight to AWS EventBridge.",[11,30,31,34,35,38,39,43,44,47,48,51],{},[14,32,33],{},"What you ship in ~20 minutes:"," a ",[14,36,37],{},"GitHub Actions"," workflow on ",[40,41,42],"code",{},"schedule"," that ",[14,45,46],{},"POST","s to your endpoint with a shared ",[14,49,50],{},"secret",".",[11,53,54,57,58,61],{},[14,55,56],{},"How you know it works:"," the ",[14,59,60],{},"Actions"," tab shows green runs and your server logs show the authenticated request.",[63,64,66],"h2",{"id":65},"the-scheduled-webhook-pattern","The “scheduled webhook” pattern",[68,69,70,93,103,114],"ol",{},[71,72,73,76,77,80,81,84,85,92],"li",{},[14,74,75],{},"GitHub"," runs the workflow at the configured time (",[40,78,79],{},"cron"," is ",[14,82,83],{},"UTC"," — see ",[86,87,91],"a",{"href":88,"rel":89},"https:\u002F\u002Fdocs.github.com\u002Fen\u002Factions\u002Fusing-workflows\u002Fevents-that-trigger-workflows#schedule",[90],"nofollow","Events that trigger workflows",").",[71,94,95,96,99,100,51],{},"One step runs ",[40,97,98],{},"curl"," (or a small Node script) against ",[40,101,102],{},"https:\u002F\u002Fyour-app.example\u002Fapi\u002Fcron\u002F...",[71,104,105,106,109,110,113],{},"The app verifies a header such as ",[40,107,108],{},"Authorization: Bearer …"," against ",[40,111,112],{},"CRON_SECRET"," in env.",[71,115,116,117,51],{},"The handler runs the logic (DB, email, …) and returns ",[40,118,119],{},"200",[11,121,122,123,126],{},"Business logic stays ",[14,124,125],{},"in the app","; Actions is only an alarm clock — good enough for many internal use cases.",[128,129,131],"h3",{"id":130},"minimal-workflow-yaml","Minimal workflow (YAML)",[11,133,134,135,138],{},"Save as ",[40,136,137],{},".github\u002Fworkflows\u002Fcron-daily.yml"," (adjust URL and secret names):",[140,141,146],"pre",{"className":142,"code":143,"language":144,"meta":145,"style":145},"language-yaml shiki shiki-themes github-light github-dark","name: daily-cron-webhook\non:\n  schedule:\n    - cron: '0 9 * * *' # daily 09:00 UTC — check timezone vs business hours\n  workflow_dispatch: # allows manual runs from the UI\n\njobs:\n  call-app:\n    runs-on: ubuntu-latest\n    steps:\n      - name: POST \u002Fapi\u002Fcron\u002Fdaily\n        run: |\n          curl -fsS -X POST \"${{ secrets.APP_CRON_URL }}\" \\\n            -H \"Authorization: Bearer ${{ secrets.CRON_SECRET }}\" \\\n            -H \"Content-Type: application\u002Fjson\" \\\n            -d '{}'\n","yaml","",[40,147,148,165,175,183,200,211,218,226,234,245,253,266,278,284,290,296],{"__ignoreMap":145},[149,150,153,157,161],"span",{"class":151,"line":152},"line",1,[149,154,156],{"class":155},"s9eBZ","name",[149,158,160],{"class":159},"sVt8B",": ",[149,162,164],{"class":163},"sZZnC","daily-cron-webhook\n",[149,166,168,172],{"class":151,"line":167},2,[149,169,171],{"class":170},"sj4cs","on",[149,173,174],{"class":159},":\n",[149,176,178,181],{"class":151,"line":177},3,[149,179,180],{"class":155},"  schedule",[149,182,174],{"class":159},[149,184,186,189,191,193,196],{"class":151,"line":185},4,[149,187,188],{"class":159},"    - ",[149,190,79],{"class":155},[149,192,160],{"class":159},[149,194,195],{"class":163},"'0 9 * * *'",[149,197,199],{"class":198},"sJ8bj"," # daily 09:00 UTC — check timezone vs business hours\n",[149,201,203,206,208],{"class":151,"line":202},5,[149,204,205],{"class":155},"  workflow_dispatch",[149,207,160],{"class":159},[149,209,210],{"class":198},"# allows manual runs from the UI\n",[149,212,214],{"class":151,"line":213},6,[149,215,217],{"emptyLinePlaceholder":216},true,"\n",[149,219,221,224],{"class":151,"line":220},7,[149,222,223],{"class":155},"jobs",[149,225,174],{"class":159},[149,227,229,232],{"class":151,"line":228},8,[149,230,231],{"class":155},"  call-app",[149,233,174],{"class":159},[149,235,237,240,242],{"class":151,"line":236},9,[149,238,239],{"class":155},"    runs-on",[149,241,160],{"class":159},[149,243,244],{"class":163},"ubuntu-latest\n",[149,246,248,251],{"class":151,"line":247},10,[149,249,250],{"class":155},"    steps",[149,252,174],{"class":159},[149,254,256,259,261,263],{"class":151,"line":255},11,[149,257,258],{"class":159},"      - ",[149,260,156],{"class":155},[149,262,160],{"class":159},[149,264,265],{"class":163},"POST \u002Fapi\u002Fcron\u002Fdaily\n",[149,267,269,272,274],{"class":151,"line":268},12,[149,270,271],{"class":155},"        run",[149,273,160],{"class":159},[149,275,277],{"class":276},"szBVR","|\n",[149,279,281],{"class":151,"line":280},13,[149,282,283],{"class":163},"          curl -fsS -X POST \"${{ secrets.APP_CRON_URL }}\" \\\n",[149,285,287],{"class":151,"line":286},14,[149,288,289],{"class":163},"            -H \"Authorization: Bearer ${{ secrets.CRON_SECRET }}\" \\\n",[149,291,293],{"class":151,"line":292},15,[149,294,295],{"class":163},"            -H \"Content-Type: application\u002Fjson\" \\\n",[149,297,299],{"class":151,"line":298},16,[149,300,301],{"class":163},"            -d '{}'\n",[303,304,305,314],"ul",{},[71,306,307,310,311],{},[40,308,309],{},"APP_CRON_URL",": e.g. ",[40,312,313],{},"https:\u002F\u002Fwww.example.com\u002Fapi\u002Fcron\u002Fdaily",[71,315,316,318,319,322],{},[40,317,112],{},": long random string; ",[14,320,321],{},"same value"," in production env on the app.",[11,324,325,328,329,332],{},[14,326,327],{},"Security:"," do not log the secret; rotate if leaked; keep handlers ",[14,330,331],{},"idempotent"," when possible.",[63,334,336],{"id":335},"real-limits-do-not-ignore","Real limits (do not ignore)",[68,338,339,352,358,372],{},[71,340,341,344,345,347,348,351],{},[14,342,343],{},"Jitter \u002F delay:"," ",[40,346,42],{}," is not real-time; GitHub documents that runs can ",[14,349,350],{},"slip"," under load. Do not use this for trading, auctions, or sub-second payment windows.",[71,353,354,357],{},[14,355,356],{},"Actions minutes:"," free tiers have a monthly minute budget — multiply job duration × frequency. A 5-minute job every hour burns through free minutes fast.",[71,359,360,363,364,367,368,371],{},[14,361,362],{},"Hosting timeout:"," the POST must finish inside your function limit (e.g. ",[14,365,366],{},"10s"," on Vercel Hobby). For long work: enqueue internally (DB\u002Fqueue) and return ",[40,369,370],{},"202"," quickly.",[71,373,374,377,378,381],{},[14,375,376],{},"Public repos:"," YAML is visible; ",[14,379,380],{},"secrets"," are not — still never put bearer tokens in plain YAML.",[63,383,385],{"id":384},"when-the-pattern-is-not-enough","When the pattern is not enough",[303,387,388,394,400],{},[71,389,390,393],{},[14,391,392],{},"Queue + worker"," (BullMQ, Cloud Tasks, SQS): long jobs, fine-grained retries.",[71,395,396,399],{},[14,397,398],{},"Provider cron"," (Vercel Cron, Cloudflare Triggers): fewer moving parts if your plan already includes it.",[71,401,402,405],{},[14,403,404],{},"VPS + systemd timer:"," full control of the clock, fixed monthly cost.",[63,407,409,410],{"id":408},"disclosure-snowinchgithubcron","Disclosure: ",[40,411,412],{},"@snowinch\u002Fgithubcron",[11,414,415,416,420,421,424,425,428],{},"Snowinch maintains the open-source package ",[14,417,418],{},[40,419,412],{},", which ",[14,422,423],{},"generates"," workflows and typed handlers (e.g. ",[14,426,427],{},"Next.js App Router"," integration) on top of the same pattern. It is optional: manual YAML is already production-ready if you want zero dependencies.",[303,430,431,440],{},[71,432,433],{},[86,434,437,438],{"href":435,"rel":436},"https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@snowinch\u002Fgithubcron",[90],"npm ",[40,439,412],{},[71,441,442],{},[86,443,446],{"href":444,"rel":445},"https:\u002F\u002Fgithub.com\u002Fsnowinch\u002Fsnowinch-tools\u002Ftree\u002Fmain\u002Fpackages\u002Fgithubcron",[90],"Source \u002F docs",[11,448,449,450,453],{},"Library sketch (after ",[40,451,452],{},"pnpm add @snowinch\u002Fgithubcron","):",[140,455,459],{"className":456,"code":457,"language":458,"meta":145,"style":145},"language-typescript shiki shiki-themes github-light github-dark","import { ServerlessCron } from '@snowinch\u002Fgithubcron'\n\nexport const cron = new ServerlessCron({\n  secret: process.env.GITHUBCRON_SECRET,\n  baseUrl: process.env.NEXT_PUBLIC_APP_URL,\n})\n\ncron.job('send-daily-emails', {\n  schedule: '0 9 * * *',\n  handler: async () => {\n    const result = await sendDailyEmails()\n    return { sent: result.length }\n  },\n})\n\n\u002F\u002F app\u002Fapi\u002Fcron\u002F[job]\u002Froute.ts — Next.js App Router\nexport const POST = cron.nextjs.appRouter()\n","typescript",[40,460,461,475,479,503,514,524,529,533,550,559,578,597,611,616,620,624,629],{"__ignoreMap":145},[149,462,463,466,469,472],{"class":151,"line":152},[149,464,465],{"class":276},"import",[149,467,468],{"class":159}," { ServerlessCron } ",[149,470,471],{"class":276},"from",[149,473,474],{"class":163}," '@snowinch\u002Fgithubcron'\n",[149,476,477],{"class":151,"line":167},[149,478,217],{"emptyLinePlaceholder":216},[149,480,481,484,487,490,493,496,500],{"class":151,"line":177},[149,482,483],{"class":276},"export",[149,485,486],{"class":276}," const",[149,488,489],{"class":170}," cron",[149,491,492],{"class":276}," =",[149,494,495],{"class":276}," new",[149,497,499],{"class":498},"sScJk"," ServerlessCron",[149,501,502],{"class":159},"({\n",[149,504,505,508,511],{"class":151,"line":185},[149,506,507],{"class":159},"  secret: process.env.",[149,509,510],{"class":170},"GITHUBCRON_SECRET",[149,512,513],{"class":159},",\n",[149,515,516,519,522],{"class":151,"line":202},[149,517,518],{"class":159},"  baseUrl: process.env.",[149,520,521],{"class":170},"NEXT_PUBLIC_APP_URL",[149,523,513],{"class":159},[149,525,526],{"class":151,"line":213},[149,527,528],{"class":159},"})\n",[149,530,531],{"class":151,"line":220},[149,532,217],{"emptyLinePlaceholder":216},[149,534,535,538,541,544,547],{"class":151,"line":228},[149,536,537],{"class":159},"cron.",[149,539,540],{"class":498},"job",[149,542,543],{"class":159},"(",[149,545,546],{"class":163},"'send-daily-emails'",[149,548,549],{"class":159},", {\n",[149,551,552,555,557],{"class":151,"line":236},[149,553,554],{"class":159},"  schedule: ",[149,556,195],{"class":163},[149,558,513],{"class":159},[149,560,561,564,566,569,572,575],{"class":151,"line":247},[149,562,563],{"class":498},"  handler",[149,565,160],{"class":159},[149,567,568],{"class":276},"async",[149,570,571],{"class":159}," () ",[149,573,574],{"class":276},"=>",[149,576,577],{"class":159}," {\n",[149,579,580,583,586,588,591,594],{"class":151,"line":255},[149,581,582],{"class":276},"    const",[149,584,585],{"class":170}," result",[149,587,492],{"class":276},[149,589,590],{"class":276}," await",[149,592,593],{"class":498}," sendDailyEmails",[149,595,596],{"class":159},"()\n",[149,598,599,602,605,608],{"class":151,"line":268},[149,600,601],{"class":276},"    return",[149,603,604],{"class":159}," { sent: result.",[149,606,607],{"class":170},"length",[149,609,610],{"class":159}," }\n",[149,612,613],{"class":151,"line":280},[149,614,615],{"class":159},"  },\n",[149,617,618],{"class":151,"line":286},[149,619,528],{"class":159},[149,621,622],{"class":151,"line":292},[149,623,217],{"emptyLinePlaceholder":216},[149,625,626],{"class":151,"line":298},[149,627,628],{"class":198},"\u002F\u002F app\u002Fapi\u002Fcron\u002F[job]\u002Froute.ts — Next.js App Router\n",[149,630,632,634,636,639,641,644,647],{"class":151,"line":631},17,[149,633,483],{"class":276},[149,635,486],{"class":276},[149,637,638],{"class":170}," POST",[149,640,492],{"class":276},[149,642,643],{"class":159}," cron.nextjs.",[149,645,646],{"class":498},"appRouter",[149,648,596],{"class":159},[11,650,651,652,655,656,51],{},"Then ",[40,653,654],{},"npx githubcron generate"," to materialise workflow files under ",[40,657,658],{},".github\u002Fworkflows\u002F",[63,660,662],{"id":661},"summary","Summary",[68,664,665,672,683,692],{},[71,666,667,668,671],{},"Implement ",[14,669,670],{},"POST + secret"," in the app.",[71,673,674,675,680,681,51],{},"Add an ",[14,676,677],{},[40,678,679],{},"on.schedule"," workflow with ",[40,682,98],{},[71,684,685,686,691],{},"Validate with ",[14,687,688],{},[40,689,690],{},"workflow_dispatch"," before relying on cron alone.",[71,693,694,695,697,698,701],{},"Consider ",[40,696,412],{}," only if you want to ",[14,699,700],{},"generate"," that boilerplate across projects.",[11,703,704,705,51],{},"You do not need invented “€X\u002Fyear savings”: the operational test is whether ",[14,706,707],{},"the job runs observably and within GitHub + host limits",[709,710,711],"style",{},"html pre.shiki code .s9eBZ, html code.shiki .s9eBZ{--shiki-default:#22863A;--shiki-dark:#85E89D}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}",{"title":145,"searchDepth":167,"depth":167,"links":713},[714,717,718,719,721],{"id":65,"depth":167,"text":66,"children":715},[716],{"id":130,"depth":177,"text":131},{"id":335,"depth":167,"text":336},{"id":384,"depth":167,"text":385},{"id":408,"depth":167,"text":720},"Disclosure: @snowinch\u002Fgithubcron",{"id":661,"depth":167,"text":662},"\u002Fblog\u002F18_githubcron_cron_job_serverless_gratuiti_1x.webp","Serverless cron: a scheduled GitHub Actions workflow, an authenticated POST to your app, timing and minute limits. A pattern, not a tool gallery.",false,"md","en",{},"\u002Fen\u002Fblog\u002Fgithubcron-free-serverless-cron-jobs","2026-03-08",{"title":5,"description":723},"Serverless cron: GitHub Actions and APIs","githubcron-free-serverless-cron-jobs","en\u002Fblog\u002Fgithubcron-free-serverless-cron-jobs",[735,736,737,738,739],"githubcron","cron job serverless","github actions","automazione","open source","LIV5T6WaxBEG2itY1-obinLf-anyUZDncWQMKg8P5bA"]