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-registry-couchapp

v3.0.0

Published

The CouchApp implementation of an npm registry

Downloads

1,267

Readme

npm-registry-couchapp

Build Status

deprecation notice: as npm has scaled, the registry architecture has gradually migrated towards a complex distributed architecture, of which npm-registry-couchapp is only a small part. FOSS is an important part of npm, and over time we plan on exposing more APIs, and better documenting the existing API.

npm-registry-couchapp is still a core part of our functionality, but all new registry features are now added to the micro-services that now make up npm. For this reason, we will not be accepting any pull requests, or making any changes to this codebase going forward.

For issues with the npmjs.com website, please open an issue on the npm/www repo. For issues wih the registry service (for example, slow package downloads, or inability to publish a package), see the npm/registry repo.

The design doc for The npm Registry CouchApp

Installing

You need CouchDB version 1.4.0 or higher. 1.5.0 or higher is best.

Once you have CouchDB installed, create a new database:

curl -X PUT http://localhost:5984/registry

You'll need the following entries added in your local.ini

[couch_httpd_auth]
public_fields = appdotnet, avatar, avatarMedium, avatarLarge, date, email, fields, freenode, fullname, github, homepage, name, roles, twitter, type, _id, _rev
users_db_public = true

[httpd]
secure_rewrites = false

[couchdb]
delayed_commits = false

Clone the repository if you haven't already, and cd into it:

git clone git://github.com/npm/npm-registry-couchapp
cd npm-registry-couchapp

Now install the stuff:

npm install

Sync the ddoc to _design/scratch

npm start \
  --npm-registry-couchapp:couch=http://admin:password@localhost:5984/registry

Next, make sure that views are loaded:

npm run load \
  --npm-registry-couchapp:couch=http://admin:password@localhost:5984/registry

And finally, copy the ddoc from _design/scratch to _design/app

npm run copy \
  --npm-registry-couchapp:couch=http://admin:password@localhost:5984/registry

Of course, you can avoid the command-line flag by setting it in your ~/.npmrc file:

_npm-registry-couchapp:couch=http://admin:password@localhost:5984/registry

The _ prevents any other packages from seeing the setting (with a password) in their environment when npm runs scripts for those other packages.

Replicating the Registry

To replicate the registry without attachments, you can point your CouchDB replicator at https://skimdb.npmjs.com/registry. Note that attachments for public packages will still be loaded from the public location, but anything you publish into your private registry will stay private.

To replicate the registry with attachments, consider using npm-fullfat-registry. The fullfatdb CouchDB instance is deprecated.

Using the registry with the npm client

With the setup so far, you can point the npm client at the registry by putting this in your ~/.npmrc file:

registry = http://localhost:5984/registry/_design/app/_rewrite

You can also set the npm registry config property like:

npm config set \
  registry=http://localhost:5984/registry/_design/app/_rewrite

Or you can simple override the registry config on each call:

npm \
  --registry=http://localhost:5984/registry/_design/app/_rewrite \
  install <package>

Optional: top-of-host urls

To be snazzier, add a vhost config:

[vhosts]
registry.mydomain.com:5984 = /registry/_design/app/_rewrite

Where registry.mydomain.com is the hostname where you're running the thing, and 5984 is the port that CouchDB is running on. If you're running on port 80, then omit the port altogether.

Then for example you can reference the repository like so:

npm config set registry http://registry.mydomain.com:5984