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

npm-search-server

v2.0.3

Published

NPM registry API ElasticSearch with download counts

Downloads

7

Readme

npm-search-server

How does this compare to npm-www, and newww, which is live at preview.npmjs.com? New! Turns out the new site was deployed on 2014-12-09, the same day I pushed this repository's code up to GitHub! Still, the new site doesn't let you sort or anything, so it's not much more useful, but it does look nicer than the old site.

Also, npm2es might be useful? Has CouchDB -> Elasticsearch syncing features.

I'm not sure what compelling reason there is to use npm-registry-client -- it looks like it's just a wrapper around request with named functions for a few of the registry's endpoints.

The registry API desperately lacks documentation other than the npm source code, but the downloads-count API has better documentation.

Environment

The app expects an Elasticsearch server reachable at elasticsearch:9200. It also expects a GitHub API token in an environment variable called GITHUB_TOKEN.

packages from https://registry.npmjs.org/-/all have the following interface:

interface Package {
  name: string
  // name is the only required field; all the others may be omitted
  time?: {modified: Date}
  author?: {name: string, email: string, url: string}
         | {name: string, email: string}
         | {name: string}
  ...
}

Docker config

This repo is automatically built on Docker Hub.

docker run -d --name elasticsearch -p 127.0.0.1:9200:9200 -p 127.0.0.1:9300:9300 elasticsearch
docker run -d --name app -p 80:80 -e VERBOSE=1 --link elasticsearch:elasticsearch --restart always chbrown/npm-search-server

If you want to make sure you're running the latest npm-search-server image:

docker pull chbrown/npm-search-server
docker rm -f app
docker run -d --name app -p 80:80 --link elasticsearch:elasticsearch --restart always chbrown/npm-search-server

docker-machine initialization

Use docker-machine to start up a small droplet:

export DIGITALOCEAN_ACCESS_TOKEN=n0t4ctua11ymydigital0ceant0k3n
docker-machine create -d digitalocean --digitalocean-size=512mb npm-search-server
eval "$(docker-machine env npm-search-server)"

You will probably need to add swap space for ElasticSearch to function properly. ssh in with docker-machine ssh npm-search-server and run the following commands:

swapon -s    # check current config
#dd if=/dev/zero of=/swapfile bs=1G count=4 # slow! fallocate is better.
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile

License

Copyright 2014-2015 Christopher Brown. MIT Licensed.