A modern web application that generates beautiful, customizable GitHub statistics cards for your profile README.
GitHub Insights Generator allows you to:
- Enter any GitHub username
- Select from multiple themes (Dark, Light, Neon, Ocean)
- Customize which statistics to display
- Preview your stats card in real-time
- Copy embed code in multiple formats (SVG, HTML, Markdown)
- Use the generated card in your GitHub profile README
- β Real-time GitHub API integration
- β Multiple built-in themes
- β Checkbox-based configuration panel
- β Live preview rendering
- β One-click code copy functionality
- β Responsive design
- Total public repositories
- Total followers
- Total stars earned
- Top used programming languages
- Join date
- User location
- Top repositories
- And more...
- SVG - Recommended for best quality
- HTML - For embedding in web pages
- Markdown - For GitHub README files
- Node.js 18+
- npm or yarn
- GitHub account (optional, but needed to fetch stats)
- Clone the repository:
git clone <repository-url>
cd gitstate- Install dependencies:
npm install- Create
.env.localfile (optional but recommended):
# Get your token from: https://github.com/settings/tokens
GITHUB_TOKEN=your_token_here
NEXT_PUBLIC_APP_URL=http://localhost:3000- Run the development server:
npm run dev- Open http://localhost:3000 in your browser
gitstate/
βββ app/
β βββ api/
β β βββ insights/[username]/ # SVG generation route
β β βββ stats/[username]/ # JSON stats API route
β βββ globals.css # Global styles
β βββ layout.tsx # Root layout
β βββ page.tsx # Main page
βββ components/
β βββ CardPreview.tsx # Stats card preview
β βββ DisplayOptions.tsx # Display options selector
β βββ EmbedCodeDisplay.tsx # Embed code display & copy
β βββ ThemeSelector.tsx # Theme selector
β βββ UsernameInput.tsx # GitHub username input
βββ lib/
β βββ card-generator.ts # SVG & embed code generation
β βββ github-api.ts # GitHub API integration
βββ types/
β βββ github.ts # TypeScript type definitions
βββ public/ # Static assets
βββ package.json
βββ tsconfig.json
βββ README.md
- Framework: Next.js 16
- UI: React 19 with TypeScript
- Styling: Tailwind CSS
- Icons: Lucide React
- API Routes: Next.js API routes
- Data Fetching: Axios
- Caching: Next.js ISR (60 minutes)
- GitHub REST API: For user data, repositories, and statistics
Generates and returns an SVG statistics card
Query Parameters:
theme:dark|light|neon|ocean(default:dark)showRepositories:true|falseshowFollowers:true|falseshowStars:true|falseshowLanguages:true|falseshowJoinDate:true|falseshowLocation:true|false
Example:
GET /api/insights/octocat?theme=neon&showLanguages=true
Returns GitHub statistics as JSON
Example:
GET /api/stats/octocat
- Background:
#1a1a2e - Card:
#16213e - Text:
#eaeaea - Highlight:
#e94560
- Background:
#f5f5f5 - Card:
#ffffff - Text:
#333333 - Highlight:
#3498db
- Background:
#0a0e27 - Card:
#1a1f3a - Text:
#00ff88 - Highlight:
#00d9ff
- Background:
#0c1e3a - Card:
#1a3a52 - Text:
#a8d8f0 - Highlight:
#4db8ff
- Generate your stats card
- Select your preferred theme
- Copy the Markdown embed code
- Paste in your README.md:
<div align="center">
<img src="https://yoursite.com/api/insights/octocat?theme=dark" />
</div>- β No API tokens exposed to client
- β GitHub token stored in environment variables
- β Rate limiting handled automatically
- β Caching implemented
- β Proper error handling
- Unauthenticated requests: 60 requests/hour
- Authenticated requests: 5,000 requests/hour
Configure your GitHub token in .env.local for higher limits.
vercel deployAdd to your hosting platform:
GITHUB_TOKEN(optional)NEXT_PUBLIC_APP_URL
MIT License - see LICENSE file for details
Built with β€οΈ by Abir
Happy coding! π