Combined Mod Downloads Badge

published 05/27/2024 • 1m reading time • 69 views

There are a few platforms you can publish Minecraft mods on, mainly Modrinth, Curse Forge, and Github. Many projects include download count badges in their readmes, but if you publish your mods on multiple platforms, you would need to include multiple badges, or just not include all platforms.

I wanted to have one combined downloads badge for my mods, so I wrote an api route for my website to get and sum the download counts from multiple platforms. The api is accessible at https://connorcode.com/api/downloads, and it currently supports Modrinth, Curse Forge, and GitHub. To add a platform, you add a query parameter mapping the platform name to the project id.

  • github=user/repo
  • modrinth=project_id
  • curseforge=project_id

The api just returns the download counts from each service and a total, both as a plain number and as a formatted number like 4.2k or 1.3M.

{
  "curseforge": 1394,
  "github": 28,
  "modrinth": 3474,

  "total": 4896,
  "total-human": "4.9k"
}

To get an actual badge, I use a dynamic JSON badge from shields.io. It allows you to supply an api endpoint and display a value from the response on the badge. Using the data above and a JSONPath of $['total-human'], we get the following badge, downloads: 4.9k. How nice.

Badge Generator

To make using this badge even easier, just input the project ids for each platform and copy the generated badge link.

Platform Project ID
Github
Modrinth
Curse Forge