Phil Warner
All projects

RepoPulse

Live

Paste any public GitHub repository and get five views of it on one screen: commit activity, top contributors, languages, how much changed recently, and which files took that change. One request fans out to GitHub and comes back as a single dashboard.

Role
Solo: code, tests, deployment. Visual design and CSS by AI
Timeline
One week, September 2026
Stack
Next.js 16 (App Router), React 19, TypeScript, CSS Modules, GitHub REST API, Node's built-in test runner, Vercel
Tests
49 passing

Why I built it

I wanted to build something on top of a public API. Some popular ones, like Spotify and Strava, only share a person's data after that person signs in with their account. GitHub doesn't: anyone can read public repos without signing in, and there are years of history to dig into.

  • One request from the browser

    My own API talks to GitHub and returns only what the screen needs.

  • Stay inside a shared budget

    Every visitor shares one token and 5,000 GitHub requests an hour.

  • One failure doesn't sink the page

    If one section fails, the other four still render.

  • Every number means what it says

    A dashboard whose job is reporting numbers can't show one that only looks right.

I picked GitHub after ruling out Spotify, Last.fm and Strava. I checked each one live, not in the docs: two now need a paid subscription just to register an app, and one has no history until you start using it.

How it's built

The browser asks my API about one repo. The API asks GitHub for five sections in parallel, trims them down and sends back one response.

Browser

One request for ?repo=owner/name. Each panel renders its own section.

/api/repo-insights

Checks the repo name, fans out, caches, and returns { data, error } for each section.

GitHub REST API

Repo details, languages, contributors, commit activity and churn

  • A backend for the frontend. GitHub's raw responses are huge: full commit objects, signatures and diff text. The API keeps the few fields the screen uses and drops the rest before anything reaches the browser.
  • Each section succeeds or fails on its own. Every section returns { data, error }, so the route never fails just because one GitHub call did. The dashboard decides what each failure means.
  • The repo name is a security check. Every call carries my GitHub token, so ?repo=../user would reach an authenticated endpoint outside /repos/. Anything that isn't exactly owner/name is rejected before it goes into a URL.
  • REST, on purpose. My day job already shows GraphQL, so this project shows a well-designed REST API instead.
  • Cached per call. Each GitHub call has its own cache time, from a minute for "last pushed" to a day for data that can't change until midnight UTC.

Honest numbers

Analytics tools tend to show a number without saying what it counts. Four of these needed a decision about what they mean, and the live site explains each one.

  • ~25% more commits than git log shows on React. The headline uses the same source as the chart under it, so the two always agree.
  • 300+ is the most "Files changed" can show. GitHub stops at 300 and gives no total, so the tile says so instead of guessing.
  • 0 lockfiles in the churn ranking. On React, yarn.lock outranked every hand-written file. They still count as files changed, because they did change.
  • 90 whole UTC days, today included. Not 90 × 24 hours from whenever the page loaded.

Problems I solved

Churn in one call, not a hundred

"Which files changed most in 90 days" usually means fetching every commit, then every commit's files: over 100 requests for an active repo, against a budget every visitor shares. Instead I find the last commit before the 90-day mark and make one compare call from there to HEAD, which returns totals per file for the whole range.

Caching on serverless

Next.js 16's newer use cache keeps entries in memory, and the docs say that on serverless they usually don't survive between requests. Two visitors a minute apart would both reach GitHub. I used the fetch cache instead, which only keeps successful responses, so a failure or a "still computing" reply is never stuck in the cache. A repeat request for a small repo made zero GitHub calls.

Testing it turned up a limit: Next.js won't cache anything over 2 MB, and React's 90-day comparison is 2.77 MB. I kept the cache on that call anyway. It does nothing on the largest repos and works for everything else.

The same error means different things

A 403 on contributors means GitHub won't list a huge history like Linux's. A 403 anywhere else means the shared token hit the rate limit. One function maps each section and status code to ok, pending, empty, unavailable or failed, and tests fail if anyone simplifies it to a single lookup table. Failures get a warning box. Empty and unavailable get quiet text, so a repo GitHub won't count doesn't look broken.

A contributor count that was really a page size

The tile showed 30 for every popular repo. That's GitHub's default page size; React has 411. A second request asks for one contributor per page, runs in parallel with the first, and reads the last page number from the Link header. With one per page, that number is the total.

  • Stats still computing

    GitHub answers 202 while it builds commit stats. The server retries briefly, then the panel stays loading and asks again, up to three times.

  • Paths that keep the filename

    Long paths shorten the folders and keep the filename whole, in CSS, so screen readers and copy-paste get the full path.

  • "3 days ago", not "1 month ago"

    Relative times come from elapsed time, never from comparing month numbers, so 29 September to 2 October is 3 days.

Trade-offs

Most of these had a reasonable alternative, so the reasons matter more than the choices.

Decision What I chose Why
Missing repos Ask for all five sections at once, check the repo exists after Checking first saves five calls on a typo but slows down every load that works. My first instinct was to check first; I changed my mind
Abuse Caching first, rate limiting later Caching handles someone impatient; rate limiting handles someone hostile. The first is far more common
Charts No charting library: 52 divs sized by percentage The only math was one division. Plain HTML made accessibility simpler too
Language % Divide by all bytes, with a gray remainder Dividing by the top five fills the bar neatly, but overstates every language
Churn ranking Server ranks and keeps 20; the page shows 5 The server decides what the data is; the page decides how much to show
Data fetching Client fetch and an API route now; Server Components with streaming later Caching made the current version fast, and rewriting the core while shipping is how projects don't ship
Error tracking console.error in the error boundary, no paid service Right for a portfolio site. I'd add one when there are real users

Design and accessibility

The visual design isn't mine: I asked AI to design the site in the style of GitHub's Universe 2018 conference site. That's where the dark blue-gray background, the drifting stars, the slow pulse while loading and the single-line input with a sliding arrow come from. The gradient runs violet to pink to orange as a thin border, not a fill, so the numbers stay the brightest thing on screen.

Charts are usually where dashboards stop being accessible, so I built the commit chart for it from the start.

  • Every bar names itself

    Each bar has its week and commit count as an accessible name, so the hover tooltip is a convenience, not the only way in.

  • The chart is also a table

    One "View as table" panel instead of 52 tab stops, and you can copy from it.

  • Color checked, not eyeballed

    Color pairs tested under simulated color blindness, and every data mark measured at 3:1 contrast or better.

  • Motion is optional

    The stars, the loading pulse and the skeleton shimmer stop when Reduce motion is on.

That's markup and measurement, not a conformance claim. Nothing has been through a real screen reader yet, and the pages around the chart haven't been audited.

Testing and workflow

  • 49 tests passing
  • 0 test dependencies: Node's built-in runner runs the TypeScript directly
  • 7 GitHub calls per page load, and zero once cached, on most repos
  • Tests go where the risk is. The bugs here are arithmetic: the 90-day window, UTC versus local time, seconds versus milliseconds. Those are plain functions, so they need no browser and no testing library.
  • A frozen clock. Date tests pin the time to a fixed moment, so they pass on any day, in any time zone.
  • Tests caught a refactor bug. Rewriting "time ago" as a table briefly showed "12 months ago" for days 360 to 364. The tests failed the moment it landed.
  • Caching checked in a production build. next dev and a hard refresh both skip the cache, so I verified it with next build && next start.

How I used AI

For the app itself, I used AI as a pairing partner that teaches, not one that writes the code. I drove and made the calls. It asked questions, reviewed my work, pointed me to the Next.js 16 docs, and kept a running list of every trade-off and why, so I could explain them later.

  • The visual design and CSS are AI's. I asked it to design the site in the style of GitHub's Universe 2018 site, and it wrote almost all of the CSS. I don't take credit for the look.
  • It argued, I decided. It talked me out of checking the repo exists before fetching. I kept my own approach where it held up, and it rejected one of mine for the contributor count with reasons I agreed with.
  • I asked the questions that shaped the design. For a repo with no languages, I asked how the panel would know the difference between "GitHub found none" and "the request failed". It's easy to miss, because an empty result is a success with no error code. So each panel checks three things in order: did it fail, did it come back empty, and only then is there data to show.

What it got wrong

Checking whether the cache worked, it trusted four indirect measurements, and each one was wrong. One read a rate-limit counter that never moves for these calls, so it would have reported success even if the cache did nothing. Five lines of timing logs settled it in one run: a cache hit takes 0–1 ms, a real GitHub call 100 ms or more. Measure the thing itself.

What I learned

  1. 01

    A wrong number that looks right is the worst kind.

    "30 contributors" looked fine. A blank tile would at least have been obviously wrong.

  2. 02

    Numbers side by side must agree, or say why not.

    A headline that contradicts the chart under it loses the reader's trust in both.

  3. 03

    Where it runs decides how to cache.

    The newer API was the wrong choice for serverless. Read the docs for the platform, not the changelog.

  4. 04

    Measure it, don't infer it.

    Before trusting a measurement that says nothing happened, check it can show you when something did.

  5. 05

    Make the common case fast.

    Guarding against a rare typo by slowing every good request is the wrong way round.

What's next

  • Move the dashboard to Server Components with streaming, so panels appear as they're ready, and write up what changed
  • Validate GitHub's responses at runtime with Zod, which also gives the API and the page one shared type
  • Tests for the repo-name check and the API route
  • A full accessibility pass, including a real screen reader
Next project NotWordle