CodeLens is a modular, full-stack code review platform designed for analyzing and reviewing source code from multiple sources — including direct input, file uploads, and GitHub repositories. It uses asynchronous job handling for scalable performance, supports GPU acceleration, and is designed for easy future extension.
- Review raw source code, uploaded files, or entire GitHub repositories
- Asynchronous job queue with background task processing (
asyncio) - Real-time job tracking via job IDs
- Unified job creation and management
- Persistent job storage via database (
SQLite3) - Get Code reviews, Architecture Feedback with diagrams and Security findings
- Modern, minimal, responsive design using TailwindCSS
- Code editor built with Monaco Editor (
@monaco-editor/react) - Dynamic code input card with styled slider and animated transitions
- Snackbar notifications for job success / error states
- Enhanced buttons and inputs across pages (
CodeInput,FileUpload,GithubRepoInput) - Modular component design for reuse and scalability
- Modular async architecture
- Unified job creation logic
- File, code, and GitHub URL analysis handled independently
- Built-in GPU support for ML-based review models (PyTorch)
- Centralized error handling and structured logging
- Integrated health checks and background workers
CodeLens/
│
├── backend/
│ │
│ ├── app/
│ │ ├── __init__.py
│ │ │
│ │ ├── main.py
│ │ ├── config.py
│ │ ├── analyzer.py
│ │ ├── db.py
│ │ ├── schemas.py
│ │ ├── security.py
│ │ ├── utils.py
│ │ ├── personalization.py
│ │ ├── prepare_files.py
│ │ │
│ │ ├── core/
│ │ │ ├── __init__.py
│ │ │ └── logging_config.py
│ │ │
│ │ ├── models/
│ │ │ ├── __init__.py
│ │ │ └── job_status.py
│ │ │
│ │ └── review_engines/
│ │ ├── __init__.py
│ │ ├── base.py
│ │ └── python_engine.py
│ │
│ ├── test_scripts/
│ │ ├── test_script1.py
│ │ └── test_script2.py
│ │
│ ├── main_modal.py
│ ├── requirements.txt
│ ├── reviews.db
│ └── personal.db
│
├── frontend/
│ ├── app/
│ │ ├── layout.tsx
│ │ ├── page.tsx
│ │ ├── layout.css
│ │ └── components/
│ │ ├── ArchitectureDiagram.tsx
│ │ ├── CodeInput.tsx
│ │ ├── FileUpload.tsx
│ │ ├── GithubRepoInput.tsx
│ │ ├── JobStatusLoader.tsx
│ │ ├── ReviewResult.tsx
│ │ └── StatusBadge.tsx
│ │
│ ├── lib/
│ │ └── api.ts
│ │
│ ├── styles/
│ │ └── globals.css
│ │
│ └── utils/
│ └── StarterCodes.ts
│
├── docker-compose.yml
├── Dockerfile.backend
├── Dockerfile.frontend
├── .gitignore
├── CODEOWNERS
├── LICENSE
└── README.md| Layer | Technology |
|---|---|
| Frontend | Next.js 15, React, TailwindCSS, Monaco Editor |
| Backend | FastAPI, Python 3.10+, asyncio |
| AI/ML | PyTorch (GPU-accelerated) |
| Database | SQLite (dev) / PostgreSQL (prod) |
| Logging | Python logging module (configurable for Elastic/Kibana) |
| Job Management | Custom async queue with in-memory + DB persistence |
- A new request (code, file, or repo) triggers
schedule_job(). - A unique
job_idis created and stored in both memory and DB. - A background task (
asyncio.create_task(process_job())) begins processing. - The frontend polls or queries
/status/{job_id}to fetch updates. - Once completed, results or errors are updated in DB and memory.
- Snackbar notifications inform the user on the frontend.
The backend supports GPU acceleration using PyTorch.
If you encounter CUDA issues, reload the UVM kernel modules:
sudo rmmod nvidia_uvm
sudo modprobe nvidia_uvmVerify GPU availability:
import torch
print(torch.cuda.is_available()) # should return Truecd frontend
nvm use <version> # in case of multiple node versions
npm install
npm run devcd backend
python -m venv venv # To create virtual environment
source venv/bin/activate
pip install -r requirements.txtPyTorch packages are excluded from requirements.txt to avoid build and deployment conflicts.
pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1+cu117 --index-url https://download.pytorch.org/whl/cu117pip install torch==1.13.1+cpu torchvision==0.14.1+cpu torchaudio==0.13.1+cpu --index-url https://download.pytorch.org/whl/cpuThen, to run:
uvicorn app.main:app --reload- Multi-language static analysis engines
- Job queue persistence with Redis or RabbitMQ
- Authentication and user accounts
- Role-based dashboards for reviewers
- Live job progress via WebSockets