Search...
Toggle theme

Nexus Repository Manager

3 Easy Steps

Teams using Sonatype Nexus can manage access to NES packages through 3 easy steps:

  1. Create a Proxy Repository (NES Remote Repository) for our private NPM registry.
  2. Configure the Proxy Repository with a Routing Rule
  3. Configure a Group Repository to access both NES and OSS packages.

Step 1: Create a Proxy Repository

  1. Navigate to Server Administration and Config > Repositories

"Step 1a"

  1. Select Create Repository, then select NPM (proxy) as the recipe.

"Step 1b"

  1. Provide the following configuration values on the Create Repository page. For configuration values not defined below, use the default value that Nexus provides.
Namenpm-registry
Remote Storagehttps://registry.npmjs.org/
Blob Storeprovide the appropriate store for your environment
  1. Create the repository.

Step 2: Create a Routing Rule

  1. Navigate to Server Administration and Config > Routing Rules
  2. Select Create Routing Rule

"Step 2"

  1. Provide the following configuration values on the Create Routing Rule page. For configuration values not defined below, use the default value that Nexus provides.
Nameneverendingsupport
DescriptionRoute NES requests to HeroDevs registry
ModeAllow
Matchers^/@neverendingsupport/.*
  1. Create the Routing Rule

Step 3: Create a NES Proxy Repository & Group Repository for your team

First, create a NES Proxy Repository which will handle only the NES packages requested.

  1. Navigate to Server Administration and Config > Repositories

"Step 3a"

  1. Select Create Repository, then select NPM (proxy) as the recipe.

"Step 3b"

  1. Provide the following configuration values on the Create Repository page. For configuration values not defined below, use the default value that Nexus provides.
Namenes-registry
Remote Storagehttps://registry.nes.herodevs.com/npm/pkg
Blob Storeprovide the appropriate store for your environment
Routing Ruleneverendingsupport (from Step 2)
Authenticationchecked
Authentication TypePreemptive Bearer Token
Routing Rule<NES_ACCESS_TOKEN>
  1. Create the repository.

Next, create a Group Repository for your team so that they can access both NES and public packages from a single remote repository.

  1. Navigate to Server Administration and Config > Repositories

"Step 3c"

  1. Select Create Repository, but this time select NPM (group) as the recipe.

"Step 3d"

  1. Provide the following configuration values on the Create Repository page. For configuration values not defined below, use the default value that Nexus provides.
Namenpm-global
Blob Storeprovide the appropriate store for your environment
Membersnpm-registry, nes-registry
  1. Create the repository.

Configuring your NPM client

Review the Nexus .npmrc documentation or npm client authentication documentation to setup your project or npm client accordingly. Nexus supports two authentication methods for the npm client:

  1. Realm and Login
  2. Basic Auth

Here is an example of what a .npmrc file should look like using the Realm and Login method:

.npmrc
registry=https://<NEXUS_DNS>/repository/npm-global/ 
email=<USER_EMAIL>
always-auth=true 
_authToken=NpmToken.XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

Here is an example of what a .npmrc file should look like using the Basic Auth method:

.npmrc
registry=https://<NEXUS_DNS>/repository/npm-global/ 
email=<USER_EMAIL>
always-auth=true
_auth=<BASE64_ENCODED_CREDENTIALS>

Replace each of the following placeholder values:

  • NEXUS_DNS - The domain that the Nexus instance is reachable at.
  • USER_EMAIL - The email address of the user authenticating against the Nexus repository.
  • BASE64_ENCODED_CREDENTIALS - The base64 encoded username and password of the Nexus user. This is not provided by HeroDevs, and the string should be the base64 encoded value of “username:password”.