feat: add GitHub stars display with ISR and optimized caching#19
Merged
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds GitHub stars display to the marketplace with ISR caching and intelligent API call optimization.
Features
Technical Changes
New Files
apps/web/server/utils/github.ts- GitHub API utility functionsModified Files
apps/web/nuxt.config.ts- Added ISR route rulesapps/web/app/pages/index.vue- Changed to useAsyncData for SSRapps/web/server/api/marketplaces.get.ts- Integrated stars fetching with cachingapps/web/app/components/PluginCard.vue- Added stars badge displayapps/web/app/types/marketplace.ts- Added stars fieldapps/web/server/utils/marketplace-schema.ts- Updated Zod schemaPerformance Improvements
Example
Configuration
For production, set
GITHUB_TOKENenvironment variable in Vercel to increase rate limit from 60 to 5000 requests/hour.Test plan