Skip to content

Local Setup

Before you begin, ensure you have the following installed:

  1. Clone the Repository

    Terminal window
    git clone https://github.com/my-org/my-repo.git
    cd my-repo/ai-code-review
  2. Install Dependencies

    Terminal window
    bun install
  3. Configure Environment Variables Create a .env file in the root of the ai-code-review directory.

    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"
  4. Database Migration Apply the Prisma schema to your local database.

    Terminal window
    bun x prisma db push
  5. Start Inngest Dev Server In a separate terminal, start the Inngest local server.

    Terminal window
    npx inngest-cli@latest dev
  6. Run Development Server

    Terminal window
    bun dev

To test PR reviews locally, you must use a tool like ngrok to expose your local server to GitHub.

  1. Start ngrok: ngrok http 3000
  2. Add the ngrok URL to your GitHub App’s Webhook settings: https://<your-id>.ngrok.app/api/webhooks/github
  3. Ensure the pull_request event is selected.