Local Setup
Prerequisites
Section titled “Prerequisites”Before you begin, ensure you have the following installed:
- Bun
- PostgreSQL (with
pgvector) - Inngest Dev Server
Step-by-Step Guide
Section titled “Step-by-Step Guide”-
Clone the Repository
Terminal window git clone https://github.com/my-org/my-repo.gitcd my-repo/ai-code-review -
Install Dependencies
Terminal window bun install -
Configure Environment Variables Create a
.envfile in the root of theai-code-reviewdirectory.DATABASE_URL="postgresql://user:password@localhost:5432/dbname"GOOGLE_GENERATIVE_AI_API_KEY="your-gemini-key"GITHUB_CLIENT_ID="your-github-id"GITHUB_CLIENT_SECRET="your-github-secret"BETTER_AUTH_SECRET="your-auth-secret"GROQ_API_KEY="your-groq-key"HF_TOKEN="your-huggingface-token" -
Database Migration Apply the Prisma schema to your local database.
Terminal window bun x prisma db push -
Start Inngest Dev Server In a separate terminal, start the Inngest local server.
Terminal window npx inngest-cli@latest dev -
Run Development Server
Terminal window bun dev
Connecting GitHub Webhooks
Section titled “Connecting GitHub Webhooks”To test PR reviews locally, you must use a tool like ngrok to expose your local server to GitHub.
- Start ngrok:
ngrok http 3000 - Add the ngrok URL to your GitHub App’s Webhook settings:
https://<your-id>.ngrok.app/api/webhooks/github - Ensure the
pull_requestevent is selected.