A lightweight Flask web app that analyzes code files or entire project folders using a local AI model. Upload your code, get back a structured review with severity-labeled issues, architecture summary, and syntax-highlighted suggestions — all running locally with no external API calls.
- Folder or file upload — analyze a single file or an entire project directory
- Two-pass analysis — pass 1 summarizes architecture, pass 2 does a deep review using that context
- Severity labels — issues are labeled
[CRITICAL][HIGH][MEDIUM][LOW]and color-coded - Line number references — line numbers are injected into context so the AI can pinpoint exactly where issues are
- Proper file tree — uploaded project structure is rendered as a real ASCII tree
- Syntax highlighting — code blocks in AI output are highlighted via highlight.js
- Summary caching — re-analyzing the same project skips pass 1 (cached by content hash)
- Works with any OpenAI-compatible API — Ollama, LM Studio, or any local model server
- Python 3.10+
- A running local model server (Ollama, LM Studio, etc.)
# Clone the repo
cd code-analyzer
# Install dependencies
pip install flask requests
# Start your model server (example with Ollama)
ollama serve
ollama pull llama3.2:3b
# Run the app
python app.pyOpen http://localhost:5000 in your browser.
Edit the config block at the top of app.py:
API_URL = "http://localhost:11434/v1/chat/completions"
MODEL = "dolphin3.0-llama3.1-8b"
MAX_FILES = 50
MAX_CHARS_PER_FILE = 8000
MAX_TOTAL_CHARS = 25000| Setting | Description |
|---|---|
API_URL |
Any OpenAI-compatible /v1/chat/completions endpoint |
MODEL |
Model name as your server expects it |
MAX_FILES |
Max files accepted per upload |
MAX_CHARS_PER_FILE |
Per-file character limit before truncation |
MAX_TOTAL_CHARS |
Total context limit (~6k tokens, safe for 8k context models) |
.py .js .ts .jsx .tsx .html .css .scss .java .c .cpp .h .go .rs .rb .php .json .yaml .yml .toml .sh .bash .md .txt
code-analyzer/
├── app.py
└── templates/
└── index.html
- Files are uploaded and line numbers are prepended to each file (
0001: ...) - A proper ASCII file tree is built from the uploaded paths
- Pass 1 — the AI summarizes the project architecture (result is cached)
- Pass 2 — the AI does a deep review, grounded by the summary and file tree
- Results are rendered with severity coloring and syntax highlighting
- Chat tab for follow-up questions about the review
- Docker container for integration with existing stacks
- Git repo URL input (clone and analyze directly)
- Cross-project analysis via vector search when integrated with Qdrant
- The summary cache is in-memory and resets when the server restarts
- Drag and drop works for files; folder drag-and-drop behavior varies by browser — use the folder picker button for reliability
- Works best with code-focused models (e.g.
deepseek-coder,codellama,qwen2.5-coder) but any capable model will work - Firefox will not work with drag and drop, use file picker.