Chapter 3. Custom plugins in Red Hat Developer Hub


You can integrate custom dynamic plugins into Red Hat Developer Hub to enhance its functionality without modifying its source code or rebuilding it. To add these plugins, export them as derived packages.

While exporting the plugin package, you must ensure that dependencies are correctly bundled or marked as shared, depending on their relationship to the Developer Hub environment.

To integrate a custom plugin into Developer Hub:

  1. First, obtain the plugin’s source code.
  2. Export the plugin as a dynamic plugin package. See Section 3.1, “Exporting custom plugins in Red Hat Developer Hub”.
  3. Package and publish the dynamic plugin. See Section 3.2, “Packaging and publishing custom plugins as dynamic plugins”.
  4. Install the plugin in the Developer Hub environment. See Section 3.3, “Installing custom plugins in Red Hat Developer Hub”.

To use plugins in Red Hat Developer Hub, you can export plugins as derived dynamic plugin packages. These packages contain the plugin code and dependencies, ready for dynamic plugin integration into Developer Hub.

Prerequisites

  • The @red-hat-developer-hub/cli package is installed. Use the latest version (@latest tag) for compatibility with the most recent features and fixes.

    Note

    Use the npx @red-hat-developer-hub/cli@latest plugin export command to export an existing custom plugin as a derived dynamic plugin package.

    You must use this command when you have the source code for a custom plugin and want to integrate it into RHDH as a dynamic plugin.

    The command processes the plugin’s source code and dependencies and generates the necessary output for dynamic loading by RHDH.

    For an example of using this command, see Example of installing a custom plugin in Red Hat Developer Hub.

  • Node.js and NPM is installed and configured.
  • The custom plugin is compatible with your Red Hat Developer Hub version. For more information, see Version compatibility matrix.
  • The custom plugin must have a valid package.json file in its root directory, containing all required metadata and dependencies.

    Backend plugins

    To ensure compatibility with the dynamic plugin support and enable their use as dynamic plugins, existing backend plugins must be compatible with the new Backstage backend system. Additionally, these plugins must be rebuilt using a dedicated CLI command.

    The new Backstage backend system entry point (created using createBackendPlugin() or createBackendModule()) must be exported as the default export from either the main package or an alpha package (if the plugin instance support is still provided using alpha APIs). This doesn’t add any additional requirement on top of the standard plugin development guidelines of the plugin instance.

    The dynamic export mechanism identifies private dependencies and sets the bundleDependencies field in the package.json file. This export mechanism ensures that the dynamic plugin package is published as a self-contained package, with its private dependencies bundled in a private node_modules folder.

    Certain plugin dependencies require specific handling in the derived packages, such as:

    • Shared dependencies are provided by the RHDH application and listed as peerDependencies in package.json file, not bundled in the dynamic plugin package. For example, by default, all @backstage scoped packages are shared.

      You can use the --shared-package flag to specify shared dependencies, that are expected to be provided by Red Hat Developer Hub application and not bundled in the dynamic plugin package.

      To treat a @backstage package as private, use the negation prefix (!). For example, when a plugin depends on the package in @backstage that is not provided by the Red Hat Developer Hub application.

    • Embedded dependencies are bundled into the dynamic plugin package with their dependencies hoisted to the top level. By default, packages with -node or -common suffixes are embedded.

      You can use the --embed-package flag to specify additional embedded packages. For example, packages from the same workspace that do not follow the default naming convention.

      The following is an example of exporting a dynamic plugin with shared and embedded packages:

      Example dynamic plugin export with shared and embedded packages

      $ npx @red-hat-developer-hub/cli@latest plugin export --shared-package '!/@backstage/plugin-notifications/' --embed-package @backstage/plugin-notifications-backend

      In the previous example:

    • @backstage/plugin-notifications package is treated as a private dependency and is bundled in the dynamic plugin package, despite being in the @backstage scope.
    • @backstage/plugin-notifications-backend package is marked as an embedded dependency and is bundled in the dynamic plugin package.
    Front-end plugins

    Front-end plugins can use scalprum for configuration, which the CLI can generate automatically during the export process. The generated default configuration is logged when running the following command:

    Example command to log the default configuration

    $ npx @red-hat-developer-hub/cli@latest plugin export

    The following is an example of default scalprum configuration:

    Default scalprum configuration

    "scalprum": {
      "name": "<package_name>",  // The Webpack container name matches the NPM package name, with "@" replaced by "." and "/" removed.
      "exposedModules": {
        "PluginRoot": "./src/index.ts"  // The default module name is "PluginRoot" and doesn't need explicit specification in the app-config.yaml file.
      }
    }

    You can add a scalprum section to the package.json file. For example:

    Example scalprum customization

    "scalprum": {
      "name": "custom-package-name",
      "exposedModules": {
        "FooModuleName": "./src/foo.ts",
        "BarModuleName": "./src/bar.ts"
        // Define multiple modules here, with each exposed as a separate entry point in the Webpack container.
      }
    }

    Dynamic plugins might need adjustments for Developer Hub needs, such as static JSX for mountpoints or dynamic routes. These changes are optional but might be incompatible with static plugins.

    To include static JSX, define an additional export and use it as the dynamic plugin’s importName. For example:

    Example static and dynamic plugin export

    // For a static plugin
    $ export const EntityTechdocsContent = () => {...}
    
    // For a dynamic plugin
    $ export const DynamicEntityTechdocsContent = {
      element: EntityTechdocsContent,
      staticJSXContent: (
        <TechDocsAddons>
          <ReportIssue />
        </TechDocsAddons>
      ),
    };

Procedure

  • Use the plugin export command from the @red-hat-developer-hub/cli package to export the plugin:

    Example command to export a custom plugin

    $ npx @red-hat-developer-hub/cli@latest plugin export

    Ensure that you execute the previous command in the root directory of the plugin’s JavaScript package (containing package.json file).

    The resulting derived package will be located in the dist-dynamic subfolder. The exported package name consists of the original plugin name with -dynamic appended.

    Warning

    The derived dynamic plugin JavaScript packages must not be published to the public NPM registry. For more appropriate packaging options, see Section 3.2, “Packaging and publishing custom plugins as dynamic plugins”. If you must publish to the NPM registry, use a private registry.

After exporting a custom plugin, you can package the derived package into one of the following supported formats:

  • Open Container Initiative (OCI) image (recommended)
  • TGZ file
  • JavaScript package

    Important

    Exported dynamic plugin packages must only be published to private NPM registries.

3.2.1. Creating an OCI image with dynamic packages

Prerequisites

Procedure

  1. Navigate to the plugin’s root directory (not the dist-dynamic directory).
  2. Run the following command to package the plugin into an OCI image:

    Example command to package an exported custom plugin

    $ npx @red-hat-developer-hub/cli@latest plugin package --tag quay.io/example/image:v0.0.1

    In the previous command, the --tag argument specifies the image name and tag.

  3. Run one of the following commands to push the image to a registry:

    Example command to push an image to a registry using podman

    $ podman push quay.io/example/image:v0.0.1

    Example command to push an image to a registry using docker

    $ docker push quay.io/example/image:v0.0.1

    The output of the package-dynamic-plugins command provides the plugin’s path for use in the dynamic-plugin-config.yaml file.

3.2.2. Creating a TGZ file with dynamic packages

Prerequisites

Procedure

  1. Navigate to the dist-dynamic directory.
  2. Run the following command to create a tgz archive:

    Example command to create a tgz archive

    $ npm pack

    You can obtain the integrity hash from the output of the npm pack command by using the --json flag as follows:

    Example command to obtain the integrity hash of a tgz archive

    $ npm pack --json | head -n 10

  3. Host the archive on a web server accessible to your RHDH instance, and reference its URL in the dynamic-plugin-config.yaml file as follows:

    Example dynamic-plugin-config.yaml file

    plugins:
      - package: https://example.com/backstage-plugin-myplugin-1.0.0.tgz
        integrity: sha512-<hash>

  4. Run the following command to package the plugins:

    Example command to package a dynamic plugin

    $ npm pack --pack-destination ~/test/dynamic-plugins-root/

    Tip

    To create a plugin registry using HTTP server on OpenShift Container Platform, run the following commands:

    Example commands to build and deploy an HTTP server in OpenShift Container Platform

    $ oc project my-rhdh-project
    $ oc new-build httpd --name=plugin-registry --binary
    $ oc start-build plugin-registry --from-dir=dynamic-plugins-root --wait
    $ oc new-app --image-stream=plugin-registry

  5. Configure your RHDH to use plugins from the HTTP server by editing the dynamic-plugin-config.yaml file:

    Example configuration to use packaged plugins in RHDH

    plugins:
      - package: http://plugin-registry:8080/backstage-plugin-myplugin-1.9.6.tgz

Warning

The derived dynamic plugin JavaScript packages must not be published to the public NPM registry. If you must publish to the NPM registry, use a private registry.

Prerequisites

Procedure

  1. Navigate to the dist-dynamic directory.
  2. Run the following command to publish the package to your private NPM registry:

    Example command to publish a plugin package to an NPM registry

    $ npm publish --registry <npm_registry_url>

    Tip

    You can add the following to your package.json file before running the export command:

    Example package.json file

    {
      "publishConfig": {
        "registry": "<npm_registry_url>"
      }
    }

    If you modify publishConfig after exporting the dynamic plugin, re-run the plugin export command to ensure the correct configuration is included.

You can install a custom plugins in Red Hat Developer Hub without rebuilding the RHDH application.

The location of the dynamic-plugin-config.yaml file depends on the deployment method. For more details, refer to Installing dynamic plugins with the Red Hat Developer Hub Operator and Installing dynamic plugins using the Helm chart.

Plugins are defined in the plugins array within the dynamic-plugin-config.yaml file. Each plugin is represented as an object with the following properties:

  • package: The plugin’s package definition, which can be an OCI image, a TGZ file, a JavaScript package, or a directory path.
  • disabled: A boolean value indicating whether the plugin is enabled or disabled.
  • integrity: The integrity hash of the package, required for TGZ file and JavaScript packages.
  • pluginConfig: The plugin’s configuration. For backend plugins, this is optional; for frontend plugins, it is required. The pluginConfig is a fragment of the app-config.yaml file, and any added properties are merged with the RHDH app-config.yaml file.
Note

You can also load dynamic plugins from another directory, though this is intended for development or testing purposes and is not recommended for production, except for plugins included in the RHDH container image. For more information, see Chapter 5, Enabling plugins added in the RHDH container image.

3.3.1. Loading a plugin packaged as an OCI image

Prerequisites

Procedure

  1. To retrieve plugins from an authenticated registry, complete the following steps:

    1. Log in to the container image registry.

      podman login <registry>
    2. Verify the content of the auth.json file created after the login.

      cat ${XDG_RUNTIME_DIR:-~/.config}/containers/auth.json
    3. Create a secret file using the following example:

      oc create secret generic _<secret_name>_ --from-file=auth.json=${XDG_RUNTIME_DIR:-~/.config}/containers/auth.json 
      1
      • For an Operator-based deployment, replace <secret_name> with dynamic-plugins-registry-auth.
      • For a Helm-based deployment, replace <secret_name> with <Helm_release_name>_-dynamic-plugins-registry-auth.
  2. Define the plugin with the oci:// prefix in the following format in dynamic-plugins.yaml file:

    oci://<image_name>:<tag>!<plugin_name>

    Example configuration in dynamic-plugins.yaml file

    plugins:
      - disabled: false
        package: oci://quay.io/example/image:v0.0.1!backstage-plugin-myplugin

  3. To perform an integrity check, use the image digest in place of the tag in the dynamic-plugins.yaml file as shown in the following example:

    Example configuration in dynamic-plugins.yaml file

    plugins:
      - disabled: false
        package: oci://quay.io/example/image@sha256:28036abec4dffc714394e4ee433f16a59493db8017795049c831be41c02eb5dc!backstage-plugin-myplugin

  4. To apply the changes, restart the RHDH application.

3.3.2. Loading a plugin packaged as a TGZ file

Prerequisites

Procedure

  1. Specify the archive URL and its integrity hash in the dynamic-plugins.yaml file using the following example:

    Example configuration in dynamic-plugins.yaml file

    plugins:
      - disabled: false
        package: https://example.com/backstage-plugin-myplugin-1.0.0.tgz
        integrity: sha512-9WlbgEdadJNeQxdn1973r5E4kNFvnT9GjLD627GWgrhCaxjCmxqdNW08cj+Bf47mwAtZMt1Ttyo+ZhDRDj9PoA==

  2. To apply the changes, restart the RHDH application.

Prerequisites

Procedure

  1. Run the following command to obtain the integrity hash from the NPM registry:

    $ npm view --registry <registry-link> <npm package>@<version> dist.integrity
  2. Specify the package name, version, and its integrity hash in the dynamic-plugins.yaml file as follows:

    Example configuration in dynamic-plugins.yaml file

    plugins:
      - disabled: false
        package: @example/backstage-plugin-myplugin@1.0.0
        integrity: sha512-9WlbgEdadJNeQxdn1973r5E4kNFvnT9GjLD627GWgrhCaxjCmxqdNW08cj+Bf47mwAtZMt1Ttyo+ZhDRDj9PoA==

  3. If you are using a custom NPM registry, create a .npmrc file with the registry URL and authentication details:

    Example code for .npmrc file

    registry=<registry-link>
    //<registry-link>:_authToken=<auth-token>

  4. When using OpenShift Container Platform or Kubernetes:

    • Use the Helm chart to add the .npmrc file by creating a secret. For example:

      Example secret configuration

      apiVersion: v1
      kind: Secret
      metadata:
        name: <release_name>-dynamic-plugins-npmrc 
      1
      
      type: Opaque
      stringData:
        .npmrc: |
          registry=<registry-link>
          //<registry-link>:_authToken=<auth-token>

      1 1
      Replace <release_name> with your Helm release name. This name is a unique identifier for each chart installation in the Kubernetes cluster.
    • For RHDH Helm chart, name the secret using the following format for automatic mounting:

      <release_name>-dynamic-plugins-npmrc

  5. To apply the changes, restart the RHDH application.

This example demonstrates how to package and install dynamic plugins using the Backstage Entity Feedback community plugin that is not included in Red Hat Developer Hub pre-installed dynamic plugins.

Limitations

  • You need to ensure that your custom plugin is built with a compatible version of Backstage. In Developer Hub, click Settings. Your custom plugin must be compatible with the Backstage Version (or the closest previous version) that is displayed in the Metadata section of Red Hat Developer Hub.

    For example, if you view the history of the backstage.json file for the Entity Feedback plugin, the 1fc87de commit is closest previous version to Backstage version of 1.39.1.

    Figure 3.1. backstage.json file history in Github

    custom limitations

Prerequisites

  • Your local environment meets the following requirements:
  • Node.js: Version 22.x
  • Yarn: Version 4.x
  • git CLI
  • jq CLI: Command-line JSON processor
  • OpenShift CLI (oc): The client for interacting with your OpenShift cluster.
  • Container runtime: Either podman or docker is required for packaging the plugin into an OCI image and logging into registries.
  • Container registry access: Access to an OCI-compliant container registry (such as the internal OpenShift registry or a public registry like Quay.io).

Procedure

  1. Clone the source code for the Entity Feedback plugin, as follows:

    $ git clone https://github.com/backstage/community-plugins.git
    $ cd community-plugins
  2. Prepare your environment to build the plugin by enabling Yarn for your Node.js installation, as follows:

    $ corepack enable yarn
  3. Install the dependencies, compile the code, and build the plugins, as follows:

    $ cd workspaces/entity-feedback
    $ yarn install
    $ yarn tsc
    $ yarn build:all
    Note

    After this step, with upstream Backstage, you publish the built plugins to a NPM or NPM-compatible registry. In this example, as you are building this plugin to support it being loaded dynamically by Red Hat Developer Hub, you can skip the npm publish step that publishes the plugin to a NPM registry. Instead, you can package the plugin for dynamic loading and publish it as a container image on Quay.io or your preferred container registry.

  4. Prepare the Entity Feedback frontend plugin by using the Red Hat Developer Hub CLI. The following command uses the plugin files in the dist folder that was generated by the yarn build:all command, and creates a new dist-scalprum folder that contains the necessary configuration and source files to enable dynamic loading:

    $ cd plugins/entity-feedback
    $ npx @red-hat-developer-hub/cli@latest plugin export

    When this command packages a frontend plugin, it uses a default Scalprum configuration if one is not found. The Scalprum configuration is used to specify the plugin entry point and exports, and then to build a dist-scalprum folder that contains the dynamic plugin. The default Scalprum configuration is shown below, however a scalprum key can be added to the package.json file used by your plugin to set custom values, if necessary:

    {
      "name": "backstage-community.plugin-entity-feedback",
      "exposedModules": {
        "PluginRoot": "./src/index.ts"
      }
    }

    The following plugin-manifest.json file, which Red Hat Developer Hub uses to load the plugin, is located in the dist-dynamic/dist-scalprum folder:

    {
      "name": "backstage-community.plugin-entity-feedback",
      "version": "0.6.0",
      "extensions": [],
      "registrationMethod": "callback",
      "baseURL": "auto",
      "loadScripts": [
        "backstage-community.plugin-entity-feedback.fd691533c03cb52c30ac.js"
      ],
      "buildHash": "fd691533c03cb52c30acbb5a80197c9d"
    }
  5. Package the plugin into a container image and publish it to Quay.io or your preferred container registry:

    $ export QUAY_USER=replace-with-your-username
    $ export PLUGIN_NAME=entity-feedback-plugin
    $ export VERSION=$(cat package.json | jq .version -r)
    
    $ npx @red-hat-developer-hub/cli@latest plugin package \
      --tag quay.io/$QUAY_USER/$PLUGIN_NAME:$VERSION
    
    $ podman login quay.io
    $ podman push quay.io/$QUAY_USER/$PLUGIN_NAME:$VERSION
  6. Repeat the same steps for the backend plugin. Scalprum is not required for backend plugins, and a dist-dynamic folder is generated instead of a dist-scalprum folder:

    $ cd ../entity-feedback-backend/
    $ npx @red-hat-developer-hub/cli@latest plugin export
    
    $ export QUAY_USER=replace-with-your-username
    $ export PLUGIN_NAME=entity-feedback-plugin-backend
    $ export VERSION=$(cat package.json | jq .version -r)
    
    $ npx @red-hat-developer-hub/cli@latest plugin package \
      --tag quay.io/$QUAY_USER/$PLUGIN_NAME:$VERSION
    
    $ podman push quay.io/$QUAY_USER/$PLUGIN_NAME:$VERSION

    Those commands result in two container images being published to your container registry.

    Figure 3.2. Container images published to Quay.io

    custom container images

Procedure

  1. To add your custom dynamic plugins to Red Hat Developer Hub. you must update the dynamic-plugins.yaml file by using the following configuration that is generated from the npx @red-hat-developer-hub/cli@latest plugin package command:

    plugins:
      - package: oci://quay.io/_<user_name>_/entity-feedback-plugin:0.5.0!backstage-community-plugin-entity-feedback
        disabled: false
    
      - package: oci://quay.io/_<user_name>_/entity-feedback-plugin-backend:0.6.0!backstage-community-plugin-entity-feedback-backend
        disabled: false
Note

Ensure that your container images are publicly accessible, or that you have configured a pull secret in your environment. A pull secret provides Red Hat Developer Hub with credentials to authenticate pulling your plugin container images from a container registry.

3.4.2. Displaying the frontend plugin

Procedure

  1. You need to update the pluginConfig section of your dynamic-plugins.yaml file to specify how the Entity Feedback should be added to the Red Hat Developer Hub UI.

    dynamic-plugins.yaml file fragment

    - package: oci://quay.io/_<user_name>_/entity-feedback-plugin:0.5.0!backstage-community-plugin-entity-feedback
      disabled: false
      pluginConfig:
        dynamicPlugins:
          frontend:
            backstage-community.plugin-entity-feedback:
              entityTabs:
                - mountPoint: entity.page.feedback
                  path: /feedback
                  title: Feedback
              mountPoints:
                - config:
                    layout:
                      gridColumn: 1 / -1
                  importName: StarredRatingButtons
                  mountPoint: entity.page.feedback/cards
                - config:
                    layout:
                      gridColumn: 1 / -1
                  importName: EntityFeedbackResponseContent
                  mountPoint: entity.page.feedback/cards
                - config:
                    layout:
                      gridColumnEnd:
                        lg: span 6
                        md: span 6
                        xs: span 6
                  importName: StarredRatingButtons
                  mountPoint: entity.page.overview/cards

    where:

    backstage-community.plugin-entity-feedback:entityTabs
    Enter the entityTabs array to define a new tab, named “Feedback” on the Entity Overview screen in Red Hat Developer Hub.
    frontend:mountPoints

    This array defines the following configurations to mount React components exposed by the plugin:

    • The StarredRatingButtons component is added to the new Feedback tab defined in entityTabs.
    • Similar to the StarredRatingButtons, the EntityFeedbackResponseContent is mounted on the Feedback tab.
    • The StarredRatingButtons is added to the default Overview tab for each entity.
  2. To complete installing the Entity Feedback plugins, you must redeploy your Red Hat Developer Hub instance.

Verification

When your new instance of Red Hat Developer Hub has started, you can check that your plugins are installed and enabled by visiting the Administration > Extensions screen and searching for “entity” on the Installed tab.

custom extensions

When you click Catalog, you should see the new Feedback tab, and the StarredRatingButtons displayed, as follows:

custom entity view

Selecting a low star rating prompts the user to provide feedback, as follows:

custom feedback overlay
Note

The user provided feedback is not saved if you are logged in as the Guest user.

Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat Documentation

Legal Notice

Theme

© 2026 Red Hat
Back to top