|
| 1 | +--- |
| 2 | +title: "GitHub Stats API" |
| 3 | +slug: "github-stats" |
| 4 | +description: "Fast GitHub Stats Graph - Generate beautiful, real-time GitHub stats cards, badges, and contribution graphs for your README files." |
| 5 | +image: "https://pphat.me/assets/projects/stats.pphat.top/cover.webp" |
| 6 | +tags: ["GitHub Stats", "SVG"] |
| 7 | +languages: ["TypeScript", "Express.js", "Node.js"] |
| 8 | +source: |
| 9 | + - |
| 10 | + name: "source" |
| 11 | + type: "source" |
| 12 | + url: "https://github.com/pphatdev/github-stats" |
| 13 | + - |
| 14 | + name: "demo" |
| 15 | + type: "demo" |
| 16 | + url: "https://stats.pphat.top" |
| 17 | + |
| 18 | +authors: |
| 19 | + - |
| 20 | + name: "PPhat Dev" |
| 21 | + profile: "https://github.com/pphatdev.png" |
| 22 | + url: "https://github.com/pphatdev" |
| 23 | + |
| 24 | +published: true |
| 25 | +createdAt: "2026-03-15T10:00:00.000Z" |
| 26 | +--- |
| 27 | + |
| 28 | + |
| 29 | +<img src="https://stats.pphat.top/graph?username=pphatdev&false&animate=pulse&size=small&show_title=false&show_total_contribution=false" alt="Contribution Graph" className=""/> |
| 30 | + |
| 31 | +<div class="blog-gallery" data-layout="snap" data-captions="true"> |
| 32 | + <img src="https://stats.pphat.top/stats?username=pphatdev&avatar_mode=radar&data_border_style=frame&data_border_frame=out&hide_title=false" alt="GitHub Stats Card" className=""/> |
| 33 | + <img src="https://stats.pphat.top/languages?username=pphatdev" alt="Languages Card" className=""/> |
| 34 | + <img src="https://stats.pphat.top/languages?username=pphatdev&type=pie" alt="Languages Pie Chart" className=""/> |
| 35 | + <img src="https://stats.pphat.top/graph?username=pphatdev&false&animate=glow&show_title=true&show_total_contribution=true" alt="Contribution Graph" className=""/> |
| 36 | +</div> |
| 37 | + |
| 38 | +<br/> |
| 39 | + |
| 40 | +<table> |
| 41 | + <tbody> |
| 42 | + <tr> |
| 43 | + <td><img src="https://stats.pphat.top/icons/typescript?color=green" alt="icon of typescript"/></td> |
| 44 | + <td><img src="https://stats.pphat.top/icons/javascript?color=green" alt="icon of javascript"/></td> |
| 45 | + <td><img src="https://stats.pphat.top/icons/nodedotjs?color=green" alt="icon of nodedotjs"/></td> |
| 46 | + <td><img src="https://stats.pphat.top/icons/nextjs?color=green" alt="icon of nextjs"/></td> |
| 47 | + <td><img src="https://stats.pphat.top/icons/shadcnui?color=green" alt="icon of shadcnui"/></td> |
| 48 | + <td><img src="https://stats.pphat.top/icons/nuxt?color=green" alt="icon of nuxt"/></td> |
| 49 | + <td><img src="https://stats.pphat.top/icons/postgresql?color=green" alt="icon of postgresql"/></td> |
| 50 | + <td><img src="https://stats.pphat.top/icons/drizzle?color=green" alt="icon of drizzle"/></td> |
| 51 | + <td><img src="https://stats.pphat.top/icons/tailwindcss?color=green" alt="icon of tailwindcss"/></td> |
| 52 | + <td><img src="https://stats.pphat.top/icons/laravel?color=green" alt="icon of laravel"/></td> |
| 53 | + <td><img src="https://stats.pphat.top/icons/csharp?color=green&foreground=white" alt="icon of csharp"/></td> |
| 54 | + </tr> |
| 55 | + </tbody> |
| 56 | +</table> |
| 57 | + |
| 58 | +<br/> |
| 59 | + |
| 60 | +# ✨ **About Project** |
| 61 | + |
| 62 | +GitHub Stats is a high-performance API service that generates beautiful, customizable GitHub statistics cards, badges, and contribution graphs. |
| 63 | +Built for developers who want to showcase their GitHub activity in README files, portfolios, and documentation. |
| 64 | +The service features real-time data fetching from GitHub's REST and GraphQL APIs, multi-tier caching with Redis support, and 60+ built-in themes. |
| 65 | +With TypeScript, Express.js, and SQLite/Drizzle ORM for visitor tracking, it provides a robust and scalable solution for displaying GitHub statistics. |
| 66 | + |
| 67 | +# 🛠️ **Project Tech Stack** |
| 68 | + |
| 69 | +- **Core:** |
| 70 | + - Node.js `v18+` |
| 71 | + - TypeScript `v5` |
| 72 | + - Express.js |
| 73 | + |
| 74 | +- **Data & Caching:** |
| 75 | + - GitHub REST API |
| 76 | + - GitHub GraphQL API |
| 77 | + - Redis (optional) |
| 78 | + - SQLite |
| 79 | + - Drizzle ORM |
| 80 | + |
| 81 | +- **Rendering & Export:** |
| 82 | + - SVG Generation |
| 83 | + - WebP, PNG, GIF Export |
| 84 | + - Server-side Rendering |
| 85 | + |
| 86 | +- **Development & Deployment:** |
| 87 | + - PM2 Cluster Mode |
| 88 | + - Express Rate Limiting |
| 89 | + - CORS Support |
| 90 | + |
| 91 | +# 🌈 **Project Features** |
| 92 | + |
| 93 | +- **Stats Cards** |
| 94 | + - User statistics with customizable themes |
| 95 | + - Avatar modes (none, avatar, radar) |
| 96 | + - Custom titles and border styles |
| 97 | + - 60+ built-in themes |
| 98 | + |
| 99 | +- **Language Cards** |
| 100 | + - Top programming languages |
| 101 | + - Pie chart visualization |
| 102 | + - Detailed language statistics |
| 103 | + |
| 104 | +- **Contribution Graphs** |
| 105 | + - Activity heatmaps by year or last 365 days |
| 106 | + - Multiple animation modes (glow, wave, pulse) |
| 107 | + - Size presets (small, medium, large) |
| 108 | + - Multiple export formats (SVG, GIF, WebP, PNG) |
| 109 | + |
| 110 | +- **Badges System** |
| 111 | + - User badges (visitors, followers, repos, stars, etc.) |
| 112 | + - Project badges (stars, forks, issues, PRs, etc.) |
| 113 | + - Customizable themes and colors |
| 114 | + - Frame and icon toggle options |
| 115 | + |
| 116 | +- **Icons Library** |
| 117 | + - Reusable SVG icons |
| 118 | + - Color customization |
| 119 | + - Glow effects |
| 120 | + - Interactive demo gallery |
| 121 | + |
| 122 | +- **Performance** |
| 123 | + - Multi-tier caching (Memory → Redis → Source) |
| 124 | + - Intelligent batching |
| 125 | + - 2-hour default TTL |
| 126 | + - Cluster mode for multi-core scaling |
| 127 | + |
| 128 | +- **Monitoring** |
| 129 | + - Health check endpoints |
| 130 | + - Cache statistics |
| 131 | + - Performance metrics |
| 132 | + - Visitor tracking with IP hashing |
| 133 | + |
| 134 | +# 📊 **API Endpoints** |
| 135 | + |
| 136 | +### Core Routes |
| 137 | +- `GET /stats` - User statistics card |
| 138 | +- `GET /languages` - Programming languages card/pie |
| 139 | +- `GET /graph` - Contribution activity graph |
| 140 | + |
| 141 | +### Badge Routes |
| 142 | +- `GET /badge/:type` - User badges (visitors, repos, followers, stars, etc.) |
| 143 | +- `GET /project/:type` - Project badges (stars, forks, issues, PRs, etc.) |
| 144 | + |
| 145 | +### Utility Routes |
| 146 | +- `GET /icons` - List all available icons |
| 147 | +- `GET /icons/:name` - Get specific icon SVG |
| 148 | +- `GET /icons/demo` - Interactive icons gallery |
| 149 | + |
| 150 | +### Monitoring |
| 151 | +- `GET /health` - Health check |
| 152 | +- `GET /cache/health` - Cache health status |
| 153 | +- `GET /cache/stats` - Cache statistics |
| 154 | + |
| 155 | +# 🎨 **Themes** |
| 156 | + |
| 157 | +60+ built-in themes including: |
| 158 | +- **Dark:** default, dark, radical, tokyonight, dracula, monokai, gruvbox, onedark |
| 159 | +- **Light:** solarized-light, graywhite |
| 160 | +- **Graph Themes:** aurora, matrix, inferno, ocean, neon, solar, galaxy, github-dark |
| 161 | + |
| 162 | +# 💻 **Preview** |
| 163 | + |
| 164 | +Here are example outputs from the API: |
| 165 | + |
| 166 | + |
| 167 | + |
| 168 | + |
| 169 | + |
| 170 | + |
| 171 | + |
| 172 | +# 🚀 **Usage** |
| 173 | + |
| 174 | +### In Markdown |
| 175 | +```markdown |
| 176 | + |
| 177 | + |
| 178 | + |
| 179 | +``` |
| 180 | + |
| 181 | +### User Badges |
| 182 | +```markdown |
| 183 | + |
| 184 | + |
| 185 | + |
| 186 | +``` |
| 187 | + |
| 188 | +### Project Badges |
| 189 | +```markdown |
| 190 | + |
| 191 | + |
| 192 | + |
| 193 | +``` |
| 194 | + |
| 195 | +# 📝 **License** |
| 196 | + |
| 197 | +MIT License - See [LICENSE](https://github.com/pphatdev/github-stats/blob/latest/LICENSE) |
0 commit comments