Integrations & scripts

ghapi

GitHub statistics API and SVG cards

An API that collects GitHub work statistics and serves them to dualfroz.com, vulcode.com and profile READMEs. It answers with raw JSON or a ready SVG card to embed.

ghapi

About the project

ghapi is our own GitHub statistics API, powering dualfroz.com, vulcode.com and profile READMEs with raw JSON and SVG cards. It shows commits, languages, frameworks, tests, streaks and open source contributions. It has two parts that never share secrets: a collector holding the GitHub token gathers the data and saves snapshots (ready summaries), and the API reads only those snapshots, so a page refresh costs no request to GitHub. A Discord app answers the same questions from any chat.

The challenge

The statistics should be current, but a page refresh cannot cost a request to GitHub, and the names of private repositories must never reach a public card. Ordinary date-based queries also miss commits pushed later or with a backdated date.

What we did

  1. 01

    A collector that runs hourly, the only part holding the GitHub token

  2. 02

    Changes found through branch heads, so backdated commits and commits pushed later count too

  3. 03

    Rewritten history detected and recounted, without commits that no longer exist

  4. 04

    Public endpoints without private repository names, full data only with a key

  5. 05

    SVG cards: stats, languages, streaks, activity, a heatmap, open source, frameworks and a Discord card

  6. 06

    An ETag (a version tag for caching) on every response and compatibility with the old paths

Related projects

Describe your project.

A free quote comes back within an hour during working hours.

Tell us what you want to build.

A free quote comes back within an hour during working hours. You talk to the person who writes the code.