npmserve-server v0.0.2
npmserve-server
This server provides npm as a service accessible via http endpoints.
This allows virtual machines and other slow clients to offload the work of building node_modules and thus perform significantly faster installs.
disclaimer
npmserve and npmserve-server are experimental projects. These tools should not be used for deploying production dependencies. The client/server model does not yet have authentication or authorization in place. This project also does not guarantee the integrity or security of dependencies installed from npm or distributed to clients. Please consider your own requirements and constraints before incorporating npmserve into your workflow.
clients
command-line client: available at npmserve.
web interface: the server provides a web interface to delete and trigger builds:

implementation
To solve these problems, we are providing a server on which clients can execute their
npm installs by uploading a package.json file. In response, they will receive a
node_modules.tar.gz archive containing their install results.
limitations
Currently, the server must be run on a machine with the same architecture as the clients. If this is not the case, calls to /npm/install may return node_modules archives containing extensions compiled for the wrong architecture.
build semantics
To the extent possible, the npmserve server provides operations analogous to
those that a user running npm locally might do. Users running locally often
resort to forceful actions such as deleting their entire node_modules
directory or clearing their cache. We provide the facility to perform those
actions via the API as well. These are documented below.
API
POST /npm/install
- behavior: performs an
npm installon the server - arguments:
packageJson: string ofpackage.jsonfile contents - content-type:
application/x-www-form-urlencoded; charset=utf-8 - response: compressed archive
node_modules.tar.gz, containingnode_modules
DELETE /npm/install/:hash
- behavior: deletes the
node_modulesbuild on the server for the specified build hash - arguments: none
- response: void
POST /npm/cache/clean
- behavior: clears the
.npmcache on the server - arguments: none
- response: void
environment
This project relies on the following environment variables:
| name | type | default | description |
|---|---|---|---|
BUILD_DATA_DIR | string | ./data | path to the directory in which to store build data |
NPM_CONFIG_REGISTRY | string | https://registry.npmjs.org | the npm registry to use for npm install |