Skip to content

stainlu/codewar

Repository files navigation

CAN YOU BEAT @bcherny?

CAN YOU BEAT @bcherny?

Compare your GitHub contributions against anyone.
Embed in your profile. Share on X. Zero auth.

codewar.dev

Try it Stars License


Embed in your GitHub profile

Add one line to your profile README:

[![Code War](https://codewar.dev/api/svg?users=YOUR_USERNAME,torvalds,bcherny,garrytan&range=3m&self=YOUR_USERNAME)](https://codewar.dev/?user=YOUR_USERNAME&targets=torvalds,bcherny,garrytan&range=3m)

Replace YOUR_USERNAME with yours. Or use codewar.dev to build your chart visually and copy the embed code.


Share on X

Every chart generates a Twitter Card automatically. Click "Share on X" on the site, or post any codewar.dev link — the chart appears as the preview image.


How it works

Parameter Description Values
users GitHub usernames (comma-separated, max 5) torvalds,bcherny,garrytan
range Time range 1m, 3m, 1y, all
self Your username (excluded from title, thicker line) stainlu

The chart title dynamically shows CAN YOU BEAT @{top performer} — the user with the highest average contributions in the selected range (excluding yourself).


Features

  • Google Trends for GitHub contributions — smooth lines comparing daily commits
  • Dynamic title — "CAN YOU BEAT @xxx" challenges you to outcode the best
  • Hand-drawn aesthetic — Virgil font from Excalidraw, wobbly grid lines
  • GitHub avatars — circular avatars with colored borders
  • Dark mode — auto-adapts via prefers-color-scheme
  • Twitter Cards — share any link, chart appears as preview image
  • Zero auth — no tokens, no login, just usernames

Tech

Your README / X post          codewar.dev               GitHub API
        │                          │                         │
        │  img src / og:image      │                         │
        │ ────────────────────────>│                         │
        │                          │  GraphQL: contributions │
        │                          │ ───────────────────────>│
        │                          │                         │
        │                          │  <── daily counts       │
        │                          │                         │
        │    <── SVG (cached 24h)  │                         │
  • Rendering: Server-side SVG with embedded Virgil font (WOFF2)
  • Hosting: Cloudflare Workers (edge-deployed globally)
  • OG Images: Cloudflare Browser Rendering (Puppeteer screenshots SVG → PNG)
  • Caching: Cloudflare KV (24h for data + rendered images)

Self-hosting

git clone https://github.com/stainlu/codewar.git
cd codewar && npm install
# Create a GitHub token (no scopes needed): https://github.com/settings/tokens
cp .dev.vars.example .dev.vars  # add your token
npx wrangler dev                # local dev
npx wrangler deploy             # deploy to Cloudflare Workers

License

MIT

Built by @stainlu. Inspired by star-history.com.