Skip to content

feat: add GitHub stars display with ISR and optimized caching#19

Merged
amondnet merged 1 commit into
mainfrom
feat/github-stars-display
Oct 16, 2025
Merged

feat: add GitHub stars display with ISR and optimized caching#19
amondnet merged 1 commit into
mainfrom
feat/github-stars-display

Conversation

@amondnet

Copy link
Copy Markdown
Contributor

Summary

Adds GitHub stars display to the marketplace with ISR caching and intelligent API call optimization.

Features

  • GitHub Stars Badge: All plugin cards now display repository star counts
  • 🚀 ISR Caching: 1-hour revalidation reduces API calls and improves performance
  • 📊 Smart Formatting: Stars displayed as "1.5k" for counts over 1000
  • 🎯 Local Plugin Support: Local plugins show marketplace repository stars
  • Optimized API Calls: Duplicate calls eliminated with caching

Technical Changes

New Files

  • apps/web/server/utils/github.ts - GitHub API utility functions

Modified Files

  • apps/web/nuxt.config.ts - Added ISR route rules
  • apps/web/app/pages/index.vue - Changed to useAsyncData for SSR
  • apps/web/server/api/marketplaces.get.ts - Integrated stars fetching with caching
  • apps/web/app/components/PluginCard.vue - Added stars badge display
  • apps/web/app/types/marketplace.ts - Added stars field
  • apps/web/server/utils/marketplace-schema.ts - Updated Zod schema

Performance Improvements

Metric Before After
API Calls (per page load) Many 1 (cached for 1h)
Local plugin duplicate calls 50+ 1 per marketplace
Rate limit usage High risk Minimal
Initial page load Client fetch Server-side data

Example

  • anthropics/claude-code: 39.1k ⭐
  • pleaseai/spec-kit-plugin: 1 ⭐

Configuration

For production, set GITHUB_TOKEN environment variable in Vercel to increase rate limit from 60 to 5000 requests/hour.

Test plan

  • Stars display correctly for GitHub-sourced plugins
  • Stars display correctly for local plugins (using marketplace repo)
  • Duplicate API calls eliminated
  • ISR caching works correctly
  • Rate limit handled gracefully
  • UI displays formatted star counts with tooltips

Add GitHub stars display for all plugins in the marketplace with
intelligent caching and ISR support.

Features:
- Display GitHub stars badge on plugin cards with formatted count
- ISR caching (1 hour) for optimal performance and reduced API calls
- Server-side data fetching with useAsyncData for better SEO and UX
- Automatic stars fetching for both GitHub and local plugins
- Smart caching to prevent duplicate API calls for same repository
- Local plugins use marketplace repository stars

Technical improvements:
- Created GitHub API utility with rate limit handling
- Added stars field to Plugin type and Zod schema
- Optimized marketplace API to fetch stars in parallel
- Deduplicated API calls for local plugins sharing same repo
- Support for GITHUB_TOKEN environment variable (5000 req/h vs 60 req/h)

Implementation details:
- Stars displayed as badge with star icon and formatted count (1.5k format)
- Tooltip shows full star count on hover
- Graceful handling of API failures (null values)
- ISR ensures data freshness without overwhelming GitHub API
@vercel

vercel Bot commented Oct 16, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
claude-code-plugins Ready Ready Preview Comment Oct 16, 2025 1:27pm

@amondnet
amondnet merged commit d2affb6 into main Oct 16, 2025
3 of 5 checks passed
@pleaseai pleaseai Bot mentioned this pull request Oct 16, 2025
@amondnet
amondnet deleted the feat/github-stars-display branch March 4, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant