Skip to content

Latest commit

Β 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” AI-Powered Code Reviewer

CodeLens Banner

Supercharge your development with real-time AI code reviews, vulnerability detection, and 1-click automated fixes powered by Google Gemini.

GitHub stars FastAPI React 19 Vite Google Gemini SQLite License: MIT

Live Demo β€’ Key Features β€’ Architecture β€’ Quick Start β€’ API Reference β€’ Project Structure


🎬 Demo & Visuals

πŸ“Έ Application Dashboard & Real-Time Code Analysis

Below is the CodeLens review dashboard showcasing real-time issue detection, severity badges, and side-by-side diff fixes:

CodeLens Dashboard Screenshot

πŸŽ₯ Video Demonstration

https://github.com/user-attachments/assets/your-video-id-here

▢️ Click to view local video embed instructions

If running locally or viewing in compatible markdown previewers:

<video src="assets/demo-video.mp4" controls width="100%" poster="assets/demo-screenshot.png">
  Your browser does not support the video tag.
</video>

Tip: When opening a Pull Request or creating a GitHub Release, you can drag and drop your .mp4 video directly into GitHub's editor to generate a hosted video URL.


✨ Key Features

Feature Description
⚑ Real-Time Token Streaming Review suggestions stream instantly token-by-token via Server-Sent Events (SSE).
πŸ›‘οΈ Multi-Category Issue Triage Automatically identifies Bugs, Security Vulnerabilities, Performance Bottlenecks, and Style Violations.
🚨 Dynamic Severity Badging Color-coded severity indicators (CRITICAL, WARNING, INFO) for fast prioritization.
πŸ› οΈ 1-Click AI Fixes & Diff View Generates corrected code snippets with interactive, side-by-side Original vs. Fixed diff panels.
πŸ“œ Persistent Review History Built-in SQLite database stores every code review session with instant category filtering.
🎨 Dark Modern Interface Minimalist, responsive UI built with React 19 and Vite for blazing fast performance.

πŸ—οΈ System Architecture

flowchart TD
    User([πŸ‘¨β€πŸ’» Developer]) -->|1. Submit Code| Frontend[βš›οΈ React 19 Frontend - Vite]
    
    subgraph Backend [⚑ FastAPI Server]
        API[FastAPI Endpoints]
        GeminiClient[Google GenAI Client]
        Database[(SQLite DB\nreviews.db)]
    end
    
    Frontend -->|POST /review/stream| API
    Frontend -->|POST /review/fix| API
    Frontend -->|GET /reviews| API
    
    API <-->|Schema & Stream Queries| GeminiClient
    GeminiClient <-->|LLM Inference API| Gemini[🧠 Google Gemini AI]
    
    API <-->|Save & Fetch Reviews| Database
    API -->|SSE Event Stream| Frontend
Loading

πŸš€ Quick Start

Follow these simple steps to run CodeLens locally on your machine.

πŸ“‹ Prerequisites

  • Python 3.10+ (Tested on Python 3.11 / 3.12 / 3.13)
  • Node.js 18+ & npm
  • Google Gemini API Key (Get your free API Key)

1️⃣ Clone the Repository

git clone https://github.com/vaishnaviwangalwar-cpu/Code_Reviewer_ai.git
cd Code_Reviewer_ai

2️⃣ Backend Setup (FastAPI + Python)

  1. Create and activate a virtual environment:

    # Windows (PowerShell)
    python -m venv venv
    .\venv\Scripts\Activate.ps1
    
    # macOS / Linux
    python3 -m venv venv
    source venv/bin/activate
  2. Install Python dependencies:

    pip install fastapi uvicorn google-genai python-dotenv pydantic
  3. Configure Environment Variables: Create a .env file in the project root:

    GEMINI_API_KEY=your_google_gemini_api_key_here
    GEMINI_MODEL=gemini-3.5-flash
  4. Start the FastAPI Backend Server:

    uvicorn backend.main:app --host 0.0.0.0 --port 8000 --reload

    πŸš€ Backend is now live at: http://localhost:8000 (API documentation at http://localhost:8000/docs)


3️⃣ Frontend Setup (React 19 + Vite)

  1. Navigate to the frontend directory:

    cd frontend
  2. Install dependencies:

    npm install
  3. Start the Vite development server:

    npm run dev

    🌐 Open your browser at: http://localhost:5173/


πŸ”Œ API Reference

Method Endpoint Description Payload Example
GET / API Health Check None
POST /review Synchronous JSON review {"code": "def foo(): pass"}
POST /review/stream Real-time SSE code review stream {"code": "def foo(): pass"}
POST /review/fix Real-time SSE code fix stream {"code": "...", "issue_title": "...", "issue_description": "..."}
GET /reviews Retrieve all historical reviews None

πŸ“ Project Structure

Code_Reviewer_ai/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ database.py         # SQLite connection & CRUD review queries
β”‚   β”œβ”€β”€ gemini_client.py    # Google GenAI SDK client, prompts & schemas
β”‚   β”œβ”€β”€ main.py             # FastAPI application & SSE streaming endpoints
β”‚   └── reviews.db          # SQLite database storage
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ CodeInput.jsx       # Code submission form
β”‚   β”‚   β”‚   β”œβ”€β”€ ReviewResults.jsx   # Real-time results, badges & diff views
β”‚   β”‚   β”‚   └── ReviewHistory.jsx   # Historical review browser & filter
β”‚   β”‚   β”œβ”€β”€ App.jsx                 # Main application state & tabs
β”‚   β”‚   β”œβ”€β”€ App.css                 # Dark-mode styling & diff layout
β”‚   β”‚   └── main.jsx                # React root entry point
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.js
β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ hero.png            # Project banner logo
β”‚   └── demo-screenshot.png # UI dashboard screenshot
β”œβ”€β”€ .env.example            # Environment configuration template
β”œβ”€β”€ README.md               # Interactive documentation
└── main.py                 # Root execution entrypoint

🧩 Usage Guide

  1. Start a Review: Paste any snippet of code (Python, JavaScript, TypeScript, Go, etc.) into the editor and hit "Review Code".
  2. Examine Issues: Analyze the generated cards with actionable titles, issue explanations, and severity tags.
  3. Generate Fixes: Click the "Fix It" button on any card to stream an intelligent correction side-by-side with your original code.
  4. Browse History: Switch to the "History" tab anytime to look up previously analyzed code snippets and filter by issue type.

🀝 Contributing

Contributions, issues, and feature requests are welcome!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

Distributed under the MIT License. See LICENSE for more information.


Built with ❀️ by Vaishnavi Wangalwar

About

A full-stack AI-powered code review dashboard. You paste in a code snippet, and Google's Gemini API analyzes it for bugs, security issues, performance problems, and style improvements. The results stream in live and land in a structured dashboard with severity ratings.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages