Inspiration

Joining a new codebase is slow. You open the repo, see hundreds of files, and spend days working out which ones matter, how they connect, and where the bugs are hiding. I wanted something that does that first pass for you: paste a GitHub link and get the map a senior teammate would draw on a whiteboard.

The catch with asking an AI to explain a repo is that it makes things up: files that don't exist, imports that aren't there, line numbers that point at nothing. So the core idea became the AI writes the map, and the real code checks it.

What it does

Paste any public GitHub repo and RepoLens gives you three views:

  • Architecture map: an interactive graph of the repo's modules and how they connect. Solid links are verified against real import statements; dashed links are relationships the model inferred. An animation traces how a request flows through the system.
  • Bug Radar: findings pinned to an exact file:line. The code shown next to each finding is read from the actual file, not copied from the model.
  • Guided Tour: a step-by-step onboarding walk through the codebase, with the key code for each step.

You can export everything as a Markdown report or a Mermaid diagram. There are 15 instant demos (Express, Flask, Gin, Axios, Zustand and more) that open with no wait.

How I built it

Every analysis runs in four stages, streamed live to the browser:

  1. Fetch: two GitHub API calls get the repo's metadata and full file tree. Every file is scored (manifests, README, entry points, API routes and core source rank highest), and RepoLens picks about 28 files (~150 KB), taking the best file from each area of the codebase first so one big folder can't crowd out the rest.
  2. Parse: a static parser reads imports and exports in 12 languages (TypeScript, JavaScript, Python, Go, Rust, Java, Kotlin, Ruby and more) and resolves them against the full file tree to build a real import graph.
  3. Synthesize: the AI gets the outline, import graph, exports and line-numbered source, and must answer with JSON matching a strict schema. It works with Claude, Gemini, or any OpenAI-compatible API (like NVIDIA's).
  4. Ground: nothing from the model is trusted as-is. Paths that don't exist are dropped, links are marked verified only if the import graph backs them up, missed imports are added, and every finding's line number is checked against the real file.

The front end is Next.js 16 with React Flow for the graph, Shiki for syntax highlighting, and a dot-matrix terrain drawn on a canvas. I built it with Claude Code as my AI pair programmer.

Challenges I ran into

  • AI hallucinations. The model would confidently cite files and line numbers that didn't exist. The grounding stage was the answer: treat the model's output as a draft and check every claim against the repo.
  • Free AI APIs. Free tiers were often overloaded (503 errors) or too slow to finish within the 5-minute server limit on Vercel's free plan. I added retries, made the error messages explain what happened, and prebuilt the demos so anyone can try the full experience instantly.
  • Performance. The animated landing page dropped to about 7 fps on mid-range laptops because it drew ~50,000 dots one by one every frame. Writing the dots straight into a pixel buffer brought it to 37 fps on a CPU slowed down 4× (60 fps normally) with the same look.
  • Slow demos. Opening a demo took three trips to the server one after another. Prebuilding each demo page at deploy time cut it from 2.4 s to 1.4 s and removed the server wake-up entirely.

What I learned

  • AI output is most useful when something checks it. Pairing a model with plain static analysis made the results far more trustworthy than either alone.
  • Structured output (forcing the model to answer in a fixed JSON schema) makes AI features much easier to build on.
  • Measure before optimising: the lag wasn't where I first guessed.

Impact: new contributors, students and reviewers can understand an unfamiliar codebase in minutes instead of days, which lowers the barrier to joining open-source projects.

What's next

  • Smarter file selection for very large repos and monorepos
  • Private repo support with GitHub sign-in
  • Comparing two versions of a repo to see how its architecture changed

Built With

Share this project:

Updates

Submission history