npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hits

v2.0.2

Published

all the hits

Downloads

11

Readme

hits

What if there was a simple+easy way to see how many people have viewed your GitHub Repository?

Build Status HitCount Code Climate codecov.io Dependency Status devDependency Status

Why?

We have a few repos on GitHub ... but sadly, we have no idea how many people are looking at the repos unless they star/watch them; GitHub does not share any stats with people using their site.

We would like to know the popularity of each of our repos to know where we need to be investing our time.

What?

A simple way to add (very basic) analytics to your GitHub repos.

There are already many "Badges" available which people put in their repos: https://github.com/dwyl/repo-badges But we haven't seen one that gives a "hit counter" of the number of times a page has been viewed ...

How?

Place a badge (image) in your repo README.md so others can can see how popular the page is and you can track it.

Implementation

What is the minimum possible amount of data we can store?

  • date+time the person visited the site. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now
  • user-agent the browser or crawler visiting the page https://en.wikipedia.org/wiki/User_agent
  • referer url of the page where the image is requested from? https://en.wikipedia.org/wiki/HTTP_referer

Log entries are stored as a String which can be parsed and re-formatted into any other format:

1436570536950 x7uapo9 84.91.136.21

| Timestamp | User Agent | IP Address | | ------------- |:------------|:------------:| | 1436570536950 | x7uapo9 | 84.91.136.21 |

We then have a user-agent hash where we can lookup the by id:

{
  "x7uapo9":"Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10",
  "N03v1lz":"Googlebot/2.1 (+http://www.google.com/bot.html)"
}

Fetch SVG from shields.io and serve it just-in-time

Given that shields.io has a badge creation service, and it has acceptable latency, we are proxying the their service.

Research

User Agents

How many user agents (web browsers + crawlers) are there? there appear to be fewer than a couple of thousand user agents. http://www.useragentstring.com/pages/useragentstring.php which means we could store them using a numeric index; 1 - 3000

But, storing the user agents using a numeric index means we need to perform a lookup on each hit which requires network IO ... (expensive!) What if there was a way of deriving a String representation of the the user-agent string ... oh, that's right, here's one I made earlier... https://github.com/ideaq/aguid

Log Formats

  • Apache Log Sample: http://www.monitorware.com/en/logsamples/apache.php

Node.js http module headers

https://nodejs.org/api/http.html#http_message_rawheaders