This is a FastAPI backend that automatically reviews GitHub pull requests using AI. It processes code asynchronously with Celery and stores results in Redis. The goal is to provide developers structured feedback on style, bugs, performance, and best practices.
Features:
- Analyze GitHub PRs for code issues
- Asynchronous processing with Celery
- AI agent (stub included; can be replaced with OpenAI, LangChain, or Ollama)
- API Endpoints:
POST /analyze-pr,GET /status/{task_id},GET /results/{task_id} - Dockerized (FastAPI, Celery, Redis)
Tech Stack: Python 3.8+, FastAPI, Celery, Redis, Docker & Docker Compose, optional AI agent
Setup Instructions:
- Clone the repo:
git clone <repo_url> && cd <project_folder> - Create a virtual environment:
python -m venv venv
Activate it: Windows:venv\Scripts\activate| Linux/Mac:source venv/bin/activate - Install dependencies:
pip install -r requirements.txt - Copy
.env.exampleto.envand add your GitHub tokenGITHUB_TOKEN=your_token_here- Token is required for private repos and to avoid API rate limits
- To create a token: GitHub → Settings → Developer Settings → Personal Access Tokens → Generate new token with
repoorpublic_reposcope ## Demo for GetToken on github
- Run the project with Docker Compose:
docker compose up --build- FastAPI runs on
http://localhost:8000 - Celery worker processes tasks
- Redis acts as broker and result store
- FastAPI runs on
- Test the API at
http://localhost:8000/docs(Swagger UI)
Example Request:
POST /analyze-pr
{
"repo_url": "https://github.com/octocat/Hello-World",
"pr_number": 1,
"github_token": "your_token_here"
}