AI-powered code review that understands intent, not just syntax.
Demo β’ Architecture β’ Quick Start β’ Example Review β’ Tech Stack β’ Roadmap
Code reviews are the biggest bottleneck in software delivery.
-
The average PR waits 24+ hours for human review
-
Reviews are inconsistent β quality depends entirely on who reviews
-
Existing tools catch syntax issues but miss the real question:
"Does this PR actually implement what was requested, and is it safe to merge?"
| Tool | What It Does | What It Misses |
|---|---|---|
| GitHub Copilot | Autocompletes code | Doesn't review PRs or validate requirements |
| CodeQL / Semgrep | Rule-based SAST scanning | Can't reason about feature completeness |
| SonarQube | Tracks tech debt metrics | No PR-level intelligence, no requirement tracing |
| SmartCode | AI review: requirement drift + security + performance + confidence scoring | β |
SmartCode is an AI-powered GitHub App that reviews pull requests like a Senior Staff Engineer β checking not just code quality, but whether the code actually does what the issue asked for.
A 0-100% composite score that tells you how safe it is to merge this PR, combining:
| Dimension | Weight | What It Measures |
|---|---|---|
| Requirement Alignment | 30% | Do changes match linked issues? |
| Security Safety | 25% | Are there vulnerabilities? |
| Code Quality | 20% | Complexity, patterns, tech debt |
| Test Coverage Signal | 15% | Are tests added/modified? |
| Static Analysis | 10% | Linting + pattern results |
Verdicts:
- π’ 80-100:
APPROVEβ safe to merge - π‘ 60-79:
REVIEW_NEEDEDβ human should check flagged items - π΄ 0-59:
CHANGES_REQUESTEDβ significant issues found
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SmartCode Platform β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ β
β β GitHub App βββββΆβ Webhook Handler βββββΆβ Celery Worker β β
β β (Webhooks) β β (FastAPI) β β (Redis Queue) β β
β βββββββββββββββ ββββββββββββββββββββ ββββββββββ¬ββββββββββ β
β β β β
β βΌ βΌ β
β ββββββββββββββββββββ ββββββββββββββββββββββββ β
β β REST API β β Analysis Pipeline β β
β β /api/review β β ββββββββββββββββββ β β
β β /api/metrics β β β Context Extract β β β
β β /api/analyze β β β Static Analysis β β β
β ββββββββββ¬ββββββββββ β β LLM Reasoning β β β
β β β β Confidence Scoreβ β β
β βΌ β ββββββββββββββββββ β β
β ββββββββββββββββββββ ββββββββββββ¬ββββββββββββ β
β β PostgreSQL β β β
β β (Reviews + βββββββββββββββββ β
β β Findings) β β
β ββββββββββββββββββββ β
β β β
β βΌ β
β ββββββββββββββββββββ ββββββββββββββββββββββββ β
β β React Dashboard β β GitHub PR Comment β β
β β (Metrics + UI) β β (Auto-posted) β β
β ββββββββββββββββββββ ββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Developer opens PR βββΆ GitHub fires webhook
β
βΌ
POST /webhook/github
(signature verified)
β
βΌ
Review record created
(status: "pending")
β
βΌ
Celery task queued
analyze_pull_request()
β
ββββββββββββββ΄βββββββββββββ
βΌ βΌ
Context Extraction Static Analysis
βββ PR diff βββ AST complexity
βββ Linked issues βββ Diff structure
βββ Project docs βββ Dependency changes
β β
ββββββββββββββ¬βββββββββββββ
βΌ
LLM AI Reasoning
βββ Requirement alignment
βββ Security scan
βββ Performance check
βββ Code quality review
β
βΌ
Confidence Scoring
βββ 5-dimension breakdown
βββ Risk flags
βββ Verdict (APPROVE / REVIEW_NEEDED / CHANGES_REQUESTED)
β
ββββββββββββββ΄βββββββββββββ
βΌ βΌ
Findings β DB GitHub PR Comment
(PostgreSQL) (auto-posted)
When SmartCode reviews a PR, it automatically posts a comment like this:
## π€ SmartCode AI Review
**PR Confidence Score: 72/100** β β οΈ REVIEW NEEDED
### π Score Breakdown
| Dimension | Score |
|-----------|-------|
| Requirement Alignment | 85/100 |
| Security Safety | 58/100 |
| Code Quality | 70/100 |
| Test Coverage | 45/100 |
| Static Analysis | 82/100 |
### π Findings (4 issues)
#### π΄ CRITICAL β SQL Injection in payment query handler
**File:** `src/payments/queries.py:42`
query = f"SELECT * FROM payments WHERE user_id = '{user_id}'"
**Suggested Fix:** Use parameterized queries:
cursor.execute("SELECT * FROM payments WHERE user_id = %s", (user_id,))
**Confidence:** 95% Β· **Ref:** CWE-89, OWASP A03:2021
---
#### π΄ HIGH β Missing pagination for transaction listing
**File:** `src/payments/routes.py:67`
Issue #189 requires paginated transaction listing.
Current implementation returns all records with no limit.
**Suggested Fix:** Add limit/offset parameters to the query.
**Confidence:** 88% Β· **Ref:** Issue #189
---
#### π‘ MEDIUM β N+1 query in payment detail enrichment
**File:** `src/payments/service.py:91`
1001 queries instead of 2 for 1000 payments.
**Suggested Fix:** Prefetch merchants with a single IN query.
**Confidence:** 82%
---
#### π’ LOW β Missing error handling for external API call
**File:** `src/payments/gateway.py:128`
**Suggested Fix:** Add timeout and try/except for request failures.
**Confidence:** 76%
---
> π‘ Powered by SmartCode β AI Code Review that understands intentSmartCode calculates four measurable indicators for every review:
| Metric | Range | What It Measures |
|---|---|---|
| Bug Risk Score | 0-100 | Inverse severity-weighted finding count |
| Review Confidence | 0-100% | Composite PR safety score |
| Security Severity Index | 0.0-10.0 | Vulnerability density per file |
| Technical Debt Indicator | 0.0-10.0 | Complexity + nesting + function sprawl |
| Layer | Technology |
|---|---|
| Backend | Python 3.11+, FastAPI, Celery |
| Database | PostgreSQL 15+ (SQLite for dev) |
| Queue | Redis 7+ |
| LLM | OpenRouter β DeepSeek R1 |
| Static Analysis | AST (Python), Tree-sitter, Semgrep |
| GitHub | GitHub App, Webhooks, PyGithub |
| Frontend | React 18+, TypeScript, Recharts, shadcn/ui |
| Deployment | Docker, Docker Compose |
# 1. Clone and setup
git clone https://github.com/riyaa1611/SmartCode.git
cd SmartCode
# 2. Create virtual environment
python -m venv .venv
.venv\Scripts\Activate.ps1 # PowerShell
# source .venv/bin/activate # macOS/Linux
# 3. Install dependencies
pip install -r requirements.txt
# 4. Configure environment
cp .env.example .env
# Edit .env with your OPENROUTER_API_KEY
# 5. Initialize database
python init_db.py
# 6. Run the server
uvicorn main:app --host 127.0.0.1 --port 8084 --reloaddocker compose up --build -d
docker compose exec smartcode-app python init_db.pycd frontend
npm install
npm run devcurl http://localhost:8084/api/demo/review/1 | python -m json.tool- GitHub App webhook integration
- AI-powered PR review (security, performance, requirements)
- PR Approval Confidence Score (0-100)
- Structured findings with suggested fixes
- Metrics dashboard (Bug Risk, Security Index, Tech Debt)
- Multi-repo evaluation framework
- Custom architectural rule definitions
- Learning from developer feedback (accept/dismiss signals)
- VS Code extension for inline review
- Dependency vulnerability scanning integration
SmartCode/
βββ main.py # FastAPI application entry point
βββ config.py # Environment-based settings
βββ models.py # SQLAlchemy models (Review, Finding)
βββ worker.py # Celery worker β full analysis pipeline
βββ database.py # Database engine + session
βββ analysis_engine/
β βββ llm_reviewer.py # LLM-powered review (4 dimensions)
β βββ prompt_templates.py # Production-grade prompt templates
β βββ confidence_scorer.py # PR Approval Confidence Score
β βββ metrics_calculator.py # Bug Risk, Security Index, Tech Debt
β βββ code_analyzer.py # AST complexity + diff analysis
β βββ requirement_extractor.py # Issue β requirements parser
β βββ aggregator.py # Findings aggregation + DB mapping
βββ github_integration/
β βββ client.py # GitHub App auth + PR commenting
βββ data_pipeline/
β βββ collector.py # PR, issue, and project data collector
βββ routes/
β βββ api.py # REST API endpoints
β βββ webhook.py # GitHub webhook handler
β βββ health.py # Health check
βββ frontend/ # React 18 + TypeScript dashboard
βββ docker-compose.yml # Postgres + Redis + app
βββ Dockerfile # Container build
βββ CAREER.md # Resume + portfolio positioning
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Commit your changes:
git commit -m "Add your feature" - Push to the branch:
git push origin feature/your-feature - Open a Pull Request
MIT License β see LICENSE for details.
Built with β€οΈ as a production-grade AI developer tool
Problem β’ Solution β’ Architecture β’ Quick Start