Skip to content

liamstamper/lamp-bot

Repository files navigation

GitHub Readme Stats

Lamp

An AI-Powered Code Review Bot for your Pull Requests

Description

Lamp is a GitHub App that automatically reviews Pull Requests and posts AI-generated feedback. Built with Next.js Hono, it listens for webhook events, fetches changed files, and generates comments on open PRs—helping teams quickly review and refine their code.

Install page: https://github.com/apps/lampbot

Usage

  1. Install the App
    Head over to the Lamp PR Bot App Page.

    • Click Install to grant Lamp access to your desired repositories.
  2. Open a Pull Request

    • Once installed, open (or update) a PR in any repo where Lamp is installed.
    • Lamp automatically listens for the pull_request event.
  3. Receive AI-Generated Feedback

    • The bot reviews the PR’s changed files and posts a comment with AI-based suggestions.
    • Login with github at lampbot.io to build custom prompts and manage repositories.

Development Setup

1. Get Started

  1. Fork the Repository:
    Fork the project repo to your personal github

  2. Configure Environment Variables:

    • Copy the example file to create your local .env:

      cp .env.example .env

    • Update the values in your .env file

      • (Ignore the NEONDATABASE_URL and all GITHUB* env values for now)
      • Generate a JWT_SECRET: openssl rand -base64 32
      • Get a GROQ_API_KEY: https://console.groq.com/login
  3. Set Up Vercel Hosting:

    • Log in to Vercel.
    • Select your forked repository to host the project

2. Set Up Neon DB

  1. Go to your Vercel Project Page -> Storage

    • Click Create Database and select Neon
    • Choose your closest region and free plan
    • Hit Connect and copy your database url
    • Set the NEON_DATABASE_URL in your .env
  2. Apply the schema

    • run the following command:

      psql "<your_db_string>" < ./lib/db/schema.sql


If you update or create a new table to output the new sql schema run pg_dump --schema-only --no-owner --no-privileges "DATABASE_URL" > lib/db/schema.sql

3. Set Up GitHub App for Webhooks

To test webhook functionality, create and configure a GitHub App as follows:

  1. Create the GitHub App:

    • Go to GitHub → Settings → Developer settings → GitHub Apps.
    • Click on New GitHub App.
  2. Fill Out Basic Information:

    • Homepage URL: Use your hosted URL from Vercel (e.g., https://your-app.vercel.app).
    • Webhook URL: Set this to your webhook endpoint (e.g., https://your-app.vercel.app/api/webhook).
  3. Set App Permissions: Under the Permissions & Webhooks section, configure the following permissions:

    • Commit Status: Read and Write
    • Contents: Read-only
    • Pull Requests: Read and Write
  4. Subscribe to Events: In the same section, subscribe to:

    • Pull Request events
    • *Push events
  5. Save and Install the App:

    • Save your changes.
    • Install the GitHub App on the target repositories where you plan to test the webhook functionality.
  6. Add the following values from your app to your .env

    • GITHUB_APP_ID
    • GITHUB_APP_PRIVATE_KEY (convert this to base64: echo -n '<my_key>' | openssl base64)

4. Set up Github Oath App

  1. Navigate to GitHub Developer Settings:

    • Log in to your GitHub account.
    • Go to Settings -> Developer Settings -> OAuth Apps.
  2. Register a New OAuth Application:

    • Fill in the required details:
      • Homepage URL: (https://your-app.vercel.app)
      • Authorization Callback URL: (https://your-app.vercel.app/api/auth/callback)
  3. Retrieve Your Client Credentials:

    • After the app is created, GitHub will provide you with a Client ID.
    • Click on Generate a new client secret to create your Client Secret.
  4. Add the values to your .env and vercel environmental variables

    GITHUB_CLIENT_ID=your_github_client_id

    GITHUB_CLIENT_SECRET=your_github_client_secret

    GITHUB_CALLBACK_URL=https://your-app.vercel.app/api/auth/callback

    (Use the dev server for your .env's local callback url: http://localhost:3000/api/auth/github/callback)

About

AI-powered pull request review SAAS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages