NPM is the package registry for JavaScript. It powers the way Node apps and web libraries are shared. Most teams already use it to publish, install, and track versions.
The NPM plugin brings that context into Backstage. It adds cards to your entity pages that show the current version, publish date, license, keywords, and links to repos and issue trackers. It also adds a releases view so you can see tags like latest or next at a glance, plus a tab with version history when you need more detail. You get a quick read on what a package is, where its code lives, and how it has moved over time.
It fits common workflows. You can spot outdated services and plan upgrades. You can surface prerelease tags without leaving the portal. You can bring private packages into view too. The plugin supports custom registries such as GitHub Packages or GitLab through a backend so tokens stay on the server. Teams that mirror or proxy registries can point the plugin at those sources and still get the same cards and release data.
Installation Instructions
These instructions apply to self-hosted Backstage only.
Install the frontend plugin in a classic Backstage app
-
Add the package to your app
yarn workspace app add @backstage-community/plugin-npm
-
Import the components in packages/app/src/components/catalog/EntityPage.tsx
// after other imports import { isNpmAvailable, EntityNpmInfoCard, EntityNpmReleaseOverviewCard, EntityNpmReleaseTableCard, } from '@backstage-community/plugin-npm';
-
Show the cards on the entity overview page
Add this to the overview content after EntityAboutCard
<EntitySwitch> <EntitySwitch.Case if={isNpmAvailable}> <Grid container item md={6} xs={12}> <Grid item md={12}> <EntityNpmInfoCard /> </Grid> <Grid item md={12}> <EntityNpmReleaseOverviewCard /> </Grid> </Grid> </EntitySwitch.Case> </EntitySwitch>
-
Add the releases tab to the entity page
Add this route in serviceEntityPage and websiteEntityPage after the ci cd case
Add it in defaultEntityPage between the slash route and the docs route<EntityLayout.Route if={isNpmAvailable} path="/npm-releases" title="NPM Releases" > <EntityNpmReleaseTableCard /> </EntityLayout.Route>
Use the new frontend system alpha
-
Add the package to your app next workspace
yarn workspace app-next add @backstage-community/plugin-npm
-
Register the feature in packages/app-next/src/App.tsx or packages/app/src/App.tsx if you run the new system there
import npmPlugin from '@backstage-community/plugin-npm/alpha'; export const app = createApp({ features: [ catalogPlugin, catalogImportPlugin, userSettingsPlugin, npmPlugin, // other features ], });
Install the backend plugin new backend system
Required for private packages or for custom registries
-
Add the backend package
yarn workspace backend add @backstage-community/plugin-npm-backend
-
Register it in packages/backend/src/index.ts
// inside your backend setup backend.add(import('@backstage-community/plugin-npm-backend'));
-
Optional force the frontend to use the backend for all entities
# app-config.yaml npm: defaultRegistry: npmjs
Old backend system support
This plugin exposes a new backend system feature. The old backend system is not supported.
For public packages you can run the frontend part only
Configure registries
Default public registry works without extra config for public packages
# app-config.yaml
npm:
registries:
- name: npmjs
url: https://registry.npmjs.com
Private npmjs with token
# app-config.yaml
npm:
registries:
- name: npmjs
url: https://registry.npmjs.com
token: YOUR_TOKEN
Custom registry
# app-config.yaml
npm:
registries:
- name: private-registry
url: https://your.registry.example.com
token: YOUR_TOKEN
GitHub registry
# app-config.yaml
npm:
registries:
- name: github
url: https://npm.pkg.github.com
token: ghp_your_token
To make the backend handle requests for an entity set a matching registry on the entity
# catalog-info.yaml
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: a-component
annotations:
npm/package: private-package
npm/registry: npmjs
Add entity annotations
Basic setup
# catalog-info.yaml
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: react
annotations:
npm/package: react
Pick a tag other than latest for the info card
# catalog-info.yaml
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: react
annotations:
npm/package: react
npm/stable-tag: next
Use a named custom registry from your config
# catalog-info.yaml
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: react
annotations:
npm/package: another-package
npm/registry: github
Optional sample entities
You can import ready made examples for testing
# catalog-info.yaml
catalog:
locations:
- type: url
target: https://github.com/backstage/community-plugins/blob/main/workspaces/npm/examples/entities.yaml
rules:
- allow: [System, Component]
Changelog
This changelog is produced from commits made to the NPM plugin since a year ago, and based on the code located here. It may not contain information about all commits. Releases and version bumps are intentionally omitted. This changelog is generated by AI.
Features
- Export translation files #5020 merged 1 month ago
- Add npm registry option
extraRequestHeaders
#4602 merged 3 months ago - Add translation support with a German locale #3528 merged 6 months ago
- Use Backstage links in the overview card instead of html links #3527 merged 6 months ago
- Add backend plugin to fetch data from private registries or npmjs with a token #1812 merged 8 months ago
- Add support for the new frontend system under the
alpha
export #2453 merged 9 months ago - Create a standalone demo app for the npm plugin #1516 merged 11 months ago
- Introduce the npm plugin workspace that shows info from npmjs #1485 merged 12 months ago
Bug fixes
- Show the missing annotation state when
npm/package
is not set. Avoid errors in the hook #4322 merged 3 months ago - Add the missing backend api ref to the alpha export. This restores support for private or alternative registries with the new frontend system #3523 merged 6 months ago
- Export deprecated card components to keep backward compatibility #1751 merged 11 months ago
Documentation
- Update docs to install the correct npm plugin backend packages #3825 merged 5 months ago
Dev experience
- Add a dev command. Use a standalone dev app runner to test npm frontend and backend together #4577 merged 3 months ago
- Create knip report verification for the npm workspace. Remove unused dependencies #4991 merged 1 month ago
- Reduce knip false positives with a workspace config #3018 merged 7 months ago
Maintenance
- Remove unused dev dependencies. Add a script to rebuild knip reports #2436 merged 9 months ago
Dependencies
- Update to Backstage 1.37.1 #3531 merged 6 months ago
- Update to Backstage 1.36.1 #3478 merged 6 months ago
- Update to Backstage 1.35.0 #2613 merged 8 months ago
Breaking changes
- None
Set up Backstage in minutes with Roadie
Focus on using Backstage, rather than building and maintaining it.