How to schedule daily deployments on Vercel

One of the main benefits of static sites made with NextJs or SvelteKit is having the ability to render the pages into HTML, making your site blazing fast. But if your static page relies on data while it's being built, you will run into the problem of having stale data unless your deploying everyday.

A quick fix to this is scheduling daily deployments for your site. Vercel doesn't have this out of the box but you can use a 3rd party service to accomplish it. And it's really easy!

1) Setup deploy hooks in Vercel

Go to your project dashboard and click on settings. Then in the Git tab, create a hook. You only need a name for it and the Git branch you want to deploy. It will then generate a URL. Copy this URL, we will need it.

Vercel deploy hook

2) Setup cron job

The folks at cron-job.org have made something really special. A 100% free cron job service.

If you don't know, cron jobs are just a piece of code you schedule to run at a certain time. In our case, we just want to call our deploy URL from Vercel once a day.

Create an account. Then go to the cronjobs tab and create a cron job. You only need a name, your Vercel deploy url, and set the execution schedule. In my case, I just want it to trigger at 1am daily.

cron-job.org create cron job

That's it, now your deploy hook will be called at 1am every morning.