open-index/open-npm huggingface dataset:
npm package: @kellyson/plugin-pact-broker
Description: Website: [https://docs.pact.io/](https://docs.pact.io/)
Latest version: 0.1.0

# Pact-Broker Plugin

Website: [https://docs.pact.io/](https://docs.pact.io/)

## Screenshots

<img alt="drawing" width="80%" src="./docs/pact-dashboard.png" />

## Setup

1. If you have a standalone app (you didn't clone this repo), then do

```bash
# From your Backstage root directory
yarn add --cwd packages/app @backstage/plugin-pact-broker
```

2. Add the `EntityPactBrokerContentTab` extension to the entity page in your app:

```tsx
// In packages/app/src/components/catalog/EntityPage.tsx
import {
  EntityPactBrokerContentTab,
  isPactBrokerAvailable,
} from '@backstage/plugin-pact-broker';

// For example in the website entity section
const websiteEntityPage = (
  <EntityLayout>
    
    ...

    <EntityLayout.Route if={isPactBrokerAvailable} path="/pact-broker-frontend" title="Pacts">
      <EntityPactBrokerContent />
    </EntityLayout.Route> 

  </EntityLayout>
```

4. Add proxy config:

- If you are using Pactflow service:

```yaml
# In app-config.yaml
proxy:
  '/pactbroker':
    target: https://{ACCOUNT_NAME}.pactflow.io # by example: https://xyz.pactflow.io
    headers:
      Authorization: Bearer {PACTFLOW_API_TOKEN}
```

  Note: Get and provide a `PACTFLOW_API_TOKEN` as an environment variable (see the [Pactflow docs](https://docs.pactflow.io/docs/user-interface/settings/api-tokens/)).

- If you are using self-hosting Pact Broker:

```yaml
# In app-config.yaml
'/pactbroker':
    target: {YOUR_PACT_BROKER_URL_HOST} # by example: http:// localhost:9080
    headers:
      Authorization: Basic {PACT_BROKER_TOKEN}
```

  Note: Get and provide a `PACT_BROKER_TOKEN` as an environment variable (see the [RFC 7617](https://datatracker.ietf.org/doc/html/rfc7617)).

   
5. Add an annotation to your respective `catalog-info.yaml` files, with the format `pactbroker/consumer-provider: <consumerName>:<providerName>` (See reference in [ADR002](https://backstage.io/docs/architecture-decisions/adrs-adr002#format)).

```yaml
# Example catalog-info.yaml entity definition file
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  # ...
  annotations:
    pactbroker/consumer-provider: 'ExampleApp-ExampleAPI'
spec:
  type: service
  # ...
```

## Features

- List all published pacts between consumer and provider
- Pagination for pacts