AJ
Back to Builds
WebComplete

GitHub Repo Analyzer

A Next.js tool that analyzes any public GitHub repository using Gemini AI to surface code quality insights, language breakdowns, commit patterns, and contributor stats through interactive Recharts visualizations.

Next.jsGoogle GeminiRechartsTypeScript

Overview

GitHub Repo Analyzer is a web tool that takes any public GitHub repository URL and produces a structured analysis report. It pulls repository metadata via the GitHub API, feeds the data to Gemini AI for qualitative analysis, and presents the results through a dashboard of interactive Recharts charts: language distribution, commit frequency, contributor activity, and an AI-generated code quality assessment.

Why it was built

Built as an exploration of the Google Gemini API and a practical tool for quickly assessing unfamiliar open-source repositories before deciding to depend on them. The goal was to combine structured API data with AI-generated insight in a single readable view.

Repo URL Input

Accepts any public GitHub repository URL and extracts the owner and repo name automatically. Validates the format before hitting the API and surfaces a clear error if the repository doesn't exist or is private.

Language Breakdown Chart

Fetches the languages API endpoint and renders a Recharts pie chart with percentage labels. Hovering a segment shows exact byte counts alongside the percentage.

Commit Frequency Visualization

Pulls the commit activity stats endpoint and renders a bar chart of weekly commit counts for the past year, useful for spotting whether a repo is actively maintained or has gone cold.

Tech Breakdown

Next.js API Routes

GitHub API calls and the Gemini request both run server-side via Next.js API routes, so the GitHub token and Gemini API key never reach the browser.

Google Gemini (@google/genai)

The Gemini API was the primary thing being explored in this build. Used the generateContent endpoint with a structured prompt to produce a JSON-shaped analysis response rather than raw prose.

Recharts

A React-first charting library that composes well with Next.js. The pie and bar charts are fully responsive via ResponsiveContainer and required minimal custom styling.

react-hot-toast

Used for the API error states: invalid repo, rate limit hit, private repo. Non-blocking toasts fit better than inline error messages for a single-input tool.

Challenges
  • 1

    GitHub's commit activity endpoint returns null for repos with no activity in the last year, and returns a 202 (not 200) on first call while it computes stats asynchronously, and both cases required explicit handling to avoid confusing chart errors.

  • 2

    Gemini's response for qualitative analysis needed to be constrained to a predictable JSON shape. Prompt engineering to reliably get structured output (rather than markdown prose) took several iterations.

What's Next

The core tool is complete. Interesting next additions would be side-by-side repository comparison, caching analysis results to avoid redundant API calls, and an export-to-PDF option for the generated report.

See it live

Check out the deployed site.