Overview

API stability data inside Backstage

What the card shows#

Metric Meaning
Block Rate Percentage of PRs blocked for breaking changes in the last 30 days
Avg Risk Score Average composite risk score (0–100) across all analyzed PRs
Total Analyses Number of PR analyses performed by CodeRifts for this repo
Top Pattern Most common breaking change pattern detected (e.g. ENDPOINT_REMOVAL)

Installation#

# npm
npm install @coderifts/backstage-plugin
# yarn
yarn add @coderifts/backstage-plugin

Add to your entity page#

// packages/app/src/components/catalog/EntityPage.tsx
import { CodeRiftsCard } from '@coderifts/backstage-plugin';
 
// Inside your entity page layout:
<CodeRiftsCard repo="your-org/your-repo" apiKey="cr_live_..." />

Dynamic repo detection#

Automatically detect the repo from the Backstage entity annotations:

import { useEntity } from '@backstage/plugin-catalog-react';
import { CodeRiftsCard } from '@coderifts/backstage-plugin';
 
const { entity } = useEntity();
const repo = entity.metadata.annotations?.['github.com/project-slug'] || '';
 
<CodeRiftsCard repo={repo} apiKey={apiKey} />

Configuration#

For production, store the API key in your Backstage app config:

# app-config.yaml
coderifts:
  apiKey: ${CODERIFTS_API_KEY}
import { configApiRef, useApi } from '@backstage/core-plugin-api';
const config = useApi(configApiRef);
const apiKey = config.getString('coderifts.apiKey');

Props reference#

Prop Type Required Description
repo string Yes Repository in owner/repo format
apiKey string Yes CodeRifts API key (cr_live_...)
baseUrl string No Override API base URL (default: https://app.coderifts.com)

Updated

Was this page helpful?