Get Faster, Smarter Code Reviews on Any GitHub Repo!
- Docker
- AI Provider API Key (OpenAI or Claude)
- Github App
This guide explains how to deploy and test GitPack AI using Render and GitHub. Follow these steps in order to ensure proper setup and avoid common issues.
-
Web Service/Backend
- Processes GitHub events and generates AI reviews
- Required for PR review functionality
- Requires database connection
-
Frontend (Optional)
- Manages repositories at admin level
- Not required for PR review functionality
- Backend deployment alone is sufficient for PR reviews
-
Database
- Required for backend/web service
- Stores repository and organization data
- Create GitHub App (get credentials)
- Deploy database
- Deploy backend with proper environment variables
- Install GitHub App on repositories
- Deploy frontend (optional)
This order is crucial to avoid RepositoryNotFound exceptions, as the backend must be ready to handle installation webhooks.
-
Go to GitHub Settings > Developer Settings > GitHub Apps > New GitHub App
-
Fill in basic app information:
- Name: (e.g., GitPack AI)
- Homepage URL: (can be temporary, will update later)
- Webhook URL: (can be temporary, will update later)
- Webhook Secret: Generate with
openssl rand -hex 20
-
Set permissions:
- Repository permissions:
- Contents: Read
- Pull requests: Read & Write
- Organization permissions:
- Members: Read
- Repository permissions:
-
Subscribe to events:
- Pull request
- Installation
- Installation repositories
-
Save and collect credentials:
- Note down App ID
- Download private key (.pem file)
- Generate and save webhook secret
- Note Client ID and Secret (if using frontend)
# Environment
ENVIRONMENT=production # Must be 'production' on Render
# GitHub App Configuration (https://github.com/settings/apps)
GITHUBAPP_ID= # From GitHub App settings
GITHUBAPP_KEY= # Contents of the .pem file
GITHUB_WEBHOOK_SECRET= # From openssl rand -hex 20
# AI Provider Selection
GITPACK_AI_PROVIDER=claude # or 'openai'
# If using Claude
GITPACK_ANTHROPIC_API_KEY= # Your Anthropic API key
CLAUDE_MODEL=claude-3-opus-20240229 # Optional: Model to use (default: claude-3-opus-20240229)
CLAUDE_MAX_TOKENS=1500 # Optional: Maximum tokens for response (default: 1500)
# If using OpenAI
GITPACK_OPENAI_ORGANIZATION=
GITPACK_OPENAI_PROJECT=
GITPACK_OPENAI_API_KEY=
# GitHub OAuth (https://github.com/settings/developers)
# Only needed if deploying frontend
GITHUB_CLIENT_ID= # From GitHub OAuth App
GITHUB_CLIENT_SECRET= # From GitHub OAuth AppNEXT_PUBLIC_API_URL=backend-url
NEXT_PUBLIC_GITHUB_APP_HANDLE=your-github-app-nameYou can switch between AI providers by updating environment variables:
GITPACK_AI_PROVIDER=openai
GITPACK_OPENAI_ORGANIZATION=<your_openai_organization>
GITPACK_OPENAI_PROJECT=<your_openai_project>
GITPACK_OPENAI_API_KEY=<your_openai_api_key>GITPACK_AI_PROVIDER=claude
GITPACK_ANTHROPIC_API_KEY=<your_anthropic_api_key>After changing providers:
- Update environment variables in Render dashboard
- Redeploy the service
- Test with a new PR to verify the change
Deploy GitPack AI quickly and easily with Render.com. Click the button above to start the deployment process.
-
Fork and Update Deploy URL
- Fork the repository
- Update the repo name in the Quick Deploy URL
- For forked repos, change
gitpack-ai/gitpack-aitoyour-username/gitpack-ai
-
Initial Setup
- Click the Deploy to Render button
- Sign up on Render if needed
- The Blueprint will create:
- PostgreSQL database
- Web service (backend)
-
Configure Web Service
- Blueprint deployment will initially fail for backend
- Go to Render dashboard → Projects
- Select the web service
- Navigate to Environment in left panel
- Add required environment variables:
- ENVIRONMENT=production
- GITHUBAPP_ID
- GITHUBAPP_KEY
- GITHUB_WEBHOOK_SECRET
- GITPACK_AI_PROVIDER
- GITPACK_ANTHROPIC_API_KEY (if using Claude)
- CLAUDE_MODEL (optional, defaults to claude-3-opus-20240229)
- CLAUDE_MAX_TOKENS (optional, defaults to 1500)
- GITHUB_CLIENT_ID (if deploying frontend)
- GITHUB_CLIENT_SECRET (if deploying frontend)
- Click "Manual Deploy" → "Deploy latest commit"
-
Verify Deployment
- Wait for service to deploy completely
- Check Events tab in Render for logs
- Verify webhook endpoint is accessible
-
Test Integration
- Install GitHub App on your repository
- Create a test pull request
- Check web service logs for review generation
- Clone repository:
git clone https://github.com/your-username/gitpack-ai.git
cd gitpack-ai-
Set up environment:
- Copy
.env.exampletogitpack/.env - Copy
.env.local.exampletofrontend/.env.local - Update variables with your credentials
- Copy
-
Run with Docker:
docker-compose up --buildServices will be available at:
- Backend: https://localhost:8000
- Frontend: https://localhost:3000
- Database: localhost:5435
- Go to your GitHub repository
- Click on "Settings" in the top menu
- Select "Integrations" from the left sidebar
- Click on "Add GitHub App" in the "Installed GitHub Apps" section
- Find "GitPack AI" (or your app name) in the list
- Click "Install"
The bot automatically triggers on:
- New pull requests
- Updates to existing pull requests
For each trigger, the bot will:
- Analyze the changes in the pull request
- Generate an overall review of the changes
- Provide line-specific comments and suggestions
- Add improvement recommendations where applicable
No manual intervention is needed - the bot automatically reviews all PRs in repositories where it's installed.
The bot provides:
-
Overall Code Review
- Architecture assessment
- Code quality evaluation
- Best practices recommendations
-
Line-Specific Comments
- Detailed explanations of issues
- Code improvement suggestions
- Performance considerations
-
Automated Suggestions
- Code fixes
- Style improvements
- Documentation recommendations
This usually occurs when webhooks are processed before the backend is ready:
- Ensure this deployment order:
- Database fully provisioned first
- Backend deployed with migrations complete
- GitHub App installed last
- If error occurs:
- Check backend logs for migration status
- Verify organization and repository records exist
- Reinstall GitHub App if needed
- Verify webhook secret matches in GitHub App and backend
- Check webhook URL is accessible
- Review webhook delivery logs in GitHub App settings
- Common webhook errors:
- 404: Wrong webhook URL or backend not deployed
- 401: Incorrect webhook secret
- 500: Database not ready or migration issues
- Verify all GitHub-related environment variables
- Ensure OAuth callback URLs are correct
- Check frontend API URL configuration
- Common auth errors:
- Invalid redirect_uri: Callback URL mismatch
- Invalid client_id: Wrong GitHub App credentials
- State mismatch: Session issues
For issues and questions:
- Check the Common Issues section above
- Review Render logs for specific error messages
- Open an issue if needed