Skip to content

pphatdev/github-stats

Portfolio Portfolio Portfolio Portfolio Portfolio Portfolio

Fast GitHub Stats Graph πŸš€

Create beautiful, real-time GitHub stats cards, badges, and contribution graphs that are easy to customize and perfect for your profile README or project docs.

Endpoints

GET /stats

Returns an SVG Statistic card or pie chart for a user.

Example:

GET https://stats.pphat.top/stats?username=pphatdev

Required query params:

  • username

Optional query params:

Param Description
theme Theme preset
hide_title Hide title (true/false)
hide_border Hide border (true/false)
hide_rank Hide rank (true/false)
show_icons Show icons (true/false)
avatar_mode Avatar mode: none / avatar / radar
show_avatar Legacy alias; true sets avatar_mode=avatar
custom_title Custom card title
data_border_style Border style: solid / frame
data_border_frame Border frame position: in / out
bgColor Background color
borderColor Border color
textColor Text color
titleColor Title color
format Output format: svg / webp

Example:

GitHub Stats

GET https://stats.pphat.top/stats?username=pphatdev&avatar_mode=radar

GET /languages

Returns an SVG languages card or pie chart for a user.

Required query params:

  • username

Optional query params:

Param Description
theme Theme preset
show_info Show extra language info
top Limit number of top languages
variant Card variant style
type Output style: card / pie
bgColor Background color
borderColor Border color
textColor Text color
titleColor Title color
format Output format

Example:

Languages

GET https://stats.pphat.top/languages?username=pphatdev

GET /graph

Returns an SVG activity graph for a user for a specific year or the last 365 days.

Required query params:

  • username

Optional query params:

Param Description
theme Theme preset (see Graph Themes)
year 4-digit year (default: last 365 days)
animate Animation mode: glow (default), wave, pulse, none
size Canvas preset: default, small, medium, large
show_title Show/hide username + year heading
show_total_contribution Show/hide contribution subtitle
show_background Show/hide background gradient, stars, and grid
as Output format: svg (default), gif, webp, png
bgColor Background color
borderColor Border color
textColor Text color
titleColor Title color

Example:

Graph

GET https://stats.pphat.top/graph?username=pphatdev&year=2024
GET https://stats.pphat.top/graph?username=pphatdev&theme=aurora
GET https://stats.pphat.top/graph?username=pphatdev&theme=matrix&animate=pulse
GET https://stats.pphat.top/graph?username=pphatdev&theme=ocean&animate=wave
GET https://stats.pphat.top/graph?username=pphatdev&theme=aurora&animate=wave&as=gif
GET https://stats.pphat.top/graph?username=pphatdev&theme=matrix&animate=pulse&as=webp
GET https://stats.pphat.top/graph?username=pphatdev&as=png

GET /badge/:type

Returns dynamic badge SVGs for various GitHub user metrics.

Available badge types:

Endpoint Description
/badge/visitors Visitor counter (increments per unique IP/day)
/badge/repositories Total public repositories
/badge/organization Organizations count
/badge/languages Number of programming languages used
/badge/followers Follower count
/badge/total-stars Total stars across all repositories
/badge/total-contributors Total contributors
/badge/total-commits Total commits
/badge/total-code-reviews Total code reviews
/badge/total-issues Total issues created
/badge/total-pull-requests Total pull requests
/badge/total-joined-years Years since joining GitHub

Required query params:

  • username

Optional query params:

Param Description
theme Badge theme: default, aurora, matrix, inferno, ocean, neon, solar, galaxy, github-dark
customLabel Override label text
labelColor Label text color (hex without #, e.g. ff5733)
labelBackground Label background color (hex without #)
iconColor Icon color (hex without #)
valueColor Value text color (hex without #)
valueBackground Value background color (hex without #)
hideFrame Hide corner bracket frame (true/false, default false)
hideIcon Hide badge icon (true/false, default false)

Examples:

Visitors Total Stars Repositories Followers Total Commits Total Code Reviews Total Issues Total Pull Requests Total Joined Years

GET https://stats.pphat.top/badge/visitors?username=pphatdev
GET https://stats.pphat.top/badge/total-stars?username=pphatdev&theme=ocean
GET https://stats.pphat.top/badge/repositories?username=pphatdev&hideFrame=true
GET https://stats.pphat.top/badge/followers?username=pphatdev&hideIcon=true&theme=neon
GET https://stats.pphat.top/badge/total-commits?username=pphatdev&hideFrame=true&hideIcon=true

GET /project/:type

Returns dynamic badge SVGs for repository/project-specific metrics.

Available project badge types:

Endpoint Description
/project/stars Repository star count
/project/forks Repository fork count
/project/watchers Repository watcher count
/project/issues Open issues count
/project/prs Open pull requests count
/project/contributors Contributors count
/project/size Repository size

Required query params:

  • repo β€” Repository in format owner/repo (e.g., pphatdev/github-stats)

Optional query params:

Param Description
theme Badge theme: default, aurora, matrix, inferno, ocean, neon, solar, galaxy, github-dark
customLabel Override label text
labelColor Label text color (hex without #, e.g. ff5733)
labelBackground Label background color (hex without #)
iconColor Icon color (hex without #)
valueColor Value text color (hex without #)
valueBackground Value background color (hex without #)
hideFrame Hide corner bracket frame (true/false, default false)
hideIcon Hide badge icon (true/false, default false)

Examples:

Repo Stars Repo Forks Repo Issues Repo PRs Repo Contributors Repo Size

GET https://stats.pphat.top/project/stars?repo=pphatdev/github-stats
GET https://stats.pphat.top/project/forks?repo=pphatdev/github-stats&theme=aurora
GET https://stats.pphat.top/project/issues?repo=pphatdev/github-stats&hideFrame=true
GET https://stats.pphat.top/project/contributors?repo=pphatdev/github-stats&hideIcon=true

Usage in README

Stats card:

![GitHub Stats](https://stats.pphat.top/stats?username=YOUR_USERNAME)

Languages card:

![Top Languages](https://stats.pphat.top/languages?username=YOUR_USERNAME)

Languages pie chart:

![Top Languages](https://stats.pphat.top/languages?username=YOUR_USERNAME&type=pie)

Activity graph:

![Activity Graph](https://stats.pphat.top/graph?username=YOUR_USERNAME)

Activity graph with theme and animation:

![Activity Graph](https://stats.pphat.top/graph?username=YOUR_USERNAME&theme=aurora&animate=pulse)

Visitor badge:

![Visitor Badge](https://stats.pphat.top/badge/visitors?username=YOUR_USERNAME)

Other badges (stars, followers, commits, etc.):

![Total Stars](https://stats.pphat.top/badge/total-stars?username=YOUR_USERNAME)
![Followers](https://stats.pphat.top/badge/followers?username=YOUR_USERNAME)
![Repositories](https://stats.pphat.top/badge/repositories?username=YOUR_USERNAME)
![Total Commits](https://stats.pphat.top/badge/total-commits?username=YOUR_USERNAME)

Badges with theme and custom label:

![Visitor Badge](https://stats.pphat.top/badge/visitors?username=YOUR_USERNAME&theme=aurora)
![Stars](https://stats.pphat.top/badge/total-stars?username=YOUR_USERNAME&theme=matrix&customLabel=Stars)

Minimal badges (no frame, no icon):

![Visitor Badge](https://stats.pphat.top/badge/visitors?username=YOUR_USERNAME&hideFrame=true&hideIcon=true)
![Total Stars](https://stats.pphat.top/badge/total-stars?username=YOUR_USERNAME&hideFrame=true&hideIcon=true&theme=ocean)

Badges without frame (clean border):

![Repositories](https://stats.pphat.top/badge/repositories?username=YOUR_USERNAME&hideFrame=true)
![Followers](https://stats.pphat.top/badge/followers?username=YOUR_USERNAME&hideFrame=true&theme=neon)

Badges without icon (text focus):

![Languages](https://stats.pphat.top/badge/languages?username=YOUR_USERNAME&hideIcon=true)
![Commits](https://stats.pphat.top/badge/total-commits?username=YOUR_USERNAME&hideIcon=true&theme=matrix)

Project/repository badges:

![Repo Stars](https://stats.pphat.top/project/stars?repo=OWNER/REPO)
![Repo Forks](https://stats.pphat.top/project/forks?repo=OWNER/REPO)
![Repo Issues](https://stats.pphat.top/project/issues?repo=OWNER/REPO)
![Repo PRs](https://stats.pphat.top/project/prs?repo=OWNER/REPO)
![Repo Contributors](https://stats.pphat.top/project/contributors?repo=OWNER/REPO)

Example Themes

Use the theme query param. A few previews:

default
🎨 default
dark
πŸŒ™ dark
radical
⚑ radical
tokyonight
πŸŒ† tokyonight
dracula
πŸ§› dracula
monokai
🌈 monokai
gruvbox
πŸ‚ gruvbox
onedark
πŸ–€ onedark

All Available Themes (50+)

Category Themes
Dark default, dark, radical, merko, gruvbox, tokyonight, onedark, cobalt, synthwave, highcontrast, dracula, prussian, monokai, vue, vue-dark, shades-of-purple, nightowl, buefy-dark, blue-green, algolia, great-gatsby, darcula, bear, solarized-dark, chartreuse-dark, nord, gotham, material-palenight, vision-friendly-dark, ayu-mirage, midnight-purple, calm, omni, react, jolly, maroongold, yeblu, blueberry, slateorange, kacho_ga, outrun, ocean_dark, city_lights, github_dark, discord_old_blurple, aura_dark, panda, noctis_minimus, cobalt2, swift, aura, apprentice, moltack, codeSTACKr, rose_pine
Light solarized-light, graywhite, flag-india

Full theme list is in src/utils/themes.

Graph Themes

These themes are tuned for the /graph heatmap card β€” vivid iconColor cells against near-black backgrounds.

aurora
🌌 aurora
matrix
πŸ’š matrix
inferno
πŸ”₯ inferno
ocean
🌊 ocean

All available themes: aurora Β· matrix Β· inferno Β· ocean Β· neon Β· solar Β· galaxy Β· github-dark

Animate Modes

Mode Description
glow Default β€” active cells pulse with a soft glow
wave Cells ripple in a wave pattern across columns
pulse ~16 random cells flash independently
none No animation β€” static render

Size Presets

Value Canvas Cell size
default 1200 Γ— 600 14 px
small 800 Γ— 400 9 px
medium 1000 Γ— 500 12 px
large 1400 Γ— 700 16 px

Development

Development setup was moved to: docs/how-to/DEVELOPMENT.md

Route-by-route demos with option examples: docs/how-to/routes/README.md

Architecture

  • API: GitHub REST + GraphQL APIs with intelligent batching
  • Caching: Multi-tier (Memory β†’ Redis β†’ Source) with 2-hour default TTL
  • Database: SQLite with Drizzle ORM for badge counters and visitor logs
  • Server: Express.js with optional cluster mode for multi-core scaling
  • Rendering: Server-side SVG generation with optional WebP/PNG/GIF export

Notes

  • Responses are cached for 2 hours (configurable via CACHE_DURATION)
  • Without a GitHub token, API rate limits are very low (~60 requests/hour)
  • Set GITHUB_TOKEN to get 5,000 requests/hour
  • Redis is optional but recommended for production (enables distributed caching)
  • Visitor badges use IP hashing for privacy-preserving unique visitor counting

License

MIT. See LICENSE.

Releases

No releases published

Packages

 
 
 

Contributors

Languages