Skip to content

0xdevabir/gitstate

Repository files navigation

GitHub Insights Generator

A modern web application that generates beautiful, customizable GitHub statistics cards for your profile README.

🎯 Overview

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

✨ Features

Core Features

  • βœ… Real-time GitHub API integration
  • βœ… Multiple built-in themes
  • βœ… Checkbox-based configuration panel
  • βœ… Live preview rendering
  • βœ… One-click code copy functionality
  • βœ… Responsive design

Statistics Display

  • Total public repositories
  • Total followers
  • Total stars earned
  • Top used programming languages
  • Join date
  • User location
  • Top repositories
  • And more...

Embed Formats

  • SVG - Recommended for best quality
  • HTML - For embedding in web pages
  • Markdown - For GitHub README files

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn
  • GitHub account (optional, but needed to fetch stats)

Installation

  1. Clone the repository:
git clone <repository-url>
cd gitstate
  1. Install dependencies:
npm install
  1. Create .env.local file (optional but recommended):
# Get your token from: https://github.com/settings/tokens
GITHUB_TOKEN=your_token_here
NEXT_PUBLIC_APP_URL=http://localhost:3000
  1. Run the development server:
npm run dev
  1. Open http://localhost:3000 in your browser

πŸ“ Project Structure

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

πŸ”§ Architecture

Frontend

  • Framework: Next.js 16
  • UI: React 19 with TypeScript
  • Styling: Tailwind CSS
  • Icons: Lucide React

Backend

  • API Routes: Next.js API routes
  • Data Fetching: Axios
  • Caching: Next.js ISR (60 minutes)

External APIs

  • GitHub REST API: For user data, repositories, and statistics

🌐 API Endpoints

GET /api/insights/[username]

Generates and returns an SVG statistics card

Query Parameters:

  • theme: dark | light | neon | ocean (default: dark)
  • showRepositories: true | false
  • showFollowers: true | false
  • showStars: true | false
  • showLanguages: true | false
  • showJoinDate: true | false
  • showLocation: true | false

Example:

GET /api/insights/octocat?theme=neon&showLanguages=true

GET /api/stats/[username]

Returns GitHub statistics as JSON

Example:

GET /api/stats/octocat

🎨 Themes

Dark Theme

  • Background: #1a1a2e
  • Card: #16213e
  • Text: #eaeaea
  • Highlight: #e94560

Light Theme

  • Background: #f5f5f5
  • Card: #ffffff
  • Text: #333333
  • Highlight: #3498db

Neon Theme

  • Background: #0a0e27
  • Card: #1a1f3a
  • Text: #00ff88
  • Highlight: #00d9ff

Ocean Theme

  • Background: #0c1e3a
  • Card: #1a3a52
  • Text: #a8d8f0
  • Highlight: #4db8ff

πŸ“ Usage Examples

Using in GitHub README

  1. Generate your stats card
  2. Select your preferred theme
  3. Copy the Markdown embed code
  4. Paste in your README.md:
<div align="center">
  <img src="https://yoursite.com/api/insights/octocat?theme=dark" />
</div>

πŸ” Security Considerations

  • βœ… No API tokens exposed to client
  • βœ… GitHub token stored in environment variables
  • βœ… Rate limiting handled automatically
  • βœ… Caching implemented
  • βœ… Proper error handling

πŸ“Š GitHub API Rate Limits

  • Unauthenticated requests: 60 requests/hour
  • Authenticated requests: 5,000 requests/hour

Configure your GitHub token in .env.local for higher limits.

πŸš€ Deployment

Deploy to Vercel (Recommended)

vercel deploy

Environment Variables

Add to your hosting platform:

  • GITHUB_TOKEN (optional)
  • NEXT_PUBLIC_APP_URL

πŸ“„ License

MIT License - see LICENSE file for details

πŸ™ Acknowledgments

Built with ❀️ by Abir


Happy coding! πŸš€

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages