Skip to content

swarnabha-dutta/AI_Code_Reviewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🤖 AI Code Reviewer

Enterprise-grade AI code review system powered by Google Gemini

React Vite Node.js Express Gemini Render License


📸 Screenshots

Visual proof of real functionality — authentic and production-ready

🧠 Performance Monitoring

Performance Monitoring Screenshot 1

Performance Monitoring Screenshot 2


🖼️ Project Overview

AI Code Reviewer is a full-stack web application that leverages Google Gemini AI to provide enterprise-grade automated code reviews.
It features a modern React frontend (Vite) and a robust Node.js/Express backend, fully integrated and deployable on Render.


🚀 Tech Stack

Layer Technology Description
Frontend React
Vite
Modern UI, blazing-fast dev/build, SPA experience
Backend Node.js
Express
REST API, business logic, CORS, routing
AI Service Gemini Advanced code review via generative AI
Hosting Render Cloud deployment for both frontend and backend

🏗️ Architecture & Flow

Part Location Key Files / Folders Description
Frontend /frontend src/App.jsx, src/main.jsx React SPA for code input and displaying AI feedback
Backend /backend server.js, src/app.js Express server, routing, middleware setup
Routes /backend/src/routes/ai.route.js Defines /ai/get-review POST endpoint
Controller /backend/src/controllers/ai.controller.js API logic, validation, and error handling
AI Service /backend/src/services/ai.service.js Integrates Google Gemini API for analysis
Configs /backend/.env, /frontend/.env Environment variables (API keys, URLs, ports)

🔄 Workflow

Layer Flow
Frontend ① User pastes code → ② Sends POST to /ai/get-review → ③ Displays AI feedback
Backend ① Receives request → ② Validates input → ③ Calls AI Service → ④ Returns JSON
AI Service ① Sends prompt to Gemini → ② Gets structured review → ③ Returns response
Deployment ① Frontend & Backend hosted on Render → ② Env vars managed securely

🧩 Features

  • 💡 AI-Powered Code Review via Google Gemini API
  • Fast Modern UI using React + Vite
  • 🔐 Secure RESTful API with CORS and validation
  • ☁️ Deployable on Render in one click
  • 🧠 Smart feedback on performance, security, and readability

⚙️ Installation & Local Setup

1️⃣ Clone Repository

git clone https://github.com/swarnabha-dutta/ai-code-reviewer.git
cd ai-code-reviewer

2️⃣ Backend Setup

cd backend
npm install
# Create a .env file
# PORT=4000
# GOOGLE_GEMINI_API_KEY=your_api_key_here
npm start

3️⃣ Frontend Setup

cd ../frontend
npm install
# Create a .env file
# VITE_BACKEND_URL=http://localhost:4000
npm run dev

🌐 Deployment on Render

  • Backend:

    • Type: Web Service
    • Root Directory: backend
    • Start Command: npm start
    • Env Vars: PORT, GOOGLE_GEMINI_API_KEY
  • Frontend:

    • Type: Static Site
    • Root Directory: frontend
    • Build Command: npm install && npm run build
    • Publish Directory: dist
    • Env Var: VITE_BACKEND_URL=<your backend render URL>

📚 Example API Usage

POST /ai/get-review

Request:

{
  "code": "function hello() { console.log('Hello, world!'); }"
}

Response:

{
  "review": "🔴 Critical: Avoid global functions... 🟡 Major: Use const instead of var... 🟢 Minor: Add function JSDoc... 💡 Enhancement: Consider modularization."
}

🛡️ Security & Best Practices

  • Secrets handled via .env only
  • CORS enabled for frontend-backend communication
  • Input validation and error handling in controller layer

🖼️ Folder Structure

ai-code-reviewer/
├── backend/
│   ├── server.js
│   ├── package.json
│   ├── src/
│   │   ├── app.js
│   │   ├── controllers/
│   │   │   └── ai.controller.js
│   │   ├── routes/
│   │   │   └── ai.route.js
│   │   └── services/
│   │       └── ai.service.js
│   └── .env.example
│
├── frontend/
│   ├── src/
│   │   ├── assets/
│   │   ├── App.jsx
│   │   ├── index.css
│   │   └── main.jsx
│   ├── public/
│   ├── vite.config.js
│   └── .env.example
│
├── README.md
└── .gitignore

🏷️ License

This project is licensed under the ISC License.


💙 Built by Swarnabha Dutta — with Google Gemini & React

```