Auto-tweet summaries of your GitHub commits and pull requests using AI.
- π Per-user OAuth: Each user tweets from their own X (Twitter) account via Privy
- π€ AI Summaries: LLM-generated, tweet-sized summaries of code changes
- π Secret Detection: Automatically scans for secrets/PII before posting
- π° Solana Ready: Embedded Solana wallets for future token launches
- βοΈ Flexible Rules: Configure auto-tweet per repo and branch
git clone <your-repo>
cd gitpost
npm installStep 1: Create Privy Account & App
- Go to https://dashboard.privy.io
- Sign up or log in
- Click "Create new app"
- Enter app name (e.g., "GitPost")
- Select app type: Web App
Step 2: Configure Login Methods
- In dashboard, go to "Login methods" (left sidebar)
- Enable these providers:
- β Email (toggle ON)
- β Twitter (toggle ON)
- β Wallets β Click to expand β Enable Solana
Step 3: Enable "Return OAuth tokens" for Twitter
- Still in "Login methods", click on Twitter card
- Scroll down to find "Return OAuth tokens" toggle
- Turn it ON (this is criticalβlets your backend access user's X tokens)
- Click "Save changes" at bottom
Step 4: Configure Embedded Wallets
- Go to "Embedded wallets" in left sidebar
- Under "Wallet creation":
- Set "Create on login" β "Users without wallets"
- Under "Supported chains":
- Ensure Solana is checked β
- Click "Save"
Step 5: Copy Your Credentials
- Go to "Settings" β "Basics" in left sidebar
- Find App ID:
- Copy the value (starts with
clp...) - This is your
NEXT_PUBLIC_PRIVY_APP_ID
- Copy the value (starts with
- Find App Secret:
- Click "Show" button to reveal
- Copy the value
- This is your
PRIVY_APP_SECRET
- Paste both into your
.env.localfile
Step 1: Create X Developer Account
- Go to https://developer.x.com
- Sign in with your X (Twitter) account
- If first time, click "Sign up for Free Account"
- Fill out application:
- Use case: "Building a developer tool"
- Description: "Auto-tweeting GitHub code changes"
- Verify email if prompted
Step 2: Create a Project
- In Developer Portal dashboard, click "+ Create Project" (or "Projects & Apps" β "Overview" β "+ Create Project")
- Fill out:
- Project name:
GitPost - Use case: Select "Making a bot" or "Exploring the API"
- Description: "Auto-tweet GitHub commits with AI summaries"
- Project name:
- Click "Next" β "Next" β "Complete"
Step 3: Create an App
- After creating project, click "+ Add App" (or it auto-prompts you)
- Select "Production" environment
- App name:
gitpost-app(must be globally unique on X) - Click "Complete"
- You'll see API Key and API Secret β Save these (you'll need them in Step 7)
Step 4: Enable OAuth 2.0 User Authentication
- In your app dashboard, click "Settings" tab (top)
- Scroll down to "User authentication settings" section
- Click "Set up" button
Step 5: Configure OAuth 2.0 Settings
- App permissions: Select "Read and write" (required for posting tweets)
- Type of App: Select "Web App, Automated App or Bot"
- App info:
- Callback URI / Redirect URL:
http://localhost:3000(for dev)- Later for production, add:
https://yourdomain.com
- Later for production, add:
- Website URL:
http://localhost:3000
- Callback URI / Redirect URL:
- Click "Save"
Step 6: Get OAuth 2.0 Client Credentials
- After saving, you'll see a modal with:
- Client ID β Copy this
- Client Secret β Click "Yes, I saved it" only after copying
- Save to
.env.local:X_CLIENT_ID=<paste_client_id_here> X_CLIENT_SECRET=<paste_client_secret_here>
Step 7: Add X API Credentials to Privy
- Go back to https://dashboard.privy.io
- Navigate to "Login methods" β Click "Twitter"
- Scroll to "OAuth credentials" section
- Enter:
- API Key: (from Step 3βyour X app's API Key)
- API Secret: (from Step 3βyour X app's API Secret)
- If you lost them: Go to X Developer Portal β Your App β "Keys and tokens" β Regenerate
- Click "Save changes"
Step 8: Upgrade to Basic Tier (Optional)
- Free tier: 500 tweet writes/month (~16/day)
- Basic tier: $100/mo, 50k writes/month
- To upgrade:
- X Developer Portal β Click your project
- Click "Upgrade" or go to "Products" tab
- Select "Basic" plan and add payment
β What You Should Have Now:
# In your .env.local:
NEXT_PUBLIC_PRIVY_APP_ID=clp1a2b3c4d5e6f7g8h9...
PRIVY_APP_SECRET=privy_secret_xyz789...
X_CLIENT_ID=a1B2c3D4e5F6g7H8i9...
X_CLIENT_SECRET=z9Y8x7W6v5U4t3S2r1...- Go to https://github.com/settings/apps (or your org settings)
- Create new GitHub App:
- Webhook URL:
https://yourdomain.com/api/webhooks/github(use ngrok for local:ngrok http 3000) - Webhook secret: Generate random string
- Permissions:
- Repository contents: Read
- Pull requests: Read
- Metadata: Read
- Subscribe to events:
push,pull_request
- Webhook URL:
- Copy credentials:
GITHUB_APP_ID=<your_app_id> GITHUB_WEBHOOK_SECRET=<your_webhook_secret> - Generate private key:
- Download the
.pemfile - Save as
github-app-private-key.pemin project root
- Download the
- Go to https://platform.openai.com
- Create API key
- Copy:
OPENAI_API_KEY=<your_api_key>
- Create Postgres database (Vercel Postgres, Supabase, or local)
- Copy connection string:
POSTGRES_URL=<your_postgres_url> - Run schema:
psql $POSTGRES_URL -f lib/db/schema.sql
openssl rand -base64 32Copy output:
ENCRYPTION_KEY=<your_generated_key>
Create .env.local:
cp .env.example .env.localFill in all values from steps above.
npm run dev- Deploy to Vercel/Railway/similar
- Update callback URLs in Privy and X Developer settings:
https://yourdomain.com/api/auth/callback
- Update GitHub App webhook URL:
https://yourdomain.com/api/webhooks/github
- Set all environment variables in production
- Sign in with email/wallet/Twitter via Privy
- Connect X account to enable tweeting
- Install GitHub App on your repositories
- Configure repos:
- Enable/disable auto-tweet
- Set which branches trigger tweets (e.g.,
main,prod)
- User pushes to a configured repo/branch
- GitHub webhook fires β your server receives event
- Server fetches diff, runs secret scanner
- LLM generates tweet-sized summary
- Posts to X using user's OAuth tokens
- Saves record to database
app/
βββ api/
β βββ auth/store-tokens/ # Store user's X OAuth tokens
β βββ repos/connect/ # Connect GitHub repos to users
β βββ repos/settings/ # Update repo tweet settings
β βββ webhooks/github/ # Handle GitHub events
lib/
βββ db/ # Database schema & queries
βββ services/
β βββ summarizer.ts # LLM + secret detection
β βββ twitter.ts # X API posting
βββ utils/
βββ encryption.ts # Token encryption (AES-256-GCM)
βββ github.ts # GitHub API helpers
βββ privy-server.ts # Privy auth verification
- X OAuth tokens encrypted at rest (AES-256-GCM)
- Secret patterns detected before posting:
- API keys, tokens, passwords
- Private keys, JWTs
- Database connection strings
- Sensitive files (.env, credentials.json) blocked
- πͺ Token launches: Create Solana tokens from PRs
- π¨ Custom prompts: Let users customize summary style
- π Analytics: Track tweet engagement
- π Manual approval queue: Review tweets before posting
- X Free Tier: ~500 writes/month (~16/day)
- X Basic: ~50k writes/month
- Consider adding rate limiting/rules:
- Only tweet on
mainbranch - Require
[tweet]in commit message - Manual approve queue
- Only tweet on
- Verify
GITHUB_WEBHOOK_SECRETmatches GitHub App settings - Check webhook payload is being verified correctly
- Verify X OAuth tokens are stored (check "Connect X" button)
- Check X API rate limits
- Ensure X app has Read + Write permissions
- Check diff for exposed API keys/tokens
- Add files to
.gitignorebefore committing
MIT