Codeyy is a local AI-powered code analysis and learning web app. You paste code (or upload a screenshot), click Analyze, and get:
- Line-by-Line Explanations & Bug Fixes with code highlights.
- Interactive Dry-Run Execution Trace with active pointer arrows (e.g.,
low,mid,high). - Data Structure Visualizers for Maps, Sets, Trees, and general variables.
- Recursion Tree Visualizations using Mermaid.js.
- Time & Space Complexity Analysis (Big-O notation).
- DSA Learning Mode (concept detection, LeetCode recommendations, and practice questions).
- Interview Prep Mode with collapsible AI interviewer questions and edge cases.
- Lab Assistant Mode generating algorithms, pseudocode, Viva Voce questions, and printable Lab Report PDFs.
- Touch-Friendly Resizable Split Panels with double-click/double-tap toggle support.
- Follow-up Context-Aware Chatbot to ask questions.
This version uses Google Gemini (gemini-1.5-flash) — which has a generous FREE tier.
codeyy/
├── backend/
│ ├── main.py ← FastAPI server (routes, health check)
│ ├── ai_service.py ← All Gemini API calls (analysis, OCR, Q&A)
│ ├── test_mock_ai.py ← Mock testing suite for AI service
│ └── requirements.txt ← Python dependencies
├── frontend/
│ └── index.html ← Entire UI (single self-contained file with HTML, CSS, JS)
├── start_windows.bat ← Double-click to run on Windows
└── start_mac_linux.sh ← Run on Mac/Linux
- Go to https://aistudio.google.com/apikey
- Sign in with a Google account
- Click "Create API Key"
- Copy the key (starts with
AIza...)
Create a file called .env inside the backend/ folder:
GEMINI_API_KEY=AIzaYourActualKeyHere
Windows: Double-click start_windows.bat
Mac/Linux:
chmod +x start_mac_linux.sh
./start_mac_linux.shThe app opens automatically at http://localhost:8000
google-generativeai>=0.7.0 ← Gemini SDK
Pillow>=10.0.0 ← Image handling for screenshot OCR
fastapi>=0.115.0 ← Web server framework
uvicorn[standard]>=0.30.0 ← ASGI server
python-dotenv>=1.0.0 ← Loads .env file
pydantic>=2.0.0 ← Request validation
python-multipart>=0.0.9 ← File upload support
| Function | What it does |
|---|---|
analyze_code(code, lang, test_case) |
Runs 2 Gemini calls in parallel — first for explanations+bugs+fixes, second for dry-run (using custom test_case if provided)+recursion tree+complexity+suggestions+DSA mode+Interview prep+Lab assistant |
extract_code_from_image(bytes) |
Sends image to Gemini Vision to extract code text |
ask_followup(question, code, lang, history) |
Single Gemini call for Q&A with conversation history |
The prompts are long and structured. Splitting them into two concurrent requests is faster than one giant prompt.
- Model:
gemini-1.5-flash(fast, free tier: 15 req/min, 1M tokens/day) - Endpoint: via
google-generativeaiPython SDK - Vision: Gemini natively handles
PIL.Imageobjects for screenshot OCR
- Pure HTML/CSS/JS — no framework, no build step
- Talks to FastAPI via
fetch()on the same origin (no CORS issues) - The frontend file is 100% self-contained
Paste this prompt:
I have a code analysis web app called Codeyy that uses Gemini instead of Anthropic. Here are the 3 backend files. Please help me with [your question].
backend/ai_service.py: [paste content] backend/main.py: [paste content] backend/requirements.txt: [paste content]
The frontend is a single
frontend/index.htmlfile — let me know if you need that too.
| Problem | Solution |
|---|---|
| "Backend not running" pill shows | Run the startup script first, then refresh browser |
| "API key missing" | Check backend/.env has GEMINI_API_KEY=AIza... (no quotes) |
ModuleNotFoundError: google.generativeai |
Run pip install google-generativeai in the venv |
| Pillow error on image upload | Run pip install Pillow |
| Port 8000 already in use | Change --port 8000 to --port 8001 in the startup script |
| Gemini rate limit (15 req/min free) | Wait a moment and retry; or upgrade to pay-as-you-go |
In backend/ai_service.py, line near the top:
_model = genai.GenerativeModel("gemini-1.5-flash") # fast, free
# or:
_model = genai.GenerativeModel("gemini-1.5-pro") # smarter, slower
# or:
_model = genai.GenerativeModel("gemini-2.0-flash") # newest fast model| Limit | Value |
|---|---|
| Requests per minute | 15 |
| Requests per day | 1,500 |
| Tokens per day | 1,000,000 |
| Cost | $0 |
For personal/learning use, the free tier is more than enough.