feat(marketing): add /starchart page with real GitHub star history
Merged
AV
3mo ago+1195+1195+0123456789012345678901234567890123456789-30-30-01234567890123456789
Summary
- New
/starchartpage: a real cumulative star-history chart for superset-sh/superset, a weekly/daily pace bar chart, peak/current pace stats, and a date-range picker with a day/week granularity toggle. - Data comes from GitHub's stargazers API using each star's exact timestamp — not sampled or interpolated — bucketed daily under the hood, with weekly rollup as the default view.
- Extracted a shared
apps/marketing/src/lib/github.ts(GitHub URL parsing + star-count formatting), used byGitHubStarCounter, the new page, andcommunity/page.tsx(which previously carried its own duplicate copy of the same logic).
Why / Context
Wanted a page that shows how the repo's GitHub stars have grown over time, backed by real data rather than an approximation.
How It Works
getStarHistory()fetches every stargazer page (with thestar+jsonmedia type, which requires an authenticated request — GitHub 401s the plain stargazers endpoint even for public repos) and buckets exact per-star timestamps into daily cumulative counts. Falls back to evenly-sampled pages + interpolation for repos too large to fetch in full (>~40k stars); falls back further to just the live total (no chart) if page fetches fail past a tolerance threshold, so a bad token or rate limit never renders a fabricated curve.aggregateToWeekly()rolls daily points up to Monday-anchored weeks for the default view;StarChartSection(client) filters by date range and toggles day/week granularity, all client-side since the full dataset (a few hundred points at most) ships with the page.- Pace stats (peak/current, with a live projection for the still-in-progress period) are derived generically from consecutive cumulative points, independent of bucket size.
Manual QA Checklist
-
/starchartrenders the real chart withGITHUB_TOKENconfigured; falls back to a "not available" message (no fake chart) with the token unset or when GitHub requests fail past the retry/tolerance threshold - Date-range presets (All time / Last 4 weeks / Last 3 months / Last 6 months) and custom calendar selection all filter both charts correctly
- Day/Week toggle switches granularity correctly at every range, including "All time" (~300 daily bars, still legible)
- Current-week pace projection cross-checked against an independent from-scratch script hitting the GitHub API directly — matches exactly
-
/communitystill renders its star count after the shared-helper migration - No console errors across all of the above (checked via headless Chrome + Playwright)
Testing
bun run typecheck(apps/marketing)bunx biome check(apps/marketing/src/app/starchart, apps/marketing/src/lib/github.ts, apps/marketing/src/app/community/page.tsx)- Manual testing via local dev server + headless Chrome screenshots, and a standalone script that independently re-derives the star history from GitHub's raw API to cross-check the app's numbers
Design Decisions
- Why fetch every page instead of just sampling: for a repo this size (~130 pages), fetching everything is cheap under an authenticated rate limit and gives an exact histogram instead of an approximation — no reason to trade accuracy for a request budget we're not close to.
- Why bail to "not available" instead of showing partial data on fetch failure: an earlier version silently rendered a fabricated flat-then-spike curve when most/all page fetches failed (bad token scope). Showing nothing is more honest than showing something wrong.
- Why client-side date filtering instead of re-fetching per range: the whole dataset is small (a few hundred points), so shipping it once and filtering in the browser is simpler and instant, with no extra GitHub requests per interaction.
Known Limitations
- Requires a
GITHUB_TOKEN(any PAT, no scopes needed) to be configured in the marketing app's environment — the stargazers endpoint 401s without one. Documented in.env.example/.env.local.example; the page degrades gracefully (live total only, no chart) if it's missing. - The large-repo fallback path (>~40k stars, not currently applicable to this repo) has a couple of edge cases around partial fetch failures that aren't as tightly corrected as the primary exact-fetch path.
Summary by cubic
Adds a new /starchart page that charts real GitHub star history for the repo and shows weekly/daily pace. This replaces approximations with exact data and fixes timezone and current-period pacing errors.
- Fetches every stargazer with
star+jsonfor exact per-star timestamps; samples and interpolates only for very large repos; falls back to live total (no chart) if too many page fetches fail. - Requires migration: set
GITHUB_TOKEN(read‑only PAT, no scopes) in the marketing app env; without it, the page shows the live total only. - Adds a date‑range picker and day/week toggle; ships the full dataset and aggregates client‑side for instant interactions.
- Extracts shared helpers in apps/marketing/src/lib/github.ts for repo slug parsing and star-count formatting; updates
GitHubStarCounterand/communityto use them. - Fixes a timezone bug that rendered dates a day early west of UTC and corrects current‑week pace projection.
- Adds
recharts,react-day-picker, andserver-onlyto apps/marketing dependencies.
Summary by CodeRabbit
- New Features
- Added a new
/starchartpage showing GitHub star history, total stars, and daily or weekly growth pace. - Added date-range filtering and interactive history and pace charts.
- Added projected values for the current incomplete period.
- Added support for optional GitHub authentication, with graceful fallback to live star totals when unavailable.
- Added a new
- Improvements
- Improved GitHub repository detection and star-count formatting across marketing pages.