A hub-and-spoke portfolio. This site (the hub) is a small Next.js app that
auto-discovers your projects from GitHub and showcases them as cards linking
to independently deployed live apps (the spokes). Add the portfolio topic to
a repo → it appears here. No per-project wiring, no monorepo.
Live demo: add your Vercel URL here
Performance
Lighthouse (PageSpeed Insights) on the live site — desktop:

How it works
GitHub repos (topic: portfolio) ──discovery via API──▶ Hub (Next.js, Vercel, ISR)
│ renders cards
Spoke deploy ──POST /api/revalidate──▶ hub refreshes ▼
Visitor browses, links out to live apps
- Discovery. At build/ISR time the hub calls the GitHub API for your public
repos and keeps the ones tagged with the
portfoliotopic (lib/projects.ts). - Overrides. Each spoke repo may commit a
.portfolio.jsonto control its card (title, summary, tags, preview image,featured,order,hidden) — seeexamples/.portfolio.example.json. Without it, the card falls back to the repo description, homepage and topics. - Local seed.
config/projects.local.tsalways renders, so the hub builds on a fresh clone with zero config. A seed entry and a discovered repo with the sameidare merged (live GitHub data enriches the seed). - Previews. Clicking a card opens a modal. If the project opts in with
"embeddable": trueit loads live in an iframe; otherwise (many sites sendX-Frame-Options: DENY) the modal shows a screenshot with an "Open live" link. A card with no explicitimagederives a live screenshot from itsliveUrlviaimage.thum.io(free, keyless); commit apreview.pngand pointimageat it for full control. - Freshness. The page is statically generated and revalidates hourly. A
spoke can trigger an instant refresh by calling
POST /api/revalidateafter it deploys — copyexamples/spoke-notify-hub.ymlinto the spoke repo.
Adding a project
- Push the project to its own repo and deploy it (Vercel / GitHub Pages / …).
- On the repo, add the topic
portfolioand set the homepage to the live URL. - (Optional) Commit a
.portfolio.jsonto fine-tune the card. - (Optional) Add the notify-hub workflow for instant refresh.
That's it — the card shows up on the next revalidation.
Running locally
npm install
cp .env.example .env.local # set GITHUB_USER (everything else is optional)
npm run dev
Environment (.env.local):
| Var | Purpose |
|---|---|
GITHUB_USER |
Whose repos to discover. Unset → only the local seed renders. |
PORTFOLIO_TOPIC |
Topic to match (default portfolio). |
GITHUB_TOKEN |
Optional PAT — raises the API rate limit (60 → 5000/hr). |
REVALIDATE_SECRET |
Shared secret for POST /api/revalidate. |
Scripts: npm run dev, build, start, lint, typecheck.
Deploying
Import the repo in Vercel, set the env vars, deploy. Add the URL above. CI
(.github/workflows/ci.yml) runs lint, typecheck,
build on every push.
Structure
app/
page.tsx # home — fetches projects, renders grid (ISR)
opengraph-image.tsx # generated social card (next/og)
api/revalidate/route.ts # on-demand refresh, called by spokes after deploy
components/
ProjectGrid.tsx # client: search + tag filter + modal state
ProjectCard.tsx # card: preview, tags, live/code links
PreviewModal.tsx # iframe when embeddable, screenshot fallback otherwise
lib/
projects.ts # GitHub discovery + fetch (server)
merge.ts # pure merge/sort pipeline (unit-tested)
merge.test.ts # node --test
preview.ts # client-safe screenshot URL
types.ts # Project view model
config/projects.local.ts # always-on seed manifest
examples/ # .portfolio.json + spoke notify workflow to copy
Run the tests with npm test (Node's built-in runner — no extra deps).