Skip to content

Dhruvrathi001/ReviewBot-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

AI Code Reviewer

A full-stack AI-powered code review application using React (Vite), Express.js, and Google Gemini API.


Project Structure

code-reviewer/
│
├── Backend/
│   ├── src/
│       ├── routes
│           ├── ai.routes.js
│       ├── controllers
│           ├── ai.controlles.js
│       ├── services
│           ├── ai.service.js
│   ├── server.js
│   ├── package.json
│   └── .env
│
└── Frontend/
    ├── src/
        ├── components
    ├── App.jsx
    ├── package.json

Backend Setup (Express + Gemini)

1️⃣ Navigate to Backend

cd Backend

2️⃣ Install Dependencies

npm install express cors dotenv nodemon @google/generative-ai

3️⃣ Environment Variables

Create a .env file:

GOOGLE_GEMINI_KEY=your_api_key_here

Important: No spaces around =


4️⃣ Start Backend Server

nodemon server.js

Server runs at:

http://localhost:3000

Frontend Setup (React + Vite)

1️⃣ Navigate to Frontend

cd Frontend

2️⃣ Install Dependencies

If ESLint conflicts occur (recommended safe command):

npm install react-simple-code-editor prismjs react-markdown rehype-highlight highlight.js axios --legacy-peer-deps

Standard install (if no conflicts):

npm install react-simple-code-editor prismjs react-markdown rehype-highlight highlight.js axios

3️⃣ Start Frontend

npm run dev

App runs at:

http://localhost:5173

API Endpoint

Review Code

POST

http://localhost:3000/ai/get-review

Body:

{
  "code": "your code here"
}

Common Error Fixes

🔴 MODULE_NOT_FOUND

npm install

🔴 ESLint / Peer Dependency Conflict

npm install --legacy-peer-deps

OR downgrade ESLint:

npm install eslint@9 --save-dev

🔴 Gemini API 429 Error (Quota Exceeded)

Cause:

• Free tier request limit reached

Fix:

• Wait for quota reset OR enable billing


🔴 500 Internal Server Error

Check backend terminal logs:

nodemon server.js

Best Practices

✔ Never commit .env file ✔ Use environment variables for API keys ✔ Add proper error handling ✔ Avoid using index as React key


Tech Stack

Frontend: React + Vite + PrismJS + Markdown

Backend: Express.js + Gemini API


Run Full Application

Terminal 1 → Backend

cd Backend
nodemon server.js

Terminal 2 → Frontend

cd Frontend
npm run dev

License

For learning and educational purposes.

About

AI-powered code reviewer built with React, Express, and Google Gemini API. Provides intelligent feedback on code quality, best practices, performance, and potential issues.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors