joshfng / spacebadgers

Fast and clean SVG badges

Home Page:https://badgers.space

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

badgers.space Logo

Badgers - Fast SVG Badges

Yes, badgers is an ingenious name. It contains the word badge, is similar to badgen (a popular badge generation service), includes the -rs suffix 🦀 and it's an actual word! Badgers are awesome animals. And they're also the mascot of the University of Wisconsin-Madison. I don't know why I'm telling you this, I don't even live in the US. But hey, the more you know.

Live instance at badgers.space

Project Structure

  • badgers: Core badgers library
  • badgers-cli: CLI for generating SVG badges
  • badgers-worker: Cloudflare worker
  • badgers-web: Web frontend for badgers.space

Service Integrations

  • GitHub
  • crates.io

More integrations coming soon!

Development

Environment Variables

Paste this template into badgers-web/.env.local

# Frontend Configuration
NEXT_PUBLIC_API_PROTO = "http"          # Worker protocol
NEXT_PUBLIC_API_HOST = "127.0.0.1:8787" # Worker host
NEXT_PUBLIC_WEB_PROTO = "http"          # Web frontend protocol
NEXT_PUBLIC_WEB_HOST = "127.0.0.1:3000" # Web frontend host

# API Tokens
GITHUB_TOKEN = "ghp_Foo1234567"         # Required for GitHub badges
CRATESIO_TOKEN = "cio51fdR1234567"      # Required for crates.io badges

badgers

Requires: cargo

Running tests

cargo test -p badgers

badgers-worker

Requires: cargo, npm/yarn

Running locally

cd badgers-worker
npm run dev         # If you're using npm
yarn dev            # If you're using yarn

Deploying to Cloudflare

cd badgers-worker
npm run deploy      # If you're using npm
yarn deploy         # If you're using yarn

badgers-web

Requires: npm/yarn

Installing dependencies

cd badgers-web
npm install         # If you're using npm
yarn                # If you're using yarn

Running locally

cd badgers-web
npm run dev     # If you're using npm
yarn dev        # If you're using yarn

Why

Over the years, I've used quite a few badge generator services. First shields.io, which became slower and less reliable over time. Then badgen.net, which was fast and reliable at first, but became similarly disfunctional and doesn't seem to be maintained anymore.

Badgers is my attempt at creating a fast, reliable, and easy to use badge generator. It's written in Rust, and uses Cloudflare Workers to serve the badges. On my machine, badge generation takes ~1ms. Cloudflare reports a median CPU time of 2.4ms.

Even though there is an "official" live instance for everyone to use, I encourage you to host your own instance. It's super easy, and you can customize it to your needs.

For now, all that's supported is simple badges, without third-party data sources.

Feel free to contribute!

About

Fast and clean SVG badges

https://badgers.space

License:MIT License


Languages

Language:Rust 71.1%Language:TypeScript 28.1%Language:JavaScript 0.8%Language:CSS 0.1%