Adding a Developer portal

Similar to Reference docs, you can add a new Developer portal using Workflows.

info

The main difference between how you create Reference docs and a Developer portal is that Reference docs are created exclusively from APIs in the API registry. Developer portals are created from our Developer portal software linked to a Git repository.

How to add a new Developer portal

  1. Log in to Workflows, navigate to Portals.
  2. Select Create Developer Portal (if you do not have any existing Portals) or Add New (if you have other existing portals). The Choose source page displays.
  3. Select your source control from the list of options, and select Next. In this example, we use GitHub as the source. Choose source
  4. On the Source settings page:

    • From GitHub organizations dropdown, select the organization you want to use for this Developer portal.
    • From Repositories dropdown, select the source control repository you want to use in your Developer portal.
    • Under Source settings, select the branch you want to use for your production site. Depending on the branch selected, a success message displays indicating that a Developer portal has been detected.
    • If you select Build other branches as previews, it will trigger a build when a new branch is pushed or a new commit is pushed to an existing non-default branch. If a commit is pushed to your default branch, it will trigger a production build.
    • If you select Build PRs as previews, it will trigger a build when a new pull request (PR) is opened, or a new commit is pushed to any open PR. Source settings
  5. Select Next to continue.
  6. On the Portal name page, enter a name for your portal, and select Finish to add the portal. The portal is now created and the Overview page displays. Overview

Using private npm packages in Developer portals

You can use private npm packages in Developer portal builds.

Using npmjs.com

To use private packages from the npmjs.com registry, create a new access token.

In your portal project, go to Settings > Environment variables and add a new secret variable with the name NPM_TOKEN. Use the token value from the previous step.

Private packages will be available on the next portal build.

Using other registries

To support other registries (e.g. GitHub or GitLab) create a .npmrc file in the root of your portal repository:

Copy
Copied
# Auth for private GitHub Packages registry for modules with `@my-scope` scope
@my-scope:registry=https://npm.pkg.github.com/OWNER
//npm.pkg.github.com/:_authToken=GH_TOKEN

# Optional auth for private npm modules (if needed)
//registry.npmjs.org/:_authToken=${NPM_TOKEN}

Make sure to set up all the environment variables used in .npmrc file. To find out how to add environment variables, see Using environment variables.