This project uses Vercel Cron Jobs to automatically update the website content every day. No GitHub Actions required!
- Timestamp: Shows when products were last refreshed
- Featured Products: Rotates to display different products each day
- Trending Category: Highlights a different category daily
- Fresh Content: Keeps the site looking active and up-to-date
Go to your Vercel project dashboard → Settings → Environment Variables
Add these variables:
| Variable Name | Value | How to Get It |
|---|---|---|
GITHUB_TOKEN |
Your token | GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic) → Generate new token with repo scope |
VERCEL_DEPLOY_HOOK |
Deploy hook URL | Vercel → Project → Settings → Git → Deploy Hooks → Create hook |
CRON_SECRET |
Random string | Generate a random string (for manual trigger security) |
Important: After adding environment variables, redeploy your project!
- Go to https://github.com/settings/tokens
- Click "Generate new token (classic)"
- Select scopes: ✅
repo(Full control of private repositories) - Generate and copy the token
- Add to Vercel environment variables as
GITHUB_TOKEN
- Go to Vercel → Your Project → Settings → Git
- Scroll to "Deploy Hooks"
- Create hook:
- Name:
Daily Auto Update - Branch:
main
- Name:
- Copy the URL and add to Vercel as
VERCEL_DEPLOY_HOOK
The cron job runs at 6:00 AM UTC every day. Modify in vercel.json:
{
"crons": [
{
"path": "/api/daily-update",
"schedule": "0 6 * * *"
}
]
}Time format: Minute Hour Day Month DayOfWeek
Vercel Cron (Daily at 6 AM UTC)
↓
Calls /api/daily-update
↓
Updates products.ts via GitHub API:
- New timestamp
- Updated trending category
- Fresh content indicators
↓
Commits changes to GitHub
↓
Triggers Vercel redeployment
↓
Website updated with fresh content! 🎉
You can manually trigger the update by visiting:
https://your-domain.com/api/daily-update?secret=YOUR_CRON_SECRET
Replace YOUR_CRON_SECRET with the value you set in environment variables.
- Go to Vercel → Your Project → Logs
- Filter by "Cron" or look for
/api/daily-updaterequests
- Go to your GitHub repository
- Look for commits with message: "Auto-update: Daily refresh - [date]"
Visit your website and look for the lastUpdated timestamp in the footer or product section.
Edit vercel.json:
{
"crons": [
{
"path": "/api/daily-update",
"schedule": "0 9 * * *" // 9 AM UTC instead
}
]
}Then commit and push the changes.
Edit app/api/daily-update/route.ts:
// Modify the rotateFeaturedProducts function
const FEATURED_COUNT = 8; // Change this numberYou can extend app/api/daily-update/route.ts to:
- Fetch real-time prices from eBay API
- Update blog posts
- Change promotional banners
- Modify other files via GitHub API
To stop automatic updates, either:
Option 1: Delete or rename vercel.json
git rm vercel.json
git commit -m "Disable auto-updates"
git pushOption 2: Remove the cron configuration from vercel.json:
{
"crons": []
}Option 3: Remove environment variables from Vercel
- Check Vercel Logs for errors
- Verify environment variables are set correctly
- Ensure GitHub token has
repopermissions - Check that the cron schedule is valid
- Verify
VERCEL_DEPLOY_HOOKURL is correct - Check that the deploy hook is created for the correct branch
- Look at Vercel deployment logs
- The CRON_SECRET must match when manually triggering
- GitHub token might be expired - generate a new one
If you prefer not to use Vercel Cron Jobs, you can use external services:
- cron-job.org (Free)
- EasyCron (Free tier available)
- UptimeRobot (Has cron feature)
Set them to call:
https://your-domain.com/api/daily-update?secret=YOUR_CRON_SECRET
Then remove the vercel.json cron configuration.