{"id":32862197,"url":"https://github.com/sridevi2108/ai-code-reviewer","last_synced_at":"2025-11-08T22:02:26.757Z","repository":{"id":320746425,"uuid":"1083187464","full_name":"Sridevi2108/ai-code-reviewer","owner":"Sridevi2108","description":"AI-powered code review application with Flask backend and LLM integration","archived":false,"fork":false,"pushed_at":"2025-10-25T16:07:33.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-25T17:28:25.878Z","etag":null,"topics":["css","flask","groqapi","html","pytest","python","sqlite","vanilla-javascript"],"latest_commit_sha":null,"homepage":"https://ai-code-reviewer-e1le.onrender.com/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sridevi2108.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-25T14:16:38.000Z","updated_at":"2025-10-25T16:17:41.000Z","dependencies_parsed_at":"2025-10-25T17:28:27.240Z","dependency_job_id":"e41369ec-021d-4466-982a-8a9eb972e3cc","html_url":"https://github.com/Sridevi2108/ai-code-reviewer","commit_stats":null,"previous_names":["sridevi2108/ai-code-reviewer"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Sridevi2108/ai-code-reviewer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sridevi2108%2Fai-code-reviewer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sridevi2108%2Fai-code-reviewer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sridevi2108%2Fai-code-reviewer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sridevi2108%2Fai-code-reviewer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sridevi2108","download_url":"https://codeload.github.com/Sridevi2108/ai-code-reviewer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sridevi2108%2Fai-code-reviewer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":283424651,"owners_count":26833720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-08T02:00:06.281Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["css","flask","groqapi","html","pytest","python","sqlite","vanilla-javascript"],"created_at":"2025-11-08T22:01:36.135Z","updated_at":"2025-11-08T22:02:26.751Z","avatar_url":"https://github.com/Sridevi2108.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI Code Reviewer 🤖\n\nA web application that provides AI-powered code reviews using LLM technology. Submit your code snippets and get instant feedback on code quality, potential bugs, and suggestions for improvement.\n\n## 🌟 Features\n\n- **AI-Powered Code Analysis**: Get intelligent code reviews from advanced LLM models\n- **Multiple Language Support**: Python, JavaScript, Java, and C++\n- **Code Quality Scoring**: Receive a quality score from 1-10 with detailed explanations\n- **Review History**: View and manage all your past code reviews\n- **Filtering \u0026 Pagination**: Filter reviews by language and date\n- **Rate Limiting**: Protected API with 10 requests per minute limit\n- **Responsive Design**: Mobile-friendly interface\n\n## 🚀 Live Demo\n\n- **Live Application**: https://ai-code-reviewer-e1le.onrender.com/\n- **GitHub Repository**: https://github.com/Sridevi2108/ai-code-reviewer\n\n⚠️ **Note**: The application is hosted on Render's free tier, which may spin down after 15 minutes of inactivity. The first request after inactivity may take 30-60 seconds to respond.\n\n## 🎥 Demo Video\nhttps://drive.google.com/file/d/1PICCDL4qnyjKxM4ZAyDK2QAsiU-gqJm3/view?usp=sharing\n\n## 🛠️ Tech Stack\n\n### Backend\n- **Framework**: Flask 3.0.0\n- **Database**: SQLite with SQLAlchemy\n- **LLM Integration**: Groq API (alternative LLM provider)\n- **Rate Limiting**: Flask-Limiter\n- **Testing**: Pytest\n\n### Frontend\n- **HTML5/CSS3/Vanilla JavaScript**\n- **Responsive Design**\n- **Fetch API for async requests**\n\n## 📋 Prerequisites\n\n- Python 3.8 or higher\n- Git\n- A Groq API key (or any OpenAI-compatible API)\n\n## 🔧 Installation \u0026 Setup\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/Sridevi2108/ai-code-reviewer.git\ncd ai-code-reviewer\n```\n\n### 2. Backend Setup\n\n```bash\ncd backend\n\n# Create virtual environment (recommended)\npython -m venv venv\n\n# Activate virtual environment\n# On Windows:\nvenv\\Scripts\\activate\n# On Mac/Linux:\nsource venv/bin/activate\n\n# Install dependencies\npip install -r requirements.txt\n```\n\n### 3. Environment Configuration\n\nCreate a `.env` file in the `backend` directory:\n\n```bash\n# Copy from example\ncp .env.example .env\n```\n\nEdit `.env` and add your credentials:\n\n```env\nLLM_API_KEY=your_groq_api_key_here\nLLM_BASE_URL=https://api.groq.com/openai/v1\nLLM_MODEL=llama-3.1-70b-versatile\nDATABASE_URL=sqlite:///reviews.db\nFLASK_ENV=development\n```\n\n**Get a Free Groq API Key:**\n1. Visit https://console.groq.com/\n2. Sign up for a free account\n3. Generate an API key\n4. Copy it to your `.env` file\n\n### 4. Initialize Database\n\n```bash\npython -c \"from models import init_db; init_db()\"\n```\n\n### 5. Run the Application\n\n```bash\n# Start backend server\npython app.py\n```\n\nThe backend will run on `http://localhost:5000`\n\n### 6. Frontend Setup\n\nOpen `frontend/index.html` in your browser, or use a local server:\n\n```bash\ncd ../frontend\n\n# Using Python's built-in HTTP server\npython -m http.server 8000\n\n# Or using Node.js http-server (if installed)\nnpx http-server -p 8000\n```\n\nVisit `http://localhost:8000` in your browser.\n\n## 📡 API Documentation\n\n### Base URL\n```\nLocal: http://localhost:5000/api\nProduction: https://ai-code-reviewer-e1le.onrender.com/api\n```\n\n### Endpoints\n\n#### 1. Submit Code for Review\n```http\nPOST /api/review\nContent-Type: application/json\n\n{\n  \"code\": \"def hello():\\n    print('Hello World')\",\n  \"language\": \"python\"\n}\n```\n\n**Response (201 Created):**\n```json\n{\n  \"id\": 1,\n  \"code_snippet\": \"def hello():\\n    print('Hello World')\",\n  \"language\": \"python\",\n  \"quality_score\": 7.5,\n  \"review_text\": \"The code is functional but could be improved...\",\n  \"suggestions\": [\n    \"Add a docstring to explain the function's purpose\",\n    \"Consider adding type hints\",\n    \"Add error handling if needed\"\n  ],\n  \"potential_bugs\": [],\n  \"created_at\": \"2025-10-25T10:30:00\"\n}\n```\n\n**Validation Rules:**\n- `code`: Required, 10-5000 characters\n- `language`: Required, must be one of: `python`, `javascript`, `java`, `cpp`\n\n#### 2. Get All Reviews\n```http\nGET /api/reviews?page=1\u0026per_page=10\u0026language=python\u0026date=2025-10-01\n```\n\n**Query Parameters:**\n- `page` (optional): Page number, default: 1\n- `per_page` (optional): Items per page, default: 10, max: 50\n- `language` (optional): Filter by language (`python`, `javascript`, `java`, `cpp`)\n- `date` (optional): Filter by date (YYYY-MM-DD format)\n\n**Response (200 OK):**\n```json\n{\n  \"reviews\": [\n    {\n      \"id\": 1,\n      \"code_snippet\": \"def hello()...\",\n      \"language\": \"python\",\n      \"quality_score\": 7.5,\n      \"created_at\": \"2025-10-25T10:30:00\"\n    }\n  ],\n  \"total\": 25,\n  \"page\": 1,\n  \"per_page\": 10,\n  \"total_pages\": 3\n}\n```\n\n#### 3. Get Specific Review\n```http\nGET /api/reviews/{id}\n```\n\n**Response (200 OK):**\n```json\n{\n  \"id\": 1,\n  \"code_snippet\": \"def hello():\\n    print('Hello World')\",\n  \"language\": \"python\",\n  \"quality_score\": 7.5,\n  \"review_text\": \"...\",\n  \"suggestions\": [...],\n  \"potential_bugs\": [...],\n  \"created_at\": \"2025-10-25T10:30:00\"\n}\n```\n\n**Response (404 Not Found):**\n```json\n{\n  \"error\": \"Review not found\"\n}\n```\n\n#### 4. Delete Review\n```http\nDELETE /api/reviews/{id}\n```\n\n**Response (200 OK):**\n```json\n{\n  \"message\": \"Review deleted successfully\"\n}\n```\n\n**Response (404 Not Found):**\n```json\n{\n  \"error\": \"Review not found\"\n}\n```\n\n### Error Responses\n\nAll endpoints may return these error codes:\n\n**400 Bad Request:**\n```json\n{\n  \"error\": \"Code is required\"\n}\n```\n\n**429 Too Many Requests:**\n```json\n{\n  \"error\": \"Rate limit exceeded. Please try again later.\"\n}\n```\n\n**500 Internal Server Error:**\n```json\n{\n  \"error\": \"Failed to process review: [error details]\"\n}\n```\n\n## 🧪 Running Tests\n\n```bash\ncd backend\n\n# Run all tests\npytest\n\n# Run with verbose output\npytest -v\n\n# Run with coverage report\npytest --cov=. --cov-report=html\n\n# Run specific test file\npytest tests/test_routes.py -v\n```\n\n**Test Coverage:**\n- ✅ POST /api/review endpoint\n- ✅ GET /api/reviews endpoint\n- ✅ Input validation\n- ✅ Error handling\n\n## 📁 Project Structure\n\n```\nai-code-reviewer/\n├── backend/\n│   ├── app.py                 # Flask application entry point\n│   ├── models.py              # Database models (SQLAlchemy)\n│   ├── requirements.txt       # Python dependencies\n│   ├── .env.example           # Environment variables template\n│   ├── .env                   # Actual environment variables (not in git)\n│   ├── reviews.db             # SQLite database (created automatically)\n│   ├── services/\n│   │   ├── __init__.py\n│   │   ├── llm_service.py     # LLM API integration \u0026 retry logic\n│   │   └── review_service.py  # Review business logic\n│   ├── routes/\n│   │   ├── __init__.py\n│   │   └── review_routes.py   # API endpoints \u0026 validation\n│   └── tests/\n│       ├── __init__.py\n│       └── test_routes.py     # Unit tests\n├── frontend/\n│   ├── index.html             # Main HTML page\n│   ├── style.css              # Styles\n│   └── script.js              # Frontend logic \u0026 API calls\n├── .gitignore                 # Git ignore file\n└── README.md                  # This file\n```\n\n## 🔒 Security Features\n\n- ✅ API key stored in environment variables (never committed)\n- ✅ Rate limiting (10 requests/minute per IP)\n- ✅ Input validation and sanitization\n- ✅ Error handling for all endpoints\n- ✅ CORS configuration for secure cross-origin requests\n- ✅ SQL injection protection (SQLAlchemy ORM)\n- ✅ Character limits to prevent abuse\n\n\n## 🚀 Deployment on Render\n\n### Prerequisites\n1. GitHub account with your code pushed\n2. Render account (free tier available)\n3. Groq API key\n\n### Deployment Steps\n\n1. **Push to GitHub:**\n```bash\ngit add .\ngit commit -m \"Ready for deployment\"\ngit push origin main\n```\n\n2. **Create Web Service on Render:**\n   - Go to https://dashboard.render.com/\n   - Click \"New +\" → \"Web Service\"\n   - Connect your GitHub repository\n   - Configure as follows:\n\n**Basic Settings:**\n- **Name**: `ai-code-reviewer`\n- **Region**: Oregon (US West)\n- **Branch**: `main`\n- **Root Directory**: `backend`\n- **Runtime**: Python 3\n\n**Build \u0026 Deploy:**\n- **Build Command**: \n  ```bash\n  pip install -r requirements.txt \u0026\u0026 python -c \"from models import init_db; init_db()\"\n  ```\n- **Start Command**: \n  ```bash\n  gunicorn --bind 0.0.0.0:$PORT app:app\n  ```\n\n**Environment Variables:**\nAdd these in the \"Environment\" section:\n\n| Key | Value |\n|-----|-------|\n| `LLM_API_KEY` | Your Groq API key |\n| `LLM_BASE_URL` | `https://api.groq.com/openai/v1` |\n| `LLM_MODEL` | `llama-3.1-70b-versatile` |\n| `DATABASE_URL` | `sqlite:///reviews.db` |\n| `FLASK_ENV` | `production` |\n\n3. **Deploy:**\n   - Click \"Create Web Service\"\n   - Wait for build to complete (~2-3 minutes)\n   - Your app will be live at: `https://your-app-name.onrender.com`\n\n4. **Update Frontend:**\n   - Edit `frontend/script.js`\n   - Change `API_BASE_URL` to your Render URL:\n   ```javascript\n   const API_BASE_URL = 'https://ai-code-reviewer-e1le.onrender.com/api';\n   ```\n\n### Troubleshooting Deployment\n\n**Issue: Build fails with SQLAlchemy error**\n- **Solution**: Ensure `requirements.txt` has `sqlalchemy\u003e=2.0.35`\n\n**Issue: App doesn't start**\n- **Solution**: Check environment variables are set correctly\n\n**Issue: CORS errors**\n- **Solution**: Verify CORS is configured in `app.py`:\n  ```python\n  CORS(app, origins=[\"*\"])  # For production, specify your frontend domain\n  ```\n\n## 📝 License\n\nThis project is open source and available under the [MIT License](LICENSE).\n\n## 👨‍💻 Author\n\n**Sridevi Raju**\n- 📧 Email: sridevi21082003@gmail.com\n- 🐙 GitHub: [@Sridevi2108](https://github.com/Sridevi2108)\n\n## 🙏 Acknowledgments\n\n- **Groq** for providing fast and free LLM API access\n- **Render** for free hosting platform\n- **Flask** community for excellent documentation\n- **SQLAlchemy** for robust ORM\n- **OpenAI** for pioneering LLM technology\n\n## 📞 Support \u0026 Contact\n\n**Found a bug or have a suggestion?**\n1. Open an issue on [GitHub Issues](https://github.com/Sridevi2108/ai-code-reviewer/issues)\n2. Email: sridevi21082003@gmail.com\n\n**Want to contribute?**\nPull requests are welcome! Please read the contributing guidelines first.\n\n---\n\n⭐ **If you found this project helpful, please give it a star on GitHub!**\n\n---\n\n**Built with ❤️ for the Machine Learning InceptAI test**\n\nLast Updated: October 25, 2025\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsridevi2108%2Fai-code-reviewer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsridevi2108%2Fai-code-reviewer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsridevi2108%2Fai-code-reviewer/lists"}