An automated code review tool built with FastAPI, Celery, and Redis, deployed on Render. The application provides intelligent code review capabilities for GitHub pull requests.
🔗 Frontend Deployment: https://ai-code-review-fe.vercel.app/ 🔗 Live API URL : https://fastapi-app-y507.onrender.com
- Backend: FastAPI
- Task Queue: Celery
- Caching: Redis
- AI Model: Mistral AI
- Frontend: Next.js
- Deployment: Vercel (Frontend), Render (Backend)
-
Clone the repository:
git clone https://github.com/kinshuksinghbist/AI_Code_Review_BE.git
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install dependencies:
pip install -r requirements.txt
-
Start the FastAPI server:
uvicorn api.app:app --reload
-
Start the Celery worker (in a separate terminal):
celery -A api.celery.app worker --loglevel=info
Known Issues currently
main
: Deployment-ready version (without async Celery)local
: Development branch with full async Celery support
- Next.js: Chosen for frontend development and easy deployment
- Redis: Selected for fast caching and personal experience with redis and redis-cli
- Mistral AI & Langchain: Utilized for straightforward AI integration. Also mistral ai is free
- Deployment Strategy: Leveraged Vercel and Render for efficient hosting.
- Automated GitHub PR code reviews
- Asynchronous task processing
- Caching of review results using redis
- Flexible AI-powered analysis
Full API documentation with curl requests is available at https://fastapi-app-y507.onrender.com/api/docs
- Endpoint:
POST /api/analyze-pr
- Purpose: Submit a PR for code review
- Request Body:
{ "repo_owner": "string", "repo_name": "string", "pr_number": 123, "github_token": "string" }
- Endpoint:
GET /api/status/{task_id}
- Purpose: Check the status of a code review task
- Endpoint:
GET /api/results/{task_id}
- Purpose: Retrieve the final results of a code review task
- Define more structured response formats,
- Implement more granular AI task segmentati and go through the git diffs assiging smaller and more precise roles to the ai agent, giving it more powerful tools
- Add Grafana logging
- Add async processing for deployment environments