A real-time, AI-powered code review assistant that analyzes your code for security, performance, and quality issues. It provides instant feedback, a calculated request rating, and historical tracking using a comprehensive tech stack.
- Real-Time Analysis: Streamed feedback via WebSockets as you type or submit code.
- Multi-Model Support: Works with:
- Google Gemini (Default)
- Ollama (Local/Custom LLMs)
- OpenAI (GPT-3.5/4)
- Deterministic Scoring: Transparent rating system starting at 10/10 with strict deductions for issues found.
- Persistent History: All reviews and analysis results are stored in a PostgreSQL database.
- User Feedback: (Optional) UI allowing users to mark reviews as accurate or inaccurate.
- Categorized Insights:
- 🔒 Security Issues
- ⚡ Performance Bottlenecks
- 🎯 Code Quality & Best Practices
- 🧪 Type Safety
- Frontend: Vanilla JavaScript, HTML5, CSS3 (Served via
http-server) - Backend: Node.js, Express, WebSocket (
ws) - AI Integration: LangChain (
@langchain/google-genai,@langchain/ollama,@langchain/openai) - Database: PostgreSQL 15 (Dockerized), Sequelize ORM
- Infrastructure: Docker Compose
- Node.js (v18+)
- Docker & Docker Compose (For PostgreSQL)
- API Keys (Google Gemini, OpenAI) OR Ollama installed locally.
Start the PostgreSQL container:
docker-compose up -dThis starts Postgres on port 5433 (mapped from internal 5432) to avoid local conflicts.
Navigate to the backend directory:
cd backend
npm installConfigure your environment:
Create a .env file in backend/ with the following:
PORT=3001
# Database Config
DB_HOST=localhost
DB_PORT=5433
DB_NAME=review_bot
DB_USER=admin
DB_PASSWORD=password123
# --- Choose ONE LLM Provider ---
# Option A: Google Gemini (Default)
# LLM_PROVIDER=google
# GOOGLE_API_KEY=your_gemini_key
# Option B: Ollama (Local or Custom)
LLM_PROVIDER=custom # or 'ollama'
LLM_MODEL=gpt-oss:120b-cloud # or 'llama3', 'mistral'
LLM_BASE_URL=https://ollama.com/api # or http://localhost:11434
OPENAI_API_KEY=your_custom_key_if_needed
# Option C: OpenAI
# LLM_PROVIDER=openai
# OPENAI_API_KEY=sk-...Start the backend server:
npm start
# OR for development
npm run devNavigate to the frontend directory:
cd ../frontend
npx http-server -p 8081 -c-1Access the application at http://localhost:8081.
To ensure trust, the bot uses a strict logic-based grading rubric:
- Base Score: 10 Points
- Deductions:
- -3.0: CRITICAL (Security flaws, crashing bugs)
- -2.0: HIGH (Performance blockers, logic errors)
- -1.0: MEDIUM (Code smells, maintainability)
- -0.5: LOW (Nitpicks, styling, comments)
Minimum score is 0/10.
ai-code-review-bot/
├── backend/
│ ├── models/ # Sequelize Schemas (Review.js)
│ ├── .env # Config keys
│ ├── db.js # Database connection
│ ├── server.js # Main API & WebSocket logic
│ └── package.json
├── frontend/
│ ├── index.html # Main UI
│ └── (styles/scripts embedded for simplicity)
├── docker-compose.yml # PostgreSQL Configuration
└── README.md
- WebSocket Error / Disconnect: Ensure backend is running on port 3001.
- Database Connection Refused: Check if Docker container
review_bot_dbis running (docker ps) and port 5433 is available. - LLM 404/Error: Verify
LLM_MODELname matches exactly what your provider expects (e.g.,gemini-1.5-flashvsgemini-pro).