AI-powered code review and refactoring tool built with React, Node.js, and Google's Gemini AI.
RefactorAI helps developers improve their code quality by providing intelligent suggestions, identifying potential issues, and recommending best practices through an intuitive web interface.
Try Memora now: refactorai-1.onrender.com
- π Intelligent Code Analysis - AI-powered code review using Google's Gemini AI
- π Real-time Code Editor - Syntax-highlighted, scrollable code editor with dark theme
- π Instant Feedback - Get AI suggestions and improvements in real-time
- π± Responsive Design - Works seamlessly on desktop, tablet, and mobile devices
- π Hot Reload Development - Real-time server restart with nodemon for efficient development
- βοΈ Cloud Ready - Deploy easily to Render, Vercel, or any cloud platform
βββββββββββββββββββ HTTP/API ββββββββββββββββββββ AI API βββββββββββββββββββ
β React Frontend β βββββββββββββββΆβ Express Backend β βββββββββββΆ β Google Gemini β
β (Vite + CSS) β β (Node.js + AI) β β AI Service β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
- Frontend: React + Vite with syntax highlighting and responsive design
- Backend: Express.js API server with Google AI integration
- AI Service: Google Gemini AI for intelligent code analysis
- Deployment: Single full-stack service (backend serves frontend)
- Node.js (v16 or higher)
- Google AI API Key (Get one here)
- Git for version control
git clone https://github.com/yourusername/RefactorAI.git
cd RefactorAICreate a .env file in the backend directory:
# backend/.env
GOOGLE_API_KEY=your_google_ai_api_key_here
PORT=3000
NODE_ENV=development# Install all dependencies and build frontend
node build.js# Start with hot reload (recommended)
cd backend && npm run devπ That's it! Open http://localhost:3000 to see RefactorAI in action.
For backend-focused development with hot reload:
# Build frontend and start backend with nodemon
node build.js
cd backend && npm run devFor full hot reload on both frontend and backend:
# Terminal 1: Backend with hot reload
cd backend && npm run dev
# Terminal 2: Frontend dev server with Vite
cd frontend && npm run devnpm start # Production server
npm run dev # Development with hot reload
npm run build # Build frontend
npm test # Run testsnpm run dev # Vite dev server
npm run build # Production build
npm run preview # Preview build
npm run lint # Lint code{
"watch": ["src", "server.js", "../frontend/src"],
"ext": "js,json,jsx,css",
"ignore": ["node_modules", "dist", "build"],
"delay": 1000,
"verbose": true
}export default defineConfig({
plugins: [react()],
build: {
outDir: 'dist',
sourcemap: false,
rollupOptions: {
output: {
manualChunks: {
vendor: ['react', 'react-dom']
}
}
}
}
})Analyze code and get AI-powered suggestions.
Request Body:
{
"code": "function example() { return 1 + 1; }"
}Response:
{
"review": "## Code Review\n\n**Analysis**: Your function looks good! Here are some suggestions:\n\n- Consider adding type annotations\n- Add error handling\n- Include unit tests"
}Health check endpoint.
Response:
{
"status": "OK",
"message": "RefactorAI Backend is running"
}RefactorAI is configured for one-click deployment to Render:
-
Fork/Push this repository to GitHub
-
Connect to Render:
- Go to render.com
- Click "New" β "Blueprint"
- Connect your GitHub repository
-
Set Environment Variables:
GOOGLE_API_KEY: Your Google AI API key
-
Deploy: Click "Apply" - Render will automatically:
- Install backend dependencies
- Build the frontend
- Start the single full-stack service
Live URL: https://your-app-name.onrender.com
Build Command:
cd backend && npm install && npm run buildStart Command:
cd backend && npm startEnvironment Variables:
GOOGLE_API_KEY(required)NODE_ENV=production
RefactorAI can be deployed to any Node.js hosting platform:
- Vercel: Use the Next.js adapter
- Heroku: Configure Procfile
- Railway: Use the provided configuration
- DigitalOcean: Use App Platform
- AWS: Deploy with Elastic Beanstalk or Lambda
- React 19 - Modern UI library
- Vite 7 - Fast build tool and dev server
- React Simple Code Editor - Syntax-highlighted code editor
- Prism.js - Code syntax highlighting
- Axios - HTTP client for API calls
- React Markdown - Markdown rendering for AI responses
- Node.js - JavaScript runtime
- Express 4 - Web application framework
- Google Generative AI - AI-powered code analysis
- CORS - Cross-origin resource sharing
- dotenv - Environment variable management
- Nodemon - Auto-restart development server
- ESLint - Code linting and formatting
- Vite - Development server with hot reload
Contributions are welcome! Here's how you can help:
git clone https://github.com/yourusername/RefactorAI.git
cd RefactorAIgit checkout -b feature/amazing-feature- Follow the existing code style
- Add tests for new features
- Update documentation as needed
# Test locally
node build.js
cd backend && npm run devgit commit -m "Add amazing feature"
git push origin feature/amazing-featureOpen a pull request with:
- Clear description of changes
- Screenshots (if UI changes)
- Test results
RefactorAI/
βββ π backend/ # Express.js API server
β βββ π src/
β β βββ π app.js # Express app configuration
β β βββ π controllers/ # Route controllers
β β βββ π routes/ # API routes
β β βββ π services/ # Business logic
β βββ π server.js # Server entry point
β βββ π package.json # Backend dependencies
β βββ π nodemon.json # Nodemon configuration
β βββ π .env # Environment variables
βββ π frontend/ # React frontend
β βββ π src/
β β βββ π App.jsx # Main React component
β β βββ π App.css # Styling
β β βββ π main.jsx # React entry point
β βββ π package.json # Frontend dependencies
β βββ π vite.config.js # Vite configuration
β βββ π index.html # HTML template
βββ π build.js # Production build script
βββ π render.yaml # Render deployment config
βββ π DEPLOYMENT.md # Deployment guide
βββ π DEVELOPMENT.md # Development guide
βββ π README.md # This file
1. "vite: not found" during build
cd frontend && npm install --include=dev2. Server not restarting with nodemon
# Check nodemon configuration
cat backend/nodemon.json
# Restart manually
cd backend && npm run dev3. CORS errors in separate development
- Use same origin (Option 1 development)
- Or configure CORS properly in backend
4. Google AI API errors
- Verify API key is valid
- Check API quotas and limits
- Ensure proper environment variable setup
Enable verbose logging:
# Backend debug
DEBUG=* npm run dev
# Nodemon verbose
cd backend && nodemon --verbose server.js- Google AI for providing the Gemini AI API
- React Team for the amazing frontend framework
- Vite Team for the fast build tool
- Render for easy deployment platform
- Open Source Community for the awesome libraries
Built with β€οΈ using React, Node.js, and Google AI
β Star this repo if you found it helpful!
