Building an AI Code Analyzer with Google AI Studio (And Finishing It in Cursor)

Published: (February 11, 2026 at 01:20 PM EST)
4 min read
Source: Dev.to

Source: Dev.to

What I Built

Archlyze is a browser‑only SPA that uses Google Gemini to analyze source code (Rust, Python, JS/TS, Go, and more). It extracts components and dependencies, flags issues with severity, suggests fixes and unit tests, and generates flowcharts/UML/data‑flow diagrams via Gemini. We started from a detailed prompt in AI Studio (refined with Perplexity and Gemini), then finished and extended the app in Cursor with folder import, .gitignore parsing, session history, model selection, and Markdown export.

Features

Demo

Screenshot

Live demo:

My Experience

Starting in AI Studio

We began by drafting the concept and prompt with different models (Perplexity and Gemini), then took it into Google AI Studio to build the first version. A recurring issue early on was React and tooling versions—the generated app kept failing to run or build, requiring many iterations (10+ attempts) before achieving a working setup.

The Prompt

Build 'RustFlow Analyzer'—a web app for comprehensive Rust file analysis. Users upload a .rs file (max 500 lines) or paste code. 
Gemini 1.5 Pro performs deep analysis: extract all functions, structs, traits, impls; map dependencies and call relationships; identify ownership patterns, error handling, and common anti-patterns (unnecessary clones, unwrap() abuse, missing lifetimes).

Display results in three panels:

Code View: Original code with syntax highlighting (Monaco editor), clickable line numbers to jump to explanations

Analysis Panel: Collapsible sections for each major code block (functions/structs) with plain-English explanations, detected issues marked with warning/error badges, and best-practice suggestions

Visual Panel: Use Imagen to generate architecture diagrams—function call graphs (boxes + arrows showing invocation flow), struct relationship diagrams (ownership/borrowing visualized with solid/dashed lines), and module dependency trees. Include toggle buttons for diagram types (flowchart, UML, data flow). Style: professional developer docs aesthetic, Rust brand colors (orange #CE422B, dark gray), clean minimalist lines.

Features: file upload (.rs), smart truncation warning if >500 lines, 'Regenerate Diagram' button for each section, export full report as HTML with embedded images, dark/light theme, example files (basic HTTP server, CLI parser, async tokio app). Add 'Share Analysis' to generate unique URL with results cached. Loading states with progress indicators, error handling for invalid Rust syntax or oversized files. Deploy-ready SPA with responsive mobile layout

Evolving the Idea

After stabilising the base, we expanded from Rust‑only to multi‑language support and added features such as folder import, .gitignore‑aware filtering, session history, dependency detection, issue severity, auto‑fix, unit‑test generation, and multiple diagram types. Cursor proved invaluable for refactoring and extending the same codebase: AI Studio supplied the initial structure and Gemini integration, while Cursor helped keep the code consistent as we added complexity.

Structured Output and “Thinking” Models

The biggest technical takeaway was relying on a strict JSON schema for analysis. Without explicit required fields and clear descriptions in the responseSchema, Gemini 2.5 sometimes returned minimal or inconsistent JSON. Defining the schema properly made the analysis results reliable enough to drive the UI (components, issues, dependencies). I also learned that Gemini 2.5’s “thinking” phase leads to longer response times, so we added scaled timeouts (e.g., 60 s for small files, 180 s for large ones) and loading states to avoid a broken‑feeling experience while the model is reasoning.

architecture

Surprises

  1. The app works entirely without a backend—the API key lives in the browser, direct calls go to Gemini, and LocalStorage handles settings and theme, keeping the architecture simple.
  2. Image generation (gemini-2.5-flash) integrates smoothly, allowing on‑the‑fly diagram creation.

Overall, the track provided a solid path from “idea + prompt” to a real SPA: AI Studio for rapid prototyping and Gemini integration, then Cursor to harden and extend it into a usable product.

Repository

Try It

0 views
Back to Blog

Related posts

Read more »