node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

NPM version build status Test coverage David deps Known Vulnerabilities npm download


What is this?

Private npm registry and web for Enterprise, base on koa, MySQL and Simple Store Service.

Our goal is to provide a low cost maintenance and easy to use solution for private npm.

What can you do with

  • Build a private npm for your own enterprise. (alibaba is using now)
  • Build a mirror NPM. (we use it to build a mirror in China:
  • Build a completely independent NPM registry to store whatever you like.


  • Support "scoped" packages: npm/npm#5239
  • Support CORS
  • Simple to deploy: only need mysql and a simple store system. You can get the source code through npm or git.
  • Low cost and easy maintenance: package.json info store in MySQL, MariaDB, SQLite or PostgreSQL databases, tarball(tgz file) store in CDN or other store systems.
  • Automatic synchronization: automatic synchronization from any registry specified, support two sync modes:
    • Sync all modules from a specified registry, like npm registry.
    • Only sync the modules that exists in your own registry.
  • Manual synchronization: automatic synchronization may has little delay, but you can syn immediately by manually.
  • Customized client: we provide a client cnpm to extend npm with more features(sync command, gzip support). And it easy to wrap for your own registry which build with
  • Compatible with NPM client: you can use the origin NPM client with, only need to change the registry in config. Even include manual synchronization (through install command).
  • Version badge: base on cnpm-badge
  • Support http_proxy: if you're behind firewall, need to request through http proxy

PROTIP Be sure to read Migrating from 1.x to 2.x as well as New features in 2.x.

Getting Start

Develop on your local machine


  • node >= 4.3.1
  • Databases: only required one type
    • sqlite3 >= 3.0.2, we use sqlite3 by default
    • MySQL >= 0.5.0, include mysqld and mysql cli. I test on mysql@5.6.16.
    • MariaDB
    • PostgreSQL

Clone codes and run test

# clone from git 
$ git clone
# install dependencies 
$ make install
# test 
$ make test
# coverage 
$ make test-cov
# update dependencies 
$ make autod
# start server with development mode 
$ make dev

Dockerized Installation Guide shipped with a simple but pragmatic Docker Compose configuration.With the configuration, you can set up a MySQL backed instance by executing just one command on Docker installed environment.


Dockerized control command

Make sure your current working directory is the root of this GitHub repository.

Run dockerized
 $docker-compose up

This command will build a Docker image using the current code of repository. Then set up a dockerized MySQL instance with data initialized. After Docker container running, you can access your web portal at and npm register at

Run in the backend

$docker-compose up -d

Rebuild Docker image

$docker-compose build

Remove current dockerized instance

The current configuration set 2 named Docker Volume for your persistent data. If you haven't change the repository directory name, them will be "cnpmjsorg_cnpm-files-volume" & "cnpmjsorg_cnpm-db-volume".

Be Careful, the following commands will remove them.

$docker-compose rm 
$docker volume rm cnpmjsorg_cnpm-files-volume
$docker volume rm cnpmjsorg_cnpm-db-volume

You can get more information about your data volumes using the below commands:

$docker volume ls  // list all of your Docker volume
$docker volume inspect cnpmjsorg_cnpm-files-volume
$docker volume inspect cnpmjsorg_cnpm-db-volume

How to contribute

  • Clone the project
  • Checkout a new branch
  • Add new features or fix bugs in the new branch
  • Make a pull request and we will review it ASAP

Tips: make sure your code is following the node-style-guide.


  • 阿里云 (2016.2 - now)
  • UCloud云计算 (2015.3 - 2016.3)