A lightweight, AI-powered code review tool inspired by CodeRabbit. This project provides automated code analysis, intelligent review comments, and seamless integration with popular Git platforms, now powered by Supabase.
- AI-Powered Code Reviews: Leverages Groq's Kimi K2 model for intelligent code analysis and suggestions
- Multi-Platform Support: Works with GitHub, GitLab, and Bitbucket repositories
- Real-time Analysis: Automated reviews triggered by pull request events
- Security Scanning: Identifies potential security vulnerabilities in code changes
- Code Quality Metrics: Analyzes code complexity, maintainability, and best practices
- Interactive Dashboard: Modern React-based UI for managing repositories and reviews
- RESTful API: FastAPI-based backend with comprehensive API documentation
- Supabase Integration: PostgreSQL database with real-time subscriptions and Row Level Security
- Supabase Authentication: Built-in user authentication with email/password and social providers
- Webhook Integration: Secure webhook handling for Git platform events
- Background Processing: Celery-based task queue for asynchronous operations
- Caching: Redis integration for improved performance
- TypeScript: Type-safe JavaScript development
- Material-UI: Professional React component library
- React Router: Client-side routing
- Axios: HTTP client for API communication
- FastAPI: High-performance Python web framework
- Supabase: PostgreSQL database with real-time subscriptions and Row Level Security
- Supabase Python Client: Direct database operations and authentication
- Groq Kimi K2: AI-powered code analysis and review generation
- React 18: Modern UI library with hooks
- TypeScript: Type-safe JavaScript development
- Material-UI: Professional React component library
- React Router: Client-side routing
- Axios: HTTP client for API communication
karakoram-2-mini/
├── app/ # Backend FastAPI application
│ ├── api/ # API route handlers
│ │ ├── auth.py # Authentication endpoints
│ │ ├── repositories.py # Repository management
│ │ ├── reviews.py # Review management
│ │ └── webhooks.py # Webhook handlers
│ ├── services/ # Business logic services
│ │ ├── groq_service.py # Groq integration
│ │ ├── github_service.py # GitHub API client
│ │ ├── code_analyzer.py # Static code analysis
│ │ └── review_service.py # Review orchestration
│ ├── models.py # Database models
│ ├── schemas.py # Pydantic schemas
│ ├── auth.py # Authentication utilities
│ ├── config.py # Application configuration
│ ├── database.py # Database setup
│ └── main.py # FastAPI application entry point
├── frontend/ # React frontend application
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── pages/ # Page components
│ │ ├── contexts/ # React contexts
│ │ └── App.tsx # Main application component
│ └── package.json # Frontend dependencies
├── alembic/ # Database migrations
├── requirements.txt # Python dependencies
├── supabase_schema.sql # Supabase database schema
└── README.md # This file
- Python 3.8+
- Node.js 16+
- Supabase account
- Redis 6+ (optional, for caching)
-
Create a Supabase project
- Go to supabase.com
- Create a new project
- Note your project URL and anon key
-
Set up the database schema
- Go to your Supabase dashboard
- Navigate to SQL Editor
- Copy and paste the contents of
supabase_schema.sql - Run the SQL commands to create tables and policies
-
Clone the repository
git clone <repository-url> cd karakoram-2-mini
-
Create virtual environment
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Environment configuration
cp .env.example .env # Edit .env with your Supabase configuration: # SUPABASE_URL=https://your-project-ref.supabase.co # SUPABASE_ANON_KEY=your-supabase-anon-key # SUPABASE_SERVICE_ROLE_KEY=your-supabase-service-role-key
-
Start the backend server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
-
Navigate to frontend directory
cd frontend -
Environment configuration
cp .env.example .env # Edit .env with your Supabase configuration: # REACT_APP_SUPABASE_URL=https://your-project-ref.supabase.co # REACT_APP_SUPABASE_ANON_KEY=your-supabase-anon-key
-
Install dependencies
npm install
-
Start the development server
npm start
The application will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
## Configuration
### Environment Variables
Create a `.env` file based on `.env.example`:
```env
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/karakoram_db
# Redis (optional)
REDIS_URL=redis://localhost:6379
# Groq API
GROQ_API_KEY=your-groq-api-key-here
# GitHub Integration
GITHUB_APP_ID=your-github-app-id
GITHUB_PRIVATE_KEY=your-github-private-key
GITHUB_WEBHOOK_SECRET=your-webhook-secret
# Application
DEBUG=True
CORS_ORIGINS=["http://localhost:3000"]
- Create a GitHub App or use webhooks
- Set the webhook URL to:
https://your-domain.com/webhooks/github - Subscribe to
pull_requestandpushevents - Add the webhook secret to your environment variables
POST /auth/register- Register new userPOST /auth/login- User loginGET /auth/me- Get current user
GET /repositories/- List repositoriesPOST /repositories/- Add repositoryGET /repositories/{id}- Get repository detailsPUT /repositories/{id}/settings- Update settingsDELETE /repositories/{id}- Deactivate repository
GET /reviews/- List reviewsPOST /reviews/- Create new reviewGET /reviews/{id}- Get review detailsGET /reviews/pull-requests/{pr_id}/reviews- Get PR reviews
POST /webhooks/github- GitHub webhook handlerPOST /webhooks/gitlab- GitLab webhook handlerPOST /webhooks/bitbucket- Bitbucket webhook handler
- Uses Groq Kimi K2 model for intelligent code review
- Analyzes code diffs for quality, security, and performance issues
- Generates human-readable suggestions and improvements
- Provides overall code quality scores
- Pattern-based security vulnerability detection
- Code quality checks (complexity, style, best practices)
- Language-specific analysis for Python, JavaScript, and more
- Configurable rules and severity levels
- Automatic PR monitoring via webhooks
- Real-time review triggering on PR events
- Support for multiple repositories
- Secure webhook signature verification
- Responsive Material-UI design
- Real-time review status updates
- Detailed review reports with syntax highlighting
- Repository management dashboard
# Backend tests
pytest
# Frontend tests
cd frontend && npm test# Create new migration
alembic revision --autogenerate -m "Description"
# Apply migrations
alembic upgrade head
# Rollback migration
alembic downgrade -1# Python
black app/
isort app/
# TypeScript/React
cd frontend && npm run format# Build and run with docker-compose
docker-compose up -d- Set up production environment variables
- Configure reverse proxy (nginx)
- Set up SSL certificates
- Configure database and Redis
- Deploy backend and frontend separately
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions, please open an issue on GitHub or contact the development team.
Karakoram 2 Mini - Bringing AI-powered code review to your development workflow.