A modern, real-time AI code review application with intelligent language detection, built on Cloudflare's edge computing platform. Get instant code analysis, security audits, performance insights, and documentation suggestions powered by Llama 3.1.
- π Intelligent Language Detection - Automatically detects and validates programming languages
- β‘ Real-time Streaming - Watch AI analysis stream in real-time as it's generated
- π Multi-language Support - JavaScript, TypeScript, Python, Java, Go, Rust, C++, C#, PHP, Ruby, Swift, Kotlin
- π Review Categories:
- π Quick Review - Overall code quality assessment
- π Security Audit - Vulnerability detection & OWASP analysis
- β‘ Performance Analysis - Optimization suggestions
- π Documentation Review - Comment & documentation improvements
- πΎ Review History - Search, filter, and export your past reviews
- π¨ Modern UI - Dark mode, syntax highlighting, keyboard shortcuts
- π Statistics Dashboard - Track your review activity and insights
- π‘οΈ Smart Validation - Prevents errors and provides helpful suggestions
Visit the deployed application: https://ai-code-reviewer-5fq.pages.dev
No setup required - just paste your code and get instant AI-powered reviews!
# Clone the repository
git clone <your-repo-url>
cd ai_code_reviewer
# Install backend dependencies
npm install
# Install frontend dependencies
cd frontend
npm install
cd ..
# Start the backend Worker (in one terminal)
npm run dev
# Start the frontend (in another terminal)
npm run dev:frontendThe frontend will be available at http://localhost:5173 and connects to the local Worker at http://localhost:8787.
Use the REST API directly without the frontend:
# Submit code for review
curl -X POST https://ai-code-reviewer-backend.mohammedfirdousaraoye.workers.dev/api/review \
-H "Content-Type: application/json" \
-d '{
"code": "console.log(\"Hello World\");",
"category": "quick",
"language": "javascript"
}'
# Get all reviews
curl https://ai-code-reviewer-backend.mohammedfirdousaraoye.workers.dev/api/reviews
# Check service status
curl https://ai-code-reviewer-backend.mohammedfirdousaraoye.workers.dev/api/statusSubmit code for AI analysis.
Request:
{
"code": "console.log('Hello World');",
"category": "quick|security|performance|documentation",
"language": "javascript|typescript|python|java|go|rust|cpp|csharp|php|ruby|swift|kotlin|other"
}Response:
{
"success": true,
"review": {
"id": "unique-review-id",
"code": "console.log('Hello World');",
"category": "quick",
"language": "javascript",
"result": "AI analysis result...",
"timestamp": 1760798282676
}
}Retrieve all submitted code reviews.
Check service health and statistics.
Basic health check endpoint.
Interactive API documentation.
The application also supports WebSocket connections for real-time streaming. Connect to /agent endpoint and send:
{
"type": "submit_code",
"code": "your code here",
"category": "quick",
"language": "javascript"
}βββββββββββββββββββββββββββββββββββββββ
β Frontend (React + Vite) β
β - Modern UI with dark mode β
β - Real-time streaming display β
β - Review history & search β
ββββββββββββββββ¬βββββββββββββββββββββββ
β WebSocket / HTTP
βΌ
βββββββββββββββββββββββββββββββββββββββ
β Cloudflare Worker β
β - Durable Objects for state β
β - Language detection β
β - Request validation β
ββββββββββββββββ¬βββββββββββββββββββββββ
β AI Binding
βΌ
βββββββββββββββββββββββββββββββββββββββ
β Cloudflare Workers AI β
β - Llama 3.1 8B Model β
βββββββββββββββββββββββββββββββββββββββ
ai_code_reviewer/
βββ worker/ # Cloudflare Worker backend
β βββ index.ts # Worker entry point
β βββ agent.ts # Durable Object Agent
β βββ types.ts # TypeScript definitions
β βββ lib/
β βββ code-review-service.ts
β βββ websocket-handler.ts
βββ frontend/ # React frontend application
β βββ src/
β β βββ App.tsx # Main component
β β βββ App.css # Styles
β β βββ main.tsx # Entry point
β βββ package.json
β βββ vite.config.ts
βββ scripts/ # Deployment & utility scripts
β βββ setup-env.sh # Environment setup
β βββ pre-deploy-check.sh # Pre-deployment validation
β βββ verify-deployment.sh # Post-deployment verification
βββ tests/ # Test files
β βββ test-websocket.html # WebSocket test utility
βββ docs/ # Documentation
β βββ PROMPT.md # Project prompt/requirements
βββ config/ # Configuration files
β βββ wrangler.workers.toml # Worker configuration
β βββ wrangler.pages.toml # Pages configuration
βββ wrangler.toml # Main Worker config
βββ package.json # Backend dependencies
βββ tsconfig.json # TypeScript configuration
- Node.js 18+ and npm
- Cloudflare account (for deployment)
- Wrangler CLI (installed via npm)
-
Install dependencies:
# Backend npm install # Frontend cd frontend && npm install && cd ..
-
Configure environment:
npm run setup # Edit .env with your Cloudflare credentials -
Run locally:
# Terminal 1: Backend npm run dev # Terminal 2: Frontend npm run dev:frontend
- Open
http://localhost:5173in your browser - Paste code into the editor
- Select a review category
- Click "Review Code" to see streaming AI analysis
# Configure environment first
npm run setup
# Deploy
npm run deploycd frontend
npm run deployThe deployment script uses API tokens from .env - no OAuth required!
# Check health
curl https://ai-code-reviewer-backend.mohammedfirdousaraoye.workers.dev/health
# View logs
npm run logs
# Verify deployment
npm run verifyThe application intelligently detects programming languages using pattern recognition:
- Automatic Detection - Analyzes code syntax to identify the language
- Validation - Prevents mismatched language selections
- Smart Suggestions - Recommends correct language when mismatch detected
- Non-code Detection - Identifies and rejects plain text submissions
JavaScript, TypeScript, Python, Java, Go, Rust, C++, C#, PHP, Ruby, Swift, Kotlin, and more.
Ctrl/Cmd + K- Focus code inputCtrl/Cmd + Enter- Submit review
- AI Binding: Connects to Workers AI for Llama 3.1
- Durable Object:
CodeReviewerAgentfor stateful sessions - Compatibility: Node.js compatibility enabled
Create a .env file with:
CLOUDFLARE_ACCOUNT_ID=your-account-id
CLOUDFLARE_API_TOKEN=your-api-tokenContributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.