Skip to content

DAShaikh10/GitHub-Karma

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

121 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GitHub Karma

Reddit-inspired, dynamically generated GitHub Karma cards for your profile README!

Choose between two flavours - Creator Karma and Contributor Karma - to showcase both what you build and how you contribute across the GitHub community.

Tests Contributors Coverage Issues Pull Requests Visitors license

View Demo Β· Report Bug Β· Request Feature Β· Ask Question

Live Preview

Creator Karma Demo Contributor Karma Demo

Powered by Vercel

Table of contents (Click to show)

Important Notices

Important

This project uses caching headers to reduce rate-limit pressure. Data is not real-time by design. Currently, the Karma cards are cached for 2 hours before regeneration.

Note

By default, data visibility depends on the permissions of your GitHub token. If you want private-repo-aware metrics, deploy your own instance with a properly scoped token.

GitHub Creator Karma Card

The creator karma measures repository impact from stars and forks you have earned on your personal repositories, then maps the score to rank tiers.

Usage

Copy and paste this into your markdown, then replace username:

[![Creator Karma](http://github-karma.vercel.app/api/karma/creator?username=dashaikh10)](https://github.com/DAShaikh10/GitHub-Karma)

Options

Endpoint: /api/karma/creator?username=<GITHUB_USERNAME>&theme=<THEME_NAME>

Name Description Type Default value
username GitHub username to evaluate. Must be 1-39 chars, alphanumeric or -, and cannot start/end with -. string required
theme Card theme name. Supports all built-in themes configured in this project. enum default

The card returns image/svg+xml and can return error cards with HTTP status 400, 404, 429, or 500.

Themes

Use &theme=THEME_NAME:

![Creator Karma](http://github-karma.vercel.app/api/karma/creator?username=dashaikh10&theme=radical)

This project includes a large set of built-in themes (including transparent) adapted from @AnuragHazra's GitHub-Readme-Stats. Theme definitions live in src/lib/card/constants.ts.

Theme Preview

Use the live URL format below to test any theme quickly:

http://github-karma.vercel.app/api/karma/creator?username=dashaikh10&theme=<THEME_NAME>
Click to expand full theme preview table
algolia
algolia
ambient-gradient
ambient-gradient
apprentice
apprentice
aura
aura
aura-dark
aura-dark
ayu-mirage
ayu-mirage
bear
bear
blue-green
blue-green
blue-navy
blue-navy
blueberry
blueberry
buefy
buefy
calm
calm
calm-pink
calm-pink
catppuccin-latte
catppuccin-latte
catppuccin-mocha
catppuccin-mocha
chartreuse-dark
chartreuse-dark
city-lights
city-lights
cobalt
cobalt
cobalt2
cobalt2
codeSTACKr
codeSTACKr
darcula
darcula
dark
dark
date-night
date-night
default
default
discord-old-blurple
discord-old-blurple
dracula
dracula
flag-india
flag-india
github-dark
github-dark
github-dark-dimmed
github-dark-dimmed
gotham
gotham
graywhite
graywhite
great-gatsby
great-gatsby
gruvbox
gruvbox
gruvbox-light
gruvbox-light
highcontrast
highcontrast
holi
holi
jolly
jolly
kacho-ga
kacho-ga
maroongold
maroongold
material-palenight
material-palenight
merko
merko
midnight-purple
midnight-purple
moltack
moltack
monokai
monokai
neon
neon
nightowl
nightowl
noctis-minimus
noctis-minimus
nord
nord
ocean-dark
ocean-dark
omni
omni
one-dark-pro
one-dark-pro
onedark
onedark
outrun
outrun
panda
panda
prussian
prussian
radical
radical
react
react
rose
rose
rose-pine
rose-pine
shades-of-purple
shades-of-purple
shadow-blue
shadow-blue
shadow-green
shadow-green
shadow-red
shadow-red
slateorange
slateorange
solarized-dark
solarized-dark
solarized-light
solarized-light
swift
swift
synthwave
synthwave
tokyonight
tokyonight
transparent
transparent
vision-friendly-dark
vision-friendly-dark
vue
vue
vue-dark
vue-dark
yeblu
yeblu

Responsive Card Theme

Use GitHub theme context tags for dark/light switching:

[![Creator Karma Dark](http://github-karma.vercel.app/api/karma/creator?username=dashaikh10&theme=github-dark#gh-dark-mode-only)](https://github.com/DAShaikh10/GitHub-Karma#github-creator-karma-card)
[![Creator Karma Light](http://github-karma.vercel.app/api/karma/creator?username=dashaikh10&theme=default#gh-light-mode-only)](https://github.com/DAShaikh10/GitHub-Karma#github-creator-karma-card)

GitHub Contributor Karma Card

The contributor card measures contribution activity (commits, pull requests, reviews, completed issues in other repos, and accepted discussion answers).

Usage

[![Contributor Karma](http://github-karma.vercel.app/api/karma/contributor?username=dashaikh10)](https://github.com/DAShaikh10/GitHub-Karma)

Options

Endpoint: /api/karma/contributor?username=<GITHUB_USERNAME>&theme=<THEME_NAME>

Name Description Type Default value
username GitHub username to evaluate. Must be 1-39 chars, alphanumeric or -, and cannot start/end with -. string required
theme Card theme name. Supports all built-in themes configured in this project. enum default

Themes

![Contributor Karma](http://github-karma.vercel.app/api/karma/contributor?username=dashaikh10&theme=nightowl)

Profile README Example

Copy and paste this into your profile README and replace YOUR_USERNAME:

<a href="https://github.com/DAShaikh10/GitHub-Karma">
  <img align="center" src="http://github-karma.vercel.app/api/karma/creator?username=YOUR_USERNAME" />
</a>
<a href="https://github.com/DAShaikh10/GitHub-Karma">
  <img align="center" src="http://github-karma.vercel.app/api/karma/contributor?username=YOUR_USERNAME" />
</a>

Deploy on your own (recommended)

Running your own instance avoids shared endpoint limits and gives you control over token scope and cache settings.

Self-hosted (Vercel/Other)

First step: get your Personal Access Token (PAT)

For self-hosting, create a GitHub token and set it as GITHUB_PERSONAL_ACCESS_TOKEN.

Classic token (simple setup):

  1. Go to Settings -> Developer settings -> Personal access tokens -> Tokens (classic).
  2. Create a token.
  3. Select scopes:
    • read:user
    • repo (required if you want private repository data)

Fine-grained token (more restrictive):

  1. Go to Settings -> Developer settings -> Personal access tokens -> Fine-grained tokens.
  2. Create a token for all repositories you want to include.
  3. Grant read-only access to relevant repository/user data.

On Vercel

Deploy to Vercel

After import:

  1. Set GITHUB_PERSONAL_ACCESS_TOKEN in Vercel environment variables.
  2. Optionally tune cache and scoring variables.
  3. Redeploy after changing environment variables.

On other platforms

bun install
bun build
bun start

Set GITHUB_PERSONAL_ACCESS_TOKEN in your runtime environment before starting.

Available environment variables

Core runtime:

Name Default Description
GITHUB_PERSONAL_ACCESS_TOKEN none GitHub token used for GraphQL requests.
GITHUB_GRAPHQL_API_URL https://api.github.com/graphql GraphQL endpoint URL.
CACHE_REVALIDATE_SECONDS 3600 Next.js fetch revalidation for GitHub API responses.
KARMA_CARD_CACHE_SECONDS 7200 s-maxage value for card responses.
STALE_WHILE_REVALIDATION_SECONDS 300 stale-while-revalidate value for card responses.
GITHUB_RATELIMIT_HEADER x-ratelimit-limit Header name used for total limit logging.
GITHUB_RATELIMIT_REMAINING_HEADER x-ratelimit-remaining Header name used for remaining quota logging.
GITHUB_RATELIMIT_RESET_HEADER x-ratelimit-reset Header name used for reset time logging.

Creator scoring:

Name Default
BEGINNER_STAR_THRESHOLD 1
BEGINNER_STAR_MULTIPLIER 1
FORK_ENGAGEMENT_MULTIPLIER 1
STAR_PLATEAU_SCORE 3200
STAR_SATURATION_SCALE 3500
STAR_TAIL_SLOPE 0.02
FORK_PLATEAU_SCORE 900
FORK_SATURATION_SCALE 1200
FORK_TAIL_SLOPE 0.008
FORK_CURVE_WEIGHT 0.6
HIGH_IMPACT_REPO_THRESHOLD 1
HIGH_IMPACT_STARS 1
HIGH_IMPACT_FORKS 1
LEGEND_MULTIPLIER 1

Contributor scoring:

Name Default
COMMIT_WEIGHT 1
CONTRIBUTOR_PR_WEIGHT 1
CONTRIBUTOR_REVIEW_WEIGHT 1
CONTRIBUTOR_ISSUE_WEIGHT 1
CONTRIBUTOR_ANSWER_WEIGHT 1

Development

bun install
bun dev

Other useful commands:

bun lint
bun format
bun test
bun test:coverage
bun build
bun start

Support the project

If GitHub Karma helps you, consider:

  • Starring and sharing the repository.
  • Opening issues and pull requests to improve the project.

Inspired by GitHub Readme Stats: https://github.com/anuraghazra/github-readme-stats

License

MIT

About

Dynamically generated Reddit inspired - GitHub Karma for your GitHub profile README! 😎

Topics

Resources

License

Stars

Watchers

Forks

Contributors