Skip to content

utsabpanta/ai-powered-codementor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– AI-Powered Code Mentor

A modern, intelligent code analysis platform that provides instant code reviews, security analysis, and improvement suggestions using multiple AI providers with automatic fallback for maximum reliability.

⭐ If you find this project helpful, please consider giving it a star on GitHub! It helps others discover this tool and motivates continued development.

✨ What Makes This Special

  • πŸ”„ Multi-Provider AI: Seamlessly switches between Gemini, Groq, and HuggingFace if one fails
  • 🎯 Customizable Models: Easy to change AI models for each provider (see Model Configuration)
  • ⚑ Real-time Analysis: Instant feedback on code quality, security, and performance
  • 🎨 Modern UI: Clean interface with syntax highlighting, drag-drop, and file upload
  • πŸ“Š Smart Reports: Toggle between raw JSON and beautiful UI visualizations
  • πŸ›‘οΈ Production Ready: Built with TypeScript, proper error handling, and validation

πŸ”§ Current AI Models

  • Gemini: gemini-2.5-flash (Google's latest fast model)
  • Groq: llama-3.3-70b-versatile (Latest Llama model for versatile tasks)
  • HuggingFace: bigcode/starcoder2-15b (Specialized for code analysis)

πŸš€ Quick Start

1️⃣ Prerequisites

  • Node.js 18+
  • PNPM If you don't have pnpm installed, install it using npm i -g pnpm
  • At least one AI API key (get them here)

2️⃣ Setup (2 minutes)

# Clone and install
git clone <your-repo-url>
cd ai-powered-codementor
pnpm install

# Setup environment
cd backend && cp .env.example .env
# Add your API keys to .env file

# Start the app
cd .. && pnpm dev

πŸŽ‰ That's it! Open http://localhost:5174 and start analyzing code!

🎯 How to Use

  1. πŸ“ Upload Code: Drag & drop files or paste code directly
  2. πŸŽ›οΈ Choose Analysis: Pick from general, security, performance, or maintainability
  3. πŸ€– Select AI Provider: Use auto-selection or pick your preferred AI
  4. πŸ“Š Get Results: View detailed analysis with actionable recommendations

πŸ”§ Model Configuration

Want to use different AI models? Easy! Just modify these files:

πŸ”΅ Gemini Models

File: /backend/src/services/geminiService.ts (line 35)

this.model = this.genAI.getGenerativeModel({ model: 'gemini-2.5-flash' });

🟒 Groq Models

File: /backend/src/services/groqService.ts (line 15)

model: 'llama-3.3-70b-versatile'

🟠 HuggingFace Models

File: /backend/src/services/huggingFaceService.ts (line 16)

model: 'bigcode/starcoder2-15b'

πŸ”‘ Get API Keys (free usage)

Google Gemini

  1. Go to Google AI Studio
  2. Click "Create API Key" β†’ Select project β†’ Copy key

Groq (Fast!)

  1. Visit Groq Console
  2. Sign up (takes 30 seconds) β†’ Go to API Keys β†’ Create new key

HuggingFace

  1. Go to HuggingFace Tokens
  2. Create new token β†’ Copy and save

βš™οΈ Environment Setup

# In /backend/.env
PORT=3001
NODE_ENV=development
CORS_ORIGIN=http://localhost:5173

# Add API keys (recommended to have all three,but at least one is required)
GEMINI_API_KEY=your_gemini_key_here
GROQ_API_KEY=your_groq_key_here
HUGGINGFACE_API_KEY=your_hf_key_here

πŸ—οΈ Architecture & Tech Stack

Layer Technologies
🎨 Frontend React 18, TypeScript, Vite, Tailwind CSS, Zustand
⚑ Backend Node.js, Express, TypeScript, Fallback System
πŸ€– AI Providers Google Gemini, Groq, HuggingFace
πŸ“¦ Package Manager PNPM Workspaces
πŸ› οΈ DevTools ESLint, Prettier, Nodemon

Key Architecture Features

  • πŸ”„ Automatic Fallback: If Gemini fails β†’ tries Groq β†’ then HuggingFace
  • πŸ›‘οΈ Type Safety: Full TypeScript coverage with proper interfaces
  • 🎯 Modular Design: Easy to add new AI providers
  • ⚑ Fast Development: Hot reload for both frontend and backend

πŸ”§ Development Commands

# πŸš€ Development
pnpm dev              # Start both frontend & backend
pnpm dev:frontend     # Frontend only (port 5174)
pnpm dev:backend      # Backend only (port 3001)

# πŸ—οΈ Building
pnpm build            # Build everything for production
pnpm lint             # Check code quality
pnpm clean            # Remove build artifacts

🌐 API Reference

Endpoint Method Purpose
/api/analyze POST πŸ” Analyze code with AI
/api/explain POST πŸ’‘ Get code explanations
/api/improve POST ⚑ Get improvement suggestions
/api/report POST πŸ“Š Generate comprehensive reports
/api/providers GET πŸ€– Check AI provider status

πŸ”’ Security & Best Practices

βœ… Input validation on all endpoints βœ… File size limits for uploads βœ… API key security with environment variables βœ… CORS protection with configurable origins βœ… Error handling without sensitive data exposure βœ… TypeScript for compile-time safety

🀝 Contributing

Contributions are welcome!

πŸ’‘ Troubleshooting

🚨 Build Errors?

  • Run pnpm install to ensure dependencies are installed
  • Check Node.js version (need 18+)

πŸ€– AI Not Working?

  • Verify API keys in /backend/.env
  • Check console for error messages
  • Try a different AI provider

🌐 Frontend Not Loading?

  • Make sure backend is running on port 3001
  • Check CORS settings in backend config

πŸ“„ License

MIT License - feel free to use this in your own projects!

About

Intelligent Code Analysis & Mentoring Platform powered by Multi-AI Providers (Gemini, Groq, HuggingFace) - Get instant code reviews, security analysis, performance insights, and improvement suggestions with automatic fallback for maximum reliability

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors