npm Packages
Stout implements the complete npm registry protocol — packument serving, scoped packages, tarball downloads, and search.
Configure Your Client
Add your Stout instance to .npmrc for a specific scope:
# .npmrc — scoped to @myorg
@myorg:registry=https://registry.stout.io/npm/
//registry.stout.io/npm/:_authToken=$STOUT_TOKEN
# Local development
@myorg:registry=http://localhost:7888/npm/
//localhost:7888/npm/:_authToken=$STOUT_TOKEN
All @myorg/* packages resolve through Stout while everything else
falls through to the public npm registry.
Install a Package
With .npmrc configured, install as usual:
npm install @myorg/my-package@1.2.0 Publish a Package
Stout builds from source. Submit a package for building via the API:
curl -X POST https://registry.stout.io/api/v1/builds \
-H "Authorization: Bearer $STOUT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"format": "npm",
"repo": "https://github.com/myorg/my-package",
"version": "1.2.0"
}' Authentication
Pass your API token in .npmrc using the _authToken directive
(shown above). Tokens are scoped — generate one with publish scope for publishing,
or read for install-only access.
Endpoints
| Method | Path | Description |
|---|---|---|
GET | /npm/{package} | Packument (all version metadata) |
GET | /npm/{package}/-/{tarball} | Download tarball |
GET | /npm/-/v1/search?text= | Search packages |