The Problem.
A lot of code-analysis tools either stop at lint output or hand the problem off to a chat box. I wanted something that could take a chunk of code, analyze it, and return useful information in a format that was easy to scan instead of another wall of AI text.
The project also gave me a good excuse to work across the whole stack: request handling and validation on the backend, a structured AI response contract, and a frontend that had to turn that data into something people could actually read quickly.
How It Works.
The Next.js frontend sends source code to a FastAPI backend through a dedicated analysis endpoint. The backend uses Pydantic models to keep the request and response shape predictable, sends the analysis request to Claude, and returns structured complexity data and suggestions to the UI.
The frontend maps that response into a complexity gauge, code metrics, severity-based suggestions, function-level breakdowns, and a local history view. The important part is that the UI consumes structured data rather than trying to parse prose after the fact.
Decisions That Mattered.
- Use a structured AI response contract so the visualization layer has predictable data to work with.
- Keep analysis history in localStorage instead of adding accounts and a database before the product needed them.
- Separate the Python analysis API from the Next.js frontend so each side can change without turning the project into one giant application layer.
- Treat the charts as part of the product, not decoration. The point is to make complexity and problem areas obvious at a glance.
Challenges & Tradeoffs.
LLM output is useful, but only if the application can rely on the shape it gets back. Getting the AI response into a contract the UI could safely render was more important than simply making the API call work.
There was also a state-management edge case in the original portfolio link: sending a cold visitor directly to the results route assumed analysis state already existed. The portfolio now links to the actual entry flow instead.
What I'd Change Today.
- Add contract and integration tests around the analysis endpoint and the frontend states that depend on it.
- Version the scoring format if the analysis rules become more sophisticated so old results stay understandable.
- If persistent history ever becomes a real user need, move it behind optional accounts instead of forcing a database into the current product.
