Automatically follow people who star your repo โจ
Give back with a follow, powered by Next.js & GitHub Webhook
A Next.js 14 serverless GitHub webhook API to auto-follow users who star your repo โ ported from the Python version to Next.js API route with full secret verification and logging.
When someone stars this repo, GitHub sends a webhook that triggers this API. It:
- Validates the webhook signature
- Follows the user by sending a PUT request to
https://api.github.com/user/following/{username}with the GitHub token in theAuthorizationheader (Bearer <token>).
- Secure webhook secret validation
- Instant follow-back of new stargazers
- Simple setup with environment variables
- Logs for success and errors
You can set this up yourself to automatically follow users who star your repository.
-
Clone or download this repo
-
Rename
.env.exampleto.env.localand fill in your values:
GITHUB_TOKEN=your_github_personal_access_token
GITHUB_WEBHOOK_SECRET=your_webhook_secret
- The GitHub token needs the
user:followscope.
-
Deploy on Vercel
-
Add the webhook URL to your GitHub repo settings:
https://your-vercel-app.vercel.app/api/webhook
- Content type:
application/json - Secret: same as
GITHUB_WEBHOOK_SECRET
Logs are printed in Vercel serverless function console.
BSD-3-Clause license