DEV Community

Cover image for GoBadge Dynamic: From Module Stats to Universal Badges
CinfiniteDev
CinfiniteDev

Posted on

GoBadge Dynamic: From Module Stats to Universal Badges

What started as a tool for Go modules just became something much bigger.


The Big Idea

GoBadge started with three endpoints — stars, imports, imported-by. Useful if you write Go. Not so useful if you don't.

Today that changes.

The new dynamic endpoint lets you turn any JSON API into a badge. GitHub stars, npm downloads, Docker pulls, your own metrics API — if it speaks JSON, it gets a badge.

https://gobadge.vercel.app/api/dynamic?url=https://api.github.com/repos/gin-gonic/gin&value=stargazers_count&label=Stars
Enter fullscreen mode Exit fullscreen mode

That's it. One URL pattern, infinite data sources.


What Changed

GoBadge went from three hardcoded integrations to an open-ended system. You're no longer limited to the endpoints I built — you can badge-ify anything:

  • GitHub — stars, forks, issues, license, any field
  • npm / PyPI / Crates.io — downloads, versions, dependents
  • Docker Hub — pull counts
  • Your own API — internal metrics, dashboard data, anything

What You Can Do With It

Single value from any API

![Stars](https://gobadge.vercel.app/api/dynamic?url=https://api.github.com/repos/gin-gonic/gin&value=stargazers_count&label=Stars&color=yellow)
Enter fullscreen mode Exit fullscreen mode

Multiple values in one badge

![Gin](https://gobadge.vercel.app/api/dynamic?url=https://api.github.com/repos/gin-gonic/gin&value=stargazers_count&value=forks_count&label=Gin&sep=%20%E2%9C%A6%20)
Enter fullscreen mode Exit fullscreen mode

Nested JSON with dot notation

![License](https://gobadge.vercel.app/api/dynamic?url=https://api.github.com/repos/gin-gonic/gin&value=license.spdx_id&label=License&color=blue)
Enter fullscreen mode Exit fullscreen mode

Any color you want

?color=ff6600
Enter fullscreen mode Exit fullscreen mode

Parameters

Param What it does
url HTTPS JSON endpoint
value Key to extract (repeat for multiple values, use dots for nested keys)
label Text on the left side
color Name or hex (e.g. ff6600)
sep Separator between values

Try It

Drop this in your README (replace user/repo with any GitHub repo):

![Stars](https://gobadge.vercel.app/api/dynamic?url=https://api.github.com/repos/user/repo&value=stargazers_count&label=Stars&color=yellow)
Enter fullscreen mode Exit fullscreen mode

Or visit gobadge.vercel.app to play with the demo.

This is GoBadge v2. One badge service. Every data source.

Top comments (0)