Skip to content

Pratham-Prog861/code-review-agent

Repository files navigation

πŸ€– Code Review Agent

An AI-powered code analysis platform that provides instant, intelligent code reviews with advanced token compression technology. Built with Next.js 16, React 19, and powered by Google's Gemini AI and ScaleDown compression.

Next.js React TypeScript Tailwind CSS License

✨ Features

  • πŸ€– AI-Powered Analysis - Advanced code review using Google Gemini 2.5 Flash
  • ⚑ Smart Compression - Up to 70% token reduction with ScaleDown technology
  • πŸ”’ Security First - Comprehensive security vulnerability detection
  • πŸ“Š Quality Scoring - Automated code quality assessment (0-100 scale)
  • 🎨 Multi-Language Support - JavaScript, TypeScript, Python, Java, C++, Go, Rust
  • πŸ“ˆ Real-time Feedback - Instant analysis as you code
  • πŸ’° Cost Savings - Reduced API costs through intelligent compression
  • πŸŒ“ Dark Mode - Beautiful UI with light and dark themes
  • πŸ“± Responsive Design - Works seamlessly on desktop, tablet, and mobile

πŸš€ Quick Start

Prerequisites

  • Node.js 20.x or higher
  • npm, yarn, pnpm, or bun
  • Google Gemini API key (Get one here)
  • ScaleDown API key - optional but recommended (Get one here)

Installation

  1. Clone the repository
git clone https://github.com/pratham-prog861/code-review-agent.git
cd code-review-agent
  1. Install dependencies
npm install
  1. Set up environment variables
cp .env.example .env.local

Edit .env.local and add your API keys:

GEMINI_API_KEY=your_gemini_api_key_here
SCALEDOWN_API_KEY=your_scaledown_api_key_here
  1. Run the development server
npm run dev
  1. Open your browser

Navigate to http://localhost:3000

πŸ“– Usage

  1. Paste your code into the editor
  2. Select the programming language (JavaScript, TypeScript, Python, etc.)
  3. Choose review depth:
    • Quick Scan - Fast, focuses on critical issues (5-10s)
    • Standard Review - Balanced analysis (10-20s) ⭐ Recommended
    • Deep Analysis - Comprehensive review (20-40s)
  4. Toggle compression to save on API costs (recommended)
  5. Click "Review Code" and get instant feedback!

Example

// Paste this code to try it out
async function fetchUser(id) {
  const response = await fetch(`/api/users/${id}`);
  return response.json();
}

You'll receive:

  • βœ… Quality score (e.g., 75/100)
  • πŸ”΄ Critical issues (security, bugs)
  • ⚠️ Warnings (best practices)
  • πŸ’‘ Suggestions (improvements)
  • πŸ“Š Token usage statistics

πŸ› οΈ Tech Stack

πŸ“š Documentation

Comprehensive documentation is available in the docs/ folder:

🎯 Supported Languages

Language Focus Areas
JavaScript ES6+, async/await, memory leaks, XSS prevention
TypeScript Type safety, generics, null handling, React/Next.js patterns
Python PEP 8, type hints, exception handling, security
Java OOP principles, Stream API, concurrency, Spring Boot
C++ Memory management, RAII, STL, move semantics
Go Goroutines, error handling, interfaces, idiomatic patterns
Rust Ownership, borrowing, lifetimes, unsafe code

πŸ“Š Review Depth Options

Quick Scan ⚑

  • Speed: 5-10 seconds
  • Focus: Critical bugs and syntax errors only
  • Best For: Rapid feedback, pre-commit checks

Standard Review ⭐ (Recommended)

  • Speed: 10-20 seconds
  • Focus: Bugs, style, best practices, performance
  • Best For: Regular development workflow

Deep Analysis πŸ”

  • Speed: 20-40 seconds
  • Focus: Architecture, security, performance, edge cases
  • Best For: Production code, security audits

πŸ” Security

  • βœ… Your code is never stored on our servers
  • βœ… All communication is encrypted via HTTPS
  • βœ… API keys are stored securely in environment variables
  • βœ… No third-party tracking or analytics
  • βœ… Client-side processing for maximum privacy

πŸ’° Cost Optimization

With ScaleDown compression enabled:

Without Compression:
  1,000 reviews/month Γ— 2,000 tokens = 2M tokens
  Cost: ~$20/month

With Compression (70% savings):
  1,000 reviews/month Γ— 600 tokens = 600K tokens
  Cost: ~$6/month

Monthly Savings: $14 πŸ’°

🚒 Deployment

Vercel (Recommended)

Deploy with Vercel

# Install Vercel CLI
npm i -g vercel

# Deploy
vercel

# Set environment variables
vercel env add GEMINI_API_KEY
vercel env add SCALEDOWN_API_KEY

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Quick Start for Contributors

# Fork and clone
git clone https://github.com/pratham-prog861/code-review-agent.git

# Install dependencies
npm install

# Create feature branch
git checkout -b feature/amazing-feature

# Make changes and commit
git commit -m "feat: add amazing feature"

# Push and create PR
git push origin feature/amazing-feature

πŸ“ Scripts

npm run dev          # Start development server
npm run build        # Build for production
npm run start        # Start production server
npm run lint         # Run ESLint

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

⭐ Show Your Support

If you find this project helpful, please consider giving it a star on GitHub!


Made with ❀️ by Pratham Darji

About

An AI-powered code analysis platform that provides instant, intelligent code reviews with advanced token compression technology. Built with Next.js 16, React 19, and powered by Google's Gemini AI and ScaleDown compression.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors