Simplest way to add cron job scheduler (PostgreSQL)
Hello. I have set up my project using the t3 stack and have added a custom server to my project (to set up a simple job queue using graphile-worker).
This works pretty well, but I’m now wondering, is it possible to just drop a file into the pages/api folder for a worker like this instead?
The Next.js docs recommended staying away from custom servers if you can, so I’m wondering if anyone has set something like this up without a custom server.
2 Replies
You can use some external cron service to call your api in /pages/api
if you deploy on vercel you can set up a cron job from the project settings - https://vercel.com/guides/how-to-setup-cron-jobs-on-vercel
If you're not on vercel you can use https://upstash.com/?ref=theo or https://cron-job.org/
Here is Theo's video on this topic - https://youtu.be/zdV_fXjoB-Q
Thank you! I will stick to the custom server in that case