A Next.js app that ranks the most-used programming languages on GitHub by public repository count, pulled from the GitHub Search API and cached hourly.
- Next.js 16 (App Router, Turbopack)
- React 19
- TypeScript 6
next/fontfor self-hosted Google Fonts- Async Server Component data fetch with hourly ISR and shared data caching
bun install
bun run devThe page works without auth, but GitHub's unauthenticated Search API is limited to 10 requests/minute, which isn't enough for the 14 tracked languages. Add a token to lift the limit to 30/minute.
Add a personal access token (no scopes needed) to
.env or .env.local:
GITHUB_TOKEN=ghp_xxx
Add or remove languages in the LANGUAGES list in
src/server/languages.ts.
bun run dev— start the dev server on port 3000bun run build— production buildbun run start— serve the production build on port 3000bun run lint— ESLint (eslint-config-next)bun run typecheck— TypeScript check
src/server/languages.ts queries
search/repositories?q=language:<lang> for each tracked language, reads total_count, and
sorts by repo count. The GitHub requests run concurrently, and the combined result is stored
in Next.js's persistent data cache for one hour.
src/app/page.tsx also uses hourly Incremental Static Regeneration (ISR). Vercel can therefore serve the generated page from its edge cache instead of invoking a function and waiting for GitHub during each visit. When the cached page expires, stale content continues to be served while Next.js regenerates it.
- Push the repo to GitHub and import it in Vercel — the Next.js preset is detected automatically.
- Environment variables: add
GITHUB_TOKENin the Vercel project settings. - Deploy.
The cache uses Next.js's platform cache rather than a function's temporary filesystem, so it is shared across serverless instances on Vercel.