Skip to content

NotTheRealWallyx/codestats-badge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

codestats-badge

CodeFactor CI codecov

📊 A dynamic SVG badge generator for Code::Stats profiles, perfect for embedding your XP and top languages in your GitHub README.


🚀 Features

  • Displays total XP from your Code::Stats profile
  • Shows your top languages by XP (customizable with ?limit=)
  • Returns a custom SVG you can embed anywhere
  • Easy to deploy on Vercel, Render, or your own server

🔧 Usage

Endpoint:

/api/code-stats?user=<your_codestats_username>&limit=6

Example:

![Code::Stats](https://your-domain.com/api/code-stats?user=yourusername)

Code::Stats


🎨 Customization

You can control the appearance of your badge using query parameters:

  • Show/hide progress bar:
    Use showProgressBar=false to hide the progress bar.
    Example:

    /api/code-stats?user=yourusername&showProgressBar=false
    
  • Display language XP instead of level:
    Use showLangXP=true to show XP for each language instead of the level.
    Example:

    /api/code-stats?user=yourusername&showLangXP=true
    
  • Theme (light or dark):
    Use theme=light for a light background, or theme=dark for a dark background (default is dark).
    Example:

    /api/code-stats?user=yourusername&theme=light
    

💻 Local Development

This project supports both local Express server and Vercel serverless function usage.

1. Install dependencies

npm install

2. Run the local Express server

npm run start

Then open:

http://localhost:3000/api/code-stats?user=yourusername

3. (Optional) Use Vercel for local development

If you want to test the Vercel serverless function locally:

vercel dev

🚀 Deployment

This project works great on:

  • Vercel (recommended, uses api/code-stats.js serverless function)
  • Render (runs Express server)
  • Heroku (runs Express server)
  • Any Node.js-capable host

🧠 Next additions

  • Font choices
  • Customizable color palette via query parameters
  • Support for compact/minimal badge layout
  • Add last updated timestamp

📄 License

This project is licensed under the GNU GPL v3.


🙌 Credits

Inspired by anuraghazra/github-readme-stats

Made with ❤️ to level up your README.

Contributors 2

  •  
  •