- GitHub repository with clean code pushed
- Neon PostgreSQL database created
- Vercel account created
- Database seeded with
python seed.py
- Go to Vercel Dashboard
- Click "Add New..." → "Project"
- Select your GitHub repository:
Bharat-News-Api - Click "Import"
DO NOT click Deploy yet!
- Framework Preset:
Other - Root Directory:
./ - Build Command: (leave empty)
- Output Directory: (leave empty)
Click "Environment Variables" dropdown and add:
| Key | Value | Example |
|---|---|---|
DATABASE_URL |
Your Neon connection string | postgresql://user:password@ep-xxx.us-east-2.aws.neon.tech/bharatnews?sslmode=require |
CRON_SECRET |
Custom secure password | my_super_secret_key_2026 |
Important Notes:
- Copy your exact Neon connection string (includes
?sslmode=require) - Generate a strong
CRON_SECRET(save it for Step 2) - Both variables apply to: Production, Preview, and Development
- Click "Deploy"
- Wait 2-3 minutes for build completion
- Copy your live URL (e.g.,
https://bharat-news-api.vercel.app) - Test endpoint:
https://your-url.vercel.app/api/news
- Go to your GitHub repository
- Click Settings (top menu)
- Expand Secrets and variables → Click Actions
Click "New repository secret" for each:
- Name:
API_URL - Value:
https://your-vercel-url.vercel.app - Example:
https://bharat-news-api.vercel.app ⚠️ No trailing slash!
- Name:
CRON_SECRET - Value: (Same password you set in Vercel)
- Example:
my_super_secret_key_2026 ⚠️ Must match Vercel exactly!
Your Actions secrets page should show:
API_URL Updated X seconds ago
CRON_SECRET Updated X seconds ago
- Go to Actions tab in GitHub
- Click "Hourly News Fetcher" workflow
- Click "Run workflow" → "Run workflow"
- Wait 30-60 seconds
- Check run status (should be green ✓)
Click on the workflow run to see:
✓ Checkout code
✓ Trigger Vercel cron endpoint
✓ Response: {"status":"success","message":"Database updated"}
Test your API endpoint:
curl https://your-vercel-url.vercel.app/api/newsShould return JSON with news data.
GitHub Actions will now automatically:
- Run every hour at
:00(e.g., 1:00, 2:00, 3:00) - Call
https://your-url.vercel.app/api/cron/update - Refresh database with latest news
No further action required!
Solution: Check requirements.txt has all dependencies
Solution: Verify CRON_SECRET matches in both Vercel and GitHub
Solution: Check API_URL has no trailing slash and is correct
Solution:
- Check Vercel logs:
vercel logs <deployment-url> - Verify
DATABASE_URLis correct - Ensure database was seeded with
python seed.py
- Vercel deployment successful
- Environment variables added to Vercel
- GitHub Actions secrets configured
- Manual workflow test passed
- API endpoint returns data
- Hourly automation verified (wait 1 hour)
| Service | URL |
|---|---|
| Vercel Dashboard | https://vercel.com/dashboard |
| GitHub Actions | https://github.com/YOUR_USERNAME/Bharat-News-Api/actions |
| API Docs | https://your-url.vercel.app/docs |
| Live API | https://your-url.vercel.app/api/news |
🎉 Deployment Complete!
Your Bharat News API is now live and auto-updating every hour.