Version: 2.0.0 (Updated & Debugged)
Status: β
Fully Fixed and Ready to Use
This is a completely debugged and updated version of the 1-year-old Code Sensei project.
β
Invalid import statement - Line 9 had broken syntax
β
Wrong API package - Updated from @google/genai to @google/generative-ai
β
Incorrect API class - Changed GoogleGenAI to GoogleGenerativeAI
β
Model compatibility - Updated to gemini-1.5-flash (more stable)
β
Dependencies - Updated all packages to latest compatible versions
β
Vite config - Fixed package references in build config
β
Package.json - Added version 2.0.0, removed unused dependencies
β
Git config - Improved .gitignore with comprehensive patterns
- Node.js 16+
- npm 8+
- Google Gemini API key (free)
- Go to https://aistudio.google.com/app/apikey
- Click "Create API Key"
- Copy your key (looks like:
AIzaSy...)
# Create .env file
cp .env.example .env
# Edit .env and paste your API key
# VITE_GOOGLE_GENAI_API_KEY=your_key_here# Install dependencies
npm install
# Start development server
npm run devThe app will open at http://localhost:4173
npm run build
npm run previewCode Sensei is an AI-powered code review and fixing tool that:
β¨ Reviews Code - Deep analysis using Gemini AI
- Quality rating (Better, Good, Normal, Bad)
- Detailed improvement suggestions
- Bug and logical error detection
- Step-by-step explanation
π§ Fixes Code - Automatic code correction
- Syntax error fixing
- Quality improvements
- Best practices application
- Maintains original functionality
π Supports 20+ Languages: JavaScript, Python, Java, C#, C++, PHP, Ruby, Go, Swift, Kotlin, TypeScript, Rust, Dart, Scala, Perl, Haskell, Elixir, R, MATLAB, Bash
| Layer | Tech |
|---|---|
| Frontend | React 19, Vite 6 |
| Editor | Monaco Editor 0.52 |
| AI | Google Gemini API (gemini-1.5-flash) |
| Styling | Tailwind CSS 4 |
| UI Components | Lucide Icons, React Select, React Markdown |
| Code Highlighting | Rehype Highlight |
AI-Code-Reviewer-FIXED/
βββ src/
β βββ App.jsx # Main app component (FIXED)
β βββ App.css # Styling
β βββ main.jsx # Entry point
β βββ index.css # Global styles
β βββ components/
β βββ Navbar.jsx # Navigation bar
βββ public/
β βββ vite.svg
βββ index.html # HTML template
βββ package.json # Dependencies (UPDATED)
βββ vite.config.js # Vite config (FIXED)
βββ eslint.config.js # Linting rules
βββ .env.example # Environment template
βββ .gitignore # Git ignore (UPDATED)
βββ README.md # This file
Create a .env file in the project root:
# Google Generative AI API Key
# Get from: https://aistudio.google.com/app/apikey
VITE_GOOGLE_GENAI_API_KEY=your_api_key_here- Never commit
.envfile to version control - Never share your API key
- Use different keys for dev/prod if needed
- Requests/minute: 50 RPM
- Daily limit: Applies
- Cost: Free
- Best for: Testing, learning, light usage
- Requests/minute: Unlimited
- Cost: $0.075 per 1M input tokens
- Best for: Production, frequent use
Upgrade at: https://console.cloud.google.com/billing
Solutions:
- Check API key is correct and pasted without spaces
- Verify API is enabled: https://console.cloud.google.com
- Check browser console (F12) for detailed errors
- Ensure
.envfile exists and is read (restart dev server)
Solutions:
- Free tier? Wait until next day (quota resets at midnight UTC)
- Upgrade plan at https://console.cloud.google.com/billing
- Create new API key in different project for fresh quota
Change the port in vite.config.js:
server: {
port: 3000 // Change to any available port
}Try:
npm install --legacy-peer-deps
# OR
npm cache clean --force
npm install- Select programming language from dropdown
- Paste your code in the left editor
- Click "Review Code" button
- Read detailed AI analysis on the right
- Paste buggy/inefficient code
- Click "Fix Code" button
- Fixed version appears in editor
- Review changes and copy if satisfied
Red badge shows detected syntax/style issues:
- Click to see issue details
- Markers appear in editor
- Hover for more information
Click "Change API Key" button:
- Enter new key
- Click Submit
- Key saves to browser (localStorage)
v2.0.0 (Current - Fully Fixed)
- β
Updated to
@google/generative-ai(official package) - β Fixed all API initialization issues
- β Updated all dependencies to latest versions
- β
Model:
gemini-1.5-flash(stable, fast) - β Removed broken imports and syntax errors
- β Updated Vite and Tailwind configurations
v1.0.0 (Original - 1 year old)
- β Used
@google/genai(outdated) - β Had syntax errors
- β Outdated dependencies
- β Broken API initialization
npm run build
# Deploy the 'dist' folder to VercelUpdate vite.config.js:
export default defineConfig({
base: '/repository-name/',
// ... rest of config
})FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "run", "preview"]- Browser console - F12, check Console tab for errors
- Network tab - F12 > Network, check API responses
- Check .env - Ensure API key is set correctly
- Verify API - Enable in Google Cloud Console
| Issue | Fix |
|---|---|
| App won't start | Run npm install and restart |
| API key invalid | Copy fresh from AI Studio, check for spaces |
| Quota exceeded | Upgrade plan or wait for reset |
| Port in use | Change port in vite.config.js |
| Slow responses | Free tier throttled, upgrade for speed |
This project is provided as-is for educational and commercial use.
Potential improvements:
- π Support for more AI models
- πΎ Code history/version tracking
- π Backend API for security
- π Analytics dashboard
- π Multi-language UI
- π± Mobile app version
Before using, verify:
- Node.js 16+ installed (
node -v) - npm 8+ installed (
npm -v) -
.envfile created with API key -
npm installcompleted successfully -
npm run devstarts without errors - App opens at http://localhost:4173
- API key works (test with "Review Code")
The project is now fully debugged and ready to use.
- Create
.envwith your API key - Run
npm install - Start with
npm run dev - Try reviewing some code!
Happy coding! π
Last Updated: April 2025
Version: 2.0.0 - Fully Debugged & Updated