Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Badges for package download count #250

Open
joeldenning opened this issue Mar 13, 2020 · 4 comments
Open

Badges for package download count #250

joeldenning opened this issue Mar 13, 2020 · 4 comments

Comments

@joeldenning
Copy link

joeldenning commented Mar 13, 2020

One thing I like about jsdelivr is that it hosts images to be used as badges within Readmes for projects that show the number of monthly downloads for a particular npm package. See example below:

Does this exist in unpkg? Is it something you'd be open to adding? I would be happy to help out with the implementation of it.

@mjackson
Copy link
Owner

We would first have to build out some infra to track download counts for certain packages, which we don't currently do. I've experimented before with automatically importing all our logs into Google BigQuery (we're hosted on GCP) but there was just too much data and my costs ran too high.

I think if I were to attempt doing something like this again I'd probably:

  • Setup Cloudflare to automatically push logs into a Google Cloud Storage Bucket
  • Setup a Google Cloud Function to run whenever something is added to the bucket
  • Increment a bunch of counters in a Redis instance

Once that's built, we can provide an API on top that queries Redis and gives you the count. The actual badge should be pretty easy to make once you have the number.

@mjackson
Copy link
Owner

Side note: we used to track all this when unpkg was hosted on Heroku, and I used a Redis instance for it then. It worked well enough, but I never ported the service over to GCP when I switched hosting providers.

@joeldenning
Copy link
Author

Ah I didn't know that download counts were not already available. That makes it a lot harder.

@maraisr
Copy link

maraisr commented Feb 3, 2021

@mjackson is this something I can help bring to fruition?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants