### Get Examples from Query
Source: https://www.eventcatalog.dev/docs/sdk/functions/getExamplesFromQuery
Use this function to retrieve all examples from a given directory. You can optionally specify a version to fetch examples for a particular version.
```typescript
import utils from '@eventcatalog/utils';
const { getExamplesFromQuery } = utils('/path/to/eventcatalog');
const examples = await getExamplesFromQuery('GetOrder');
const examples = await getExamplesFromQuery('GetOrder', '0.0.1');
```
--------------------------------
### Get Examples from Command
Source: https://www.eventcatalog.dev/docs/sdk/functions/getExamplesFromCommand
Use this function to retrieve all examples associated with a given command. It can be called with just the command directory or with an optional version number.
```javascript
import utils from '@eventcatalog/utils';
const { getExamplesFromCommand } = utils('/path/to/eventcatalog');
const examples = await getExamplesFromCommand('UpdateInventory');
const examples = await getExamplesFromCommand('UpdateInventory', '0.0.1');
```
--------------------------------
### Get Examples
Source: https://www.eventcatalog.dev/docs/sdk
Retrieve examples associated with commands, events, or queries.
```APIDOC
## GET /api/examples/command
### Description
Get all examples from a command.
### Method
GET
### Endpoint
/api/examples/command
## GET /api/examples/event
### Description
Get all examples from an event.
### Method
GET
### Endpoint
/api/examples/event
## GET /api/examples/query
### Description
Get all examples from a query.
### Method
GET
### Endpoint
/api/examples/query
```
--------------------------------
### Add Metadata to Examples
Source: https://www.eventcatalog.dev/docs/development/guides/messages/common/examples
Configure display names, summaries, and usage snippets for examples by creating an `examples.config.yaml` file in the `examples/` folder. The `usage` field provides a command-line example.
```yaml
basic-order.json:
name: Basic Order
summary: A simple domestic order with a single item.
usage: |
curl -X POST http://localhost:3000/events/publish \
-H "Content-Type: application/json" \
-d @basic-order.json
international-order.json:
name: International Order
summary: An order with international shipping and customs information.
```
--------------------------------
### Get Examples from Event
Source: https://www.eventcatalog.dev/docs/sdk/functions/getExamplesFromEvent
Use this function to fetch all examples for a given event. You can optionally provide a version number to retrieve examples for a specific version of the event.
```javascript
import utils from '@eventcatalog/utils';
const { getExamplesFromEvent } = utils('/path/to/eventcatalog');
const examples = await getExamplesFromEvent('InventoryAdjusted');
const examples = await getExamplesFromEvent('InventoryAdjusted', '0.0.1');
```
--------------------------------
### Install EventCatalog Federation Plugin
Source: https://www.eventcatalog.dev/docs/plugins/eventcatalog-federation/installation
Run this command to install the EventCatalog Federation plugin. Ensure you have EventCatalog installed as a prerequisite.
```bash
npm i @eventcatalog/generator-federation
```
--------------------------------
### Example: Standalone MCP Server over HTTP
Source: https://www.eventcatalog.dev/docs/development/ask-your-architecture/mcp-server/getting-started
This example starts the MCP Server over HTTP on port 3000 with root path '/mcp'. Ensure you have the EventCatalog Scale license and MCP client installed.
```bash
npx -y @eventcatalog/mcp-server https://demo.eventcatalog.dev {EVENTCATALOG_LICENSE_KEY} http 3000 /mcp
```
--------------------------------
### Install and Run EventCatalog Slack Bot with npm
Source: https://www.eventcatalog.dev/docs/development/ask-your-architecture/slack-integration/deployment
Installs project dependencies using npm and starts the bot in development mode. This is an alternative to Docker for local development.
```bash
npm install
npm run dev
```
--------------------------------
### Install and Run EventCatalog Slack Bot with pnpm
Source: https://www.eventcatalog.dev/docs/development/ask-your-architecture/slack-integration/deployment
Installs project dependencies using pnpm and starts the bot in development mode. This is an alternative to Docker for local development.
```bash
pnpm install
pnpm dev
```
--------------------------------
### Example Resource Doc URL
Source: https://www.eventcatalog.dev/docs/development/bring-your-own-documentation/resource-docs/adding-resource-docs
This is an example of a specific resource documentation URL for '01-deployment.mdx' for 'OrdersService' version '1.0.0'.
```url
http://localhost:3000/docs/services/OrdersService/1.0.0/pages/deployment
```
--------------------------------
### Clone Repository and Navigate to Example
Source: https://www.eventcatalog.dev/docs/plugins/azure-schema-registry/examples
Clone the EventCatalog generators repository and navigate to a specific example directory to begin.
```bash
git clone https://github.com/event-catalog/generators.git
cd generators/examples/generator-azure-schema-registry/basic
```
--------------------------------
### Using Steps and Step Components in Markdown
Source: https://www.eventcatalog.dev/docs/development/components/components/steps
Demonstrates how to integrate the Steps and Step components within a markdown file to create a structured guide. This example shows how to define a title for the Steps component and individual titles for each Step.
```markdown
---
# service frontmatter
---
The Inventory Service is a critical component of the system responsible for managing product stock levels, tracking inventory movements, and ensuring product availability. It interacts with other services to maintain accurate inventory records and supports operations such as order fulfillment, restocking, and inventory audits.
Request API credentials from the Inventory Service team.
Run the following command in your project directory:
```bash
npm install inventory-service-sdk
```_
Use the following code to initialize the Inventory Service client:
```js
const InventoryService = require('inventory-service-sdk');
const client = new InventoryService.Client({
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
apiUrl: 'https://api.inventoryservice.com/v1'
});
```_
You can now use the client to make API calls. For example, to get all products:
```js
client.getProducts()
.then(products => console.log(products))
.catch(error => console.error(error));
```_
```
--------------------------------
### Channel Parameters Documentation Example
Source: https://www.eventcatalog.dev/docs/development/guides/channels/adding-channels
Example of frontmatter in a channel markdown file demonstrating how to document dynamic parameters for channel names or addresses. It shows how to specify enums, default values, examples, and descriptions for parameters.
```markdown
---
# channel markdown file.
# The dynamic address
address: inventory.{env}.events
# optionally document the params for your channel name
# here we know that the channel address "env" value can be "dev,stg,or prod"
parameters:
env:
# What values for the parameter? (optional)
enum:
- dev
- stg
- prod
# what is the default value (optional)
default: dev
# Any examples if you want to list them
examples:
- dev
- stg
- prod
# Describe the channel information (optional)
description: 'Environment to use'
---
```
--------------------------------
### Get Examples From Event
Source: https://www.eventcatalog.dev/docs/sdk/functions/getExamplesFromEvent
Retrieves all example objects associated with a specific event directory. This function can optionally filter by event version.
```APIDOC
## GET /websites/eventcatalog_dev/getExamplesFromEvent
### Description
Get all examples from an event.
### Method
GET
### Endpoint
/websites/eventcatalog_dev/getExamplesFromEvent
### Parameters
#### Query Parameters
- **directory** (string) - Required - The directory name of the event.
- **version** (string) - Optional - The specific version of the event to retrieve examples for.
### Response
#### Success Response (200)
- **examples** (object[]) - An array of example objects, each containing an id and an optional version.
### Response Example
```json
{
"examples": [
{
"id": "example1",
"version": "1.0.0"
},
{
"id": "example2"
}
]
}
```
### Example Usage
```javascript
import utils from '@eventcatalog/utils';
const { getExamplesFromEvent } = utils('/path/to/eventcatalog');
// Get all examples for 'InventoryAdjusted'
const examples = await getExamplesFromEvent('InventoryAdjusted');
// Get examples for a specific version of 'InventoryAdjusted'
const specificExamples = await getExamplesFromEvent('InventoryAdjusted', '0.0.1');
```
```
--------------------------------
### getExamplesFromCommand Function
Source: https://www.eventcatalog.dev/docs/sdk/functions/getExamplesFromCommand
Retrieves all examples associated with a given command. It can optionally filter examples by a specific version.
```APIDOC
## getExamplesFromCommand()
### Description
Get all examples from a command.
### Method
Not applicable (this is a function call, not an HTTP request).
### Endpoint
Not applicable.
### Parameters
#### Path Parameters
None.
#### Query Parameters
None.
#### Request Body
None.
### Request Example
```javascript
import utils from '@eventcatalog/utils';
const { getExamplesFromCommand } = utils('/path/to/eventcatalog');
// Get all examples for 'UpdateInventory'
const examples = await getExamplesFromCommand('UpdateInventory');
// Get examples for 'UpdateInventory' with version '0.0.1'
const examples = await getExamplesFromCommand('UpdateInventory', '0.0.1');
```
### Response
#### Success Response (200)
This function returns a Promise that resolves to an array of objects, where each object represents an example.
- **id** (string) - The identifier for the example.
- **version**? (string) - The version of the example (optional).
#### Response Example
```json
[
{
"id": "example1",
"version": "1.0.0"
},
{
"id": "example2",
"version": "1.0.0"
}
]
```
```
--------------------------------
### Add Example to Query
Source: https://www.eventcatalog.dev/docs/sdk/functions/addExampleToQuery
Use this function to add example files to a query. Provide the query ID, example content, and an optional filename. You can also specify a version for the example.
```typescript
import utils from '@eventcatalog/utils';
const { addExampleToQuery } = utils('/path/to/eventcatalog');
await addExampleToQuery('GetOrder', { content: '{"id": "123"}', fileName: 'basic.json' });
await addExampleToQuery('GetOrder', { content: '{"id": "123"}', fileName: 'basic.json' }, '0.0.1');
```
--------------------------------
### Install Inventory Service SDK
Source: https://www.eventcatalog.dev/docs/development/components/components/steps
Command to install the inventory-service-sdk package using npm. Ensure you have Node.js and npm installed.
```bash
npm install inventory-service-sdk
```
--------------------------------
### Install EventCatalog AsyncAPI Plugin
Source: https://www.eventcatalog.dev/docs/plugins/asyncapi/installation
Use this command to install the plugin on an existing EventCatalog project.
```bash
npm i @eventcatalog/generator-asyncapi
```
--------------------------------
### Data Product Inputs with Versions Example
Source: https://www.eventcatalog.dev/docs/api/data-product-api
Example showing how to specify versions for inputs within the 'inputs' array.
```yaml
---
inputs:
- id: PaymentProcessed
version: 2.1.0
- id: OrderConfirmed
version: latest # Default if not specified
---
```
--------------------------------
### Install OpenAPI Plugin
Source: https://www.eventcatalog.dev/docs/plugins/openapi/installation
Run this command to install the EventCatalog OpenAPI plugin on an existing catalog.
```bash
npm i @eventcatalog/generator-openapi
```
--------------------------------
### Install EventCatalog GitHub Plugin
Source: https://www.eventcatalog.dev/docs/plugins/github/installation
Run this command to install the GitHub plugin on an existing EventCatalog project. Ensure you have Node.js and npm installed.
```bash
npm i @eventcatalog/generator-github
```
--------------------------------
### Install EventCatalog Backstage Plugin
Source: https://www.eventcatalog.dev/docs/plugins/backstage/installation
Install the EventCatalog plugin for Backstage using yarn.
```bash
yarn add @eventcatalog/backstage-plugin-eventcatalog
```
--------------------------------
### Add Example to Command
Source: https://www.eventcatalog.dev/docs/sdk/functions/addExampleToCommand
Use this function to add an example file to a specific command. You can optionally provide a version for the example.
```typescript
import utils from '@eventcatalog/utils';
const { addExampleToCommand } = utils('/path/to/eventcatalog');
await addExampleToCommand('UpdateInventory', { content: '{"id": "123"}', fileName: 'basic.json' });
await addExampleToCommand('UpdateInventory', { content: '{"id": "123"}', fileName: 'basic.json' }, '0.0.1');
```
--------------------------------
### Data Product Inputs Example
Source: https://www.eventcatalog.dev/docs/api/data-product-api
Example defining the 'inputs' array, listing dependencies like events or data stores.
```yaml
---
inputs:
- id: PaymentProcessed
- id: OrderConfirmed
- id: PaymentService
- id: payments-db
---
```
--------------------------------
### Data Product Outputs Example
Source: https://www.eventcatalog.dev/docs/api/data-product-api
Example defining the 'outputs' array, listing data products or services produced.
```yaml
---
outputs:
- id: OrderMetricsCalculated
- id: NotificationService
- id: orders-analytics-db
---
```
--------------------------------
### Data Product Outputs with Contracts Example
Source: https://www.eventcatalog.dev/docs/api/data-product-api
Example demonstrating how to include contract definitions for outputs, specifying schema details.
```yaml
---
outputs:
- id: payment-analytics-db
contract:
path: payment-metrics-contract.json
name: Payment Metrics Contract
type: json-schema
- id: daily-sales-db
contract:
path: daily-sales-odcs.yaml
name: Daily Sales ODCS
type: odcs
---
```
--------------------------------
### Full Command Frontmatter Example
Source: https://www.eventcatalog.dev/docs/api/command-api
An example of the complete frontmatter for a command, including all common fields.
```yaml
---
id: UpdateInventory
name: Update inventory
version: 0.0.3
summary: |
Command with the intent to update the inventory
owners:
- dboyne
repository:
language: JavaScript
url: https://github.com/event-catalog/pretend-shipping-service
badges:
- content: New service
backgroundColor: blue
textColor: blue
icon: BoltIcon
---
```
--------------------------------
### Add Example to Command
Source: https://www.eventcatalog.dev/docs/sdk/functions/addExampleToCommand
Adds an example file to a specified command within the Event Catalog.
```APIDOC
## POST /websites/eventcatalog_dev/commands/examples
### Description
Adds an example file to a command.
### Method
POST
### Endpoint
/websites/eventcatalog_dev/commands/examples
### Parameters
#### Path Parameters
- **directory** (string) - Required - The name of the command to add the example to.
#### Request Body
- **id** (string) - Required - The unique identifier for the example.
- **example** (object) - Required - An object containing the example content and filename.
- **example.content** (string) - Required - The content of the example file.
- **example.fileName** (string) - Optional - The name of the example file.
- **version** (string) - Optional - The version of the command the example applies to.
### Request Example
```json
{
"id": "UpdateInventory",
"example": {
"content": "{\"id\": \"123\"}",
"fileName": "basic.json"
},
"version": "0.0.1"
}
```
### Response
#### Success Response (200)
- **void** - Indicates the example was successfully added.
#### Response Example
(No specific response body is defined for success, typically an empty response or a success status code.)
```
--------------------------------
### Add Example to Query
Source: https://www.eventcatalog.dev/docs/sdk/functions/addExampleToQuery
Adds an example file to a specified query within the Event Catalog.
```APIDOC
## POST /api/queries/{directory}/examples
### Description
Adds an example file to a query.
### Method
POST
### Endpoint
/api/queries/{directory}/examples
### Parameters
#### Path Parameters
- **directory** (string) - Required - The directory name of the query to which the example will be added.
#### Request Body
- **id** (string) - Required - The ID of the query.
- **example** (object) - Required - The example content and filename.
- **content** (string) - Required - The content of the example.
- **fileName** (string) - Optional - The name of the example file.
- **version** (string) - Optional - The version of the query to which the example applies.
### Request Example
```json
{
"id": "GetOrder",
"example": {
"content": "{\"id\": \"123\"}",
"fileName": "basic.json"
},
"version": "0.0.1"
}
```
### Response
#### Success Response (200)
- **status** (string) - Indicates the success of the operation.
#### Response Example
```json
{
"status": "success"
}
```
```
--------------------------------
### Example Query Frontmatter
Source: https://www.eventcatalog.dev/docs/api/query-api
This is a comprehensive example of query frontmatter, including all common fields.
```yaml
---
id: GetOrder
name: Out of stock
version: 0.0.3
summary: |
Query that is raised when an inventory item goes out of stock.
owners:
- dboyne
repository:
language: JavaScript
url: https://github.com/event-catalog/pretend-shipping-service
badges:
- content: New query
backgroundColor: blue
textColor: blue
---
## Overview
Query is published when the inventory is out of stock.
```
--------------------------------
### Install EventCatalog GraphQL Plugin
Source: https://www.eventcatalog.dev/docs/plugins/graphql/installation
Use this command to install the GraphQL plugin on an existing EventCatalog project.
```bash
npm i @eventcatalog/generator-graphql
```
--------------------------------
### Add Example to Event
Source: https://www.eventcatalog.dev/docs/sdk/functions/addExampleToEvent
Use this function to add example files to an event. Ensure you have imported the necessary utils and provided the event name, example content, and filename. An optional version can also be specified.
```typescript
import utils from '@eventcatalog/utils';
const { addExampleToEvent } = utils('/path/to/eventcatalog');
await addExampleToEvent('InventoryAdjusted', { content: '{"id": "123"}', fileName: 'basic.json' });
await addExampleToEvent('InventoryAdjusted', { content: '{"id": "123"}', fileName: 'basic.json' }, '0.0.1');
```
--------------------------------
### Install EventBridge Plugin
Source: https://www.eventcatalog.dev/docs/plugins/eventbridge/installation
Run this command to install the EventBridge plugin on an existing EventCatalog project.
```bash
npm i @eventcatalog/generator-eventbridge
```
--------------------------------
### Example Service Frontmatter
Source: https://www.eventcatalog.dev/docs/api/service-api
Full example of service frontmatter in an MDX file, including all common fields.
```yaml
---
id: Orders
name: Orders
version: 0.0.1
summary: |
Service that contains order related information
owners:
- dboyne
receives:
- id: InventoryAdjusted
version: 0.0.3
sends:
- id: AddInventory
version: 0.0.3
flows:
- id: OrderProcessing
version: 1.0.0
repository:
language: JavaScript
url: https://github.com/event-catalog/pretend-shipping-service
badges:
- content: New service
backgroundColor: blue
textColor: blue
icon: BoltIcon
---
## Overview
This orders service gives API consumers the ability to produce orders in the systems. Events are raised from this system for downstream consumption.
```
--------------------------------
### Install EventCatalog Skills
Source: https://www.eventcatalog.dev/docs/development/guides/flows/create-flow-with-ai
Install all EventCatalog skills or specifically the flow-wizard skill using the `npx skills add` command.
```bash
# Install all EventCatalog skills
npx skills add event-catalog/skills
# Install only the flow-wizard skill
npx skills add event-catalog/skills --skill flow-wizard
```
--------------------------------
### Start EventCatalog Development Server
Source: https://www.eventcatalog.dev/docs/development/getting-started/installation
Navigate to your project directory and run this command to start the local development server. Access your catalog at http://localhost:3000.
```bash
cd my-catalog
npm run dev
```
--------------------------------
### Install EventCatalog Apicurio Registry Plugin
Source: https://www.eventcatalog.dev/docs/plugins/apicurio/installation
Run this command to install the necessary npm package for the Apicurio Registry plugin.
```bash
npm i @eventcatalog/generator-apicurio
```
--------------------------------
### getExamplesFromQuery Function
Source: https://www.eventcatalog.dev/docs/sdk/functions/getExamplesFromQuery
Retrieves all examples from a specified query directory. This function can optionally filter by version.
```APIDOC
## Function: getExamplesFromQuery()
> **getExamplesFromQuery**(`directory`: `string`, `version`?: `string`) => `Promise`<`object`[]>
Defined in: queries.ts:352
Get all examples from a query.
### Parameters
- **directory** (`string`) - Required - The directory to query for examples.
- **version** (`string`) - Optional - The specific version of the examples to retrieve.
### Returns
- A `Promise` that resolves to an array of example objects.
### Example
```javascript
import utils from '@eventcatalog/utils';
const { getExamplesFromQuery } = utils('/path/to/eventcatalog');
// Get all examples from 'GetOrder' directory
const examples = await getExamplesFromQuery('GetOrder');
// Get examples from 'GetOrder' directory for version '0.0.1'
const examples = await getExamplesFromQuery('GetOrder', '0.0.1');
```
```
--------------------------------
### Map events using prefix filter
Source: https://www.eventcatalog.dev/docs/plugins/eventbridge/features
Use the 'prefix' filter to map events starting with specified strings to a service. This example maps events starting with 'myapp.orders.test@Orders' to sends and 'myapp.orders.test@Inventory' to receives for the 'Orders Service'.
```yaml
generators:
- [
'@eventcatalog/generator-eventbridge',
{
region: 'us-east-1',
registryName: 'discovered-schemas',
services: [
{ id: 'Orders Service', version: '1.0.0', sends: [{ prefix: ['myapp.orders.test@Orders']}], receives:[{ prefix: "myapp.orders.test@Inventory"}] },
],
domain: { id: 'orders', name: 'Orders', version: '0.0.1' },
},
],
]
```
--------------------------------
### Organize Examples with Subfolders
Source: https://www.eventcatalog.dev/docs/development/guides/messages/common/examples
Use nested folders within the 'examples/' directory to group related example files. EventCatalog displays them in a flat list.
```treeview
examples/
domestic/
basic-order.json
international/
eu-order.json
apac-order.json
```
--------------------------------
### Configure EventBridge Generator
Source: https://www.eventcatalog.dev/docs/plugins/eventbridge/api
Example of an eventcatalog.config.js file demonstrating the setup for the EventBridge generator, including service mappings and domain configuration.
```javascript
---
import path from 'path';
import url from 'url';
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
/** @type {import('@eventcatalog/core/bin/eventcatalog.config').Config} */
export default {
title: 'OurLogix',
tagline: 'A comprehensive logistics and shipping management company',
organizationName: 'OurLogix',
homepageLink: 'https://eventcatalog.dev/',
landingPage: '',
editUrl: 'https://github.com/boyney123/eventcatalog-demo/edit/master',
trailingSlash: false,
base: '/',
logo: {
alt: 'EventCatalog Logo',
src: '/logo.png',
text: 'OurLogix',
},
docs: {
sidebar: {
showPageHeadings: true,
},
},
generators: [
[
'@eventcatalog/generator-eventbridge',
{
region: 'us-east-1',
registryName: 'discovered-schemas',
services: [
// Maps exact events to the service
{ id: 'Orders Service', version: '1.0.0', sends: [{ detailType: ['OrderPlaced', 'OrderUpdated'], eventBusName: 'orders'}], receives:[{ detailType: "InventoryAdjusted"}, eventBusName: 'inventory'] },
// Filter by source (all events that match the source get assigned). This example shows any event matching the source
// "myapp.orders" will be assigned to the inventory service. The inventory service will publish these events.
{ id: 'Inventory Service', version: '1.0.0', sends: [{ source: "myapp.orders"}], receives:[{ detailType: "UserCheckedOut"}] },
// This service sends events that match the SchemaName prefixing myapp, and will receive events that end with Payment
{ id: 'Payment Service', version: '1.0.0', sends: [{ prefix: "myapp"}], receives:[{ suffix: "Payment" }] }
],
// all services are mapped to this domain
domain: { id: 'orders', name: 'Orders', version: '0.0.1' },
},
],
// Just import all events into the Catalog from a registry
[
'@eventcatalog/generator-eventbridge',
{
region: 'us-east-1',
registryName: 'discovered-schemas'
},
],
// Example using optional credentials
[
'@eventcatalog/generator-eventbridge',
{
region: 'us-east-1',
registryName: 'discovered-schemas',
credentials: {
accessKeyId: 'X',
secretAccessKey: 'X',
accountId: 'X',
},
},
],
],
};
```
--------------------------------
### Configure EventCatalog Hookdeck Generator
Source: https://www.eventcatalog.dev/docs/plugins/hookdeck/api
Example of a complete eventcatalog.config.js file demonstrating the setup for the Hookdeck generator, including API key, domain, connection matching, and logging.
```javascript
export default {
title: 'OurLogix',
tagline: 'A comprehensive logistics and shipping management company',
organizationName: 'OurLogix',
homepageLink: 'https://eventcatalog.dev/',
landingPage: '',
editUrl: 'https://github.com/boyney123/eventcatalog-demo/edit/master',
trailingSlash: false,
base: '/',
logo: {
alt: 'EventCatalog Logo',
src: '/logo.png',
text: 'OurLogix',
},
docs: {
sidebar: {
showPageHeadings: true,
},
},
generators: [
[
"@hookdeck/eventcatalog-generator",
{
hookdeckApiKey: process.env.HOOKDECK_API_KEY,
domain: "Payments",
connectionSourcedMatch: "payments-.*",
processMaxEvents: 200,
logLevel: "debug",
},
],
],
};
```
--------------------------------
### Define Governance Rules for Change Detection
Source: https://www.eventcatalog.dev/docs/development/governance/architecture-change-detection/introduction
Configure rules in `governance.yaml` to detect specific changes like services starting or stopping consumption of messages. This example notifies Slack when any service adds or removes a consumer.
```yaml
rules:
- name: notify-consumer-changes
when:
- consumer_added
- consumer_removed
resources:
- "*"
actions:
- type: console
- type: webhook
url: $SLACK_WEBHOOK_URL
```
--------------------------------
### Example CLI Command with Flags
Source: https://www.eventcatalog.dev/docs/plugins/hookdeck/cli
An example of how to run the generator with specific flags for directory, API key, log level, matching, domain, and maximum events.
```bash
npx @hookdeck/eventcatalog-generator \
--dir ./path/to/eventcatalog/install \
--api-key {HOOKDECK_API_KEY} \
--log-level debug \
--match "stripe-production" \
--domain Payments \
--max-events 200
```
--------------------------------
### EventCatalog Configuration with OpenAPI Generators
Source: https://www.eventcatalog.dev/docs/plugins/openapi/plugin-configuration
Example configuration for eventcatalog.config.js, demonstrating how to integrate OpenAPI specifications using the '@eventcatalog/generator-openapi' plugin. Shows setup for single and multiple OpenAPI files within domains, and customization of sidebar badges and HTTP method mapping.
```javascript
import path from "path";
import url from "url";
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
/** @type {import('@eventcatalog/core/bin/eventcatalog.config').Config} */
export default {
cId: "10b46030-5736-4600-8254-421c3ed56e47",
title: "MetaRetail Inc",
tagline: "Fake Retail Company for EventCatalog Demo",
organizationName: "MetaRetail Inc",
homepageLink: "https://eventcatalog.dev/",
editUrl: "https://github.com/boyney123/eventcatalog-demo/edit/master",
// By default set to false, add true to get urls ending in /
trailingSlash: false,
// Change to make the base url of the site different, by default https://{website}.com/docs,
// changing to /company would be https://{website}.com/company/docs,
base: "/",
// Customize the logo, add your logo to public/ folder
logo: {
alt: "EventCatalog Logo",
src: "/logo.png",
text: "MetaRetail Inc",
},
docs: {
sidebar: {
// Should the sub heading be rendered in the docs sidebar?
showPageHeadings: true,
},
},
generators: [
// Add single OpenAPI file to a domain
[
'@eventcatalog/generator-openapi',
{
services: [
{
path: path.join(__dirname, 'openapi-files', 'orders-service.yml'),
id: 'orders-service'
}
],
domain: { id: 'orders', name: 'Orders', version: '0.0.1' },
// Will render POST, GET, PUT, DELETE as badges in the sidebar
sidebarBadgeType: 'HTTP_METHOD',
// or set the license key via the environment variable as EVENTCATALOG_LICENSE_KEY_OPENAPI
licenseKey: 'YOUR_LICENSE_KEY'
},
],
// Add multiple OpenAPI files to a domain
[
'@eventcatalog/generator-openapi',
{
services: [
{
path: path.join(__dirname, 'openapi-files', 'payment-service.yml'),
id: 'payment-service'
},
{
path: path.join(__dirname, 'openapi-files', 'fraud-detection-service.yml'),
id: 'fraud-detection-service'
}
],
domain: { id: 'payment', name: 'Payment', version: '0.0.1' },
// Will render QUERY, COMMAND, EVENT as badges in the sidebar
sidebarBadgeType: 'MESSAGE_TYPE',
// Here we map the HTTP methods to the message types for EventCatalog (optional)
// e.g All post requests are mapped to commands, all get requests are mapped to queries
httpMethodsToMessages: {
GET: 'query',
POST: 'command',
PUT: 'command',
DELETE: 'command',
}
// or set the license key via the environment variable as EVENTCATALOG_LICENSE_KEY_OPENAPI
licenseKey: 'YOUR_LICENSE_KEY'
},
],
],
};
```
--------------------------------
### Install Node.js Dependencies with pnpm
Source: https://www.eventcatalog.dev/docs/development/ask-your-architecture/slack-integration/installation
Install project dependencies using pnpm. Ensure you have Node.js and pnpm installed.
```bash
pnpm install
```
--------------------------------
### Run EventCatalog Development Server
Source: https://www.eventcatalog.dev/docs/development/authentication/providers/setting-up-github
Start your EventCatalog development server using npm to test the newly configured GitHub authentication.
```bash
npm run dev
```
--------------------------------
### Install Node.js Dependencies with npm
Source: https://www.eventcatalog.dev/docs/development/ask-your-architecture/slack-integration/installation
Install project dependencies using npm. Ensure you have Node.js and npm installed.
```bash
npm install
```
--------------------------------
### Install OpenAPI and AsyncAPI Generators
Source: https://www.eventcatalog.dev/docs/plugins/apicurio/plugin-configuration
Install the necessary EventCatalog plugins for OpenAPI and AsyncAPI. Ensure you have obtained license keys from EventCatalog Cloud.
```bash
npm install @eventcatalog/generator-openapi @eventcatalog/generator-asyncapi
```
--------------------------------
### Render Build and Start Commands (npm)
Source: https://www.eventcatalog.dev/docs/development/ask-your-architecture/slack-integration/deployment
Specify these commands for building and starting the EventCatalog bot on Render when using npm as the package manager.
```bash
npm install && npm run build
```
```bash
npm start
```
--------------------------------
### Parse Message Examples in AsyncAPI
Source: https://www.eventcatalog.dev/docs/plugins/asyncapi/features
Configure the generator to parse message examples from AsyncAPI specifications. This feature is enabled by default and writes payloads to the `examples` folder.
```yaml
components:
messages:
OrderCreated:
description: 'Triggered when an order is created'
x-eventcatalog-message-type: event
payload:
type: object
properties:
orderId:
type: string
total:
type: number
examples:
- name: basic-order
payload:
orderId: 'ord-123'
total: 49.99
- payload:
orderId: 'ord-456'
total: 0.00
```
--------------------------------
### Disable Example Parsing
Source: https://www.eventcatalog.dev/docs/plugins/openapi/features
Set 'parseExamples: false' in the generator configuration to disable reading examples from OpenAPI operations. This prevents JSON files from being written to the 'examples' folder.
```javascript
generators: [
[
'@eventcatalog/generator-openapi',
{
services: [
{ path: path.join(__dirname, 'openapi-files', 'orders-service.yml'), id: 'orders-service' }
],
parseExamples: false,
},
],
],
```
--------------------------------
### Configure Topics, Services, and Domains with Confluent Schemas
Source: https://www.eventcatalog.dev/docs/plugins/confluent-schema-registry/installation
Configure the plugin to define topics, assign schemas to producers/consumers (services), and create domains. This example sets up the 'retail-domain' with 'Orders Service' and 'Inventory Service'.
```javascript
// ...
[
'@eventcatalog/generator-confluent-schema-registry',
{
// The URL of your Confluent Schema Registry
schemaRegistryUrl: 'http://localhost:8081',
// The topics (channels) to assign schemas to (optional)
topics: [{
id: 'orders-topic',
name: 'Orders Topic',
address: 'kafka-cluster-bootstrap:9092',
}, {
id: 'inventory-topic',
name: 'Inventory Topic',
address: 'kafka-cluster-bootstrap:9092',
}],
// The producers and consumers (services) to assign schemas to (optional)
services: [
{
id: 'Orders Service',
version: '1.0.0',
// the messages this service sends, this example sends events with a prefix of 'order-' to the 'orders-topic'
sends: [{ events: { prefix: 'order-' }, topic: 'orders-topic' }],
// the messages this service receives, this example receives events with a prefix of 'analytics-' from the 'inventory-topic'
receives: [{ events: { prefix: 'analytics-' }, topic: 'inventory-topic' }],
},
{
id: 'Inventory Service',
version: '1.0.0',
// the messages this service sends, this example sends events with a prefix of 'inventory-' to the 'inventory-topic'
sends: [{ events: { prefix: 'inventory-' }, topic: 'inventory-topic' }],
// the messages this service receives, this example receives events with a prefix of 'order-' from the 'orders-topic'
receives: [{ events: { prefix: 'order-' }, topic: 'orders-topic' }],
},
],
domain: {
id: 'retail-domain',
name: 'Retail Domain',
version: '1.0.0',
}
},
],
[
'@eventcatalog/generator-confluent-schema-registry',
{
// The URL of your Confluent Schema Registry
schemaRegistryUrl: 'http://localhost:8081',
// The topics (channels) to assign schemas to (optional)
topics: [{
id: 'users-topic',
name: 'Users Topic',
address: 'kafka-cluster-bootstrap:9092',
}, {
id: 'shipments-topic',
name: 'Shipments Topic',
address: 'kafka-cluster-bootstrap:9092',
}],
// The producers and consumers (services) to assign schemas to (optional)
services: [
{
id: 'Notifications Service',
version: '1.0.0',
receives: [
// the messages this service receives, this example receives events with a prefix of 'user-registered' from the 'users-topic'
{ events: ['user-registered'], topic: 'users-topic' },
// the messages this service receives, this example receives events with a prefix of 'shipment-created' from the 'shipments-topic'
{ events: ['shipment-created'], topic: 'shipments-topic' },
// the messages this service receives, this example receives events with a prefix of 'payment-received' from the 'payments-topic'
{ events: ['payment-received'] }
],
},
],
domain: {
id: 'communications-domain',
name: 'Communications Domain',
version: '1.0.0',
}
},
],
```
--------------------------------
### Example Versioned Domain Index File
Source: https://www.eventcatalog.dev/docs/development/guides/domains/versioning-and-changelogs/versioning
This shows an example of an index.mdx file within a versioned domain directory. The 'version' frontmatter should match the directory name.
```markdown
---
version: "0.0.1"
---
```
--------------------------------
### Install All EventCatalog Skills via CLI
Source: https://www.eventcatalog.dev/docs/development/ask-your-architecture/skills/installation
Use npx skills to add all available EventCatalog skills to your project. This is the recommended installation method.
```bash
npx skills add event-catalog/skills
```
--------------------------------
### OpenAPI Named Request Body Examples
Source: https://www.eventcatalog.dev/docs/plugins/openapi/features
Defines multiple named request body examples for a JSON payload. Each named example (e.g., 'dog', 'cat') will be written as a separate JSON file.
```yaml
paths:
/pets:
post:
operationId: createPet
requestBody:
content:
application/json:
examples:
dog:
value:
name: Fido
tag: dog
cat:
value:
name: Whiskers
tag: cat
```
--------------------------------
### Render Build and Start Commands (pnpm)
Source: https://www.eventcatalog.dev/docs/development/ask-your-architecture/slack-integration/deployment
Specify these commands for building and starting the EventCatalog bot on Render when using pnpm as the package manager.
```bash
pnpm install && pnpm build
```
```bash
pnpm start
```
--------------------------------
### Flow Version Example
Source: https://www.eventcatalog.dev/docs/api/flow-api
Example of defining the version for a flow. This is important for tracking changes.
```yaml
---
version: 0.0.1
---
```
--------------------------------
### Complete Data Product Example
Source: https://www.eventcatalog.dev/docs/development/guides/data-products/inputs-and-outputs
A comprehensive example defining a data product's metadata, inputs, outputs, and relationships, including contract details for outputs.
```yaml
---
id: payment-analytics
name: Payment Analytics
version: 1.0.0
summary: Payment performance metrics and fraud insights
inputs:
- id: PaymentInitiated
- id: PaymentProcessed
- id: PaymentFailed
- id: FraudCheckCompleted
- id: PaymentService
- id: payments-db
outputs:
- id: NotificationService
- id: payment-domain-eventbus
- id: payment-analytics-db
contract:
path: payment-metrics-contract.json
name: Payment Metrics Contract
type: json-schema
---
```
--------------------------------
### Start EventCatalog Slack Bot with Custom Config (npm)
Source: https://www.eventcatalog.dev/docs/development/ask-your-architecture/slack-integration/installation
Start the EventCatalog Slack Bot using npm with a custom configuration file path.
```bash
npm run dev -- --config ./my-config.ts
```
--------------------------------
### Schema Matching Filter Examples
Source: https://www.eventcatalog.dev/docs/plugins/aws-glue-registry/api
Examples demonstrating how to define filters for schema matching. These examples illustrate AND logic within a filter object, OR logic between filter objects, and OR logic within array values.
```json
// Schema must start with 'Customer' AND be AVRO format AND have team=customer tag
{
prefix: 'Customer',
dataFormat: 'AVRO',
tags: { team: 'customer' }
}
// Schema must contain 'order' OR 'customer' OR 'payment'
{
includes: ['order', 'customer', 'payment']
}
// Multiple filters - schema matches if it satisfies ANY filter
sends: [
{ prefix: 'Customer' }, // OR
{ tags: { team: 'orders' } } // OR
{ dataFormat: 'AVRO' } // OR
]
```
--------------------------------
### OpenAPI Named Response Examples
Source: https://www.eventcatalog.dev/docs/plugins/openapi/features
Defines multiple named response examples for a specific status code. Each named example (e.g., 'dog', 'cat') will be written as a separate JSON file prefixed with the status code.
```yaml
paths:
/pets:
post:
operationId: createPet
responses:
'200':
content:
application/json:
examples:
dog:
value:
id: 1
name: Fido
cat:
value:
id: 2
name: Whiskers
```
--------------------------------
### Install Dependencies and Configure Environment
Source: https://www.eventcatalog.dev/docs/plugins/azure-schema-registry/examples
Install project dependencies using npm and copy the environment variable template. Ensure your EventCatalog license key is added to the .env file.
```bash
npm install
cp .env.example .env
# Edit .env with your EventCatalog license key
```
--------------------------------
### Example of Version Pinned References
Source: https://www.eventcatalog.dev/docs/development/components/resource-references
This example shows how to reference both a specific older version of a service and the latest version of another service, useful for documenting migrations or legacy systems.
```markdown
Our legacy [[service|PaymentService@0.9.0]] is being replaced by [[service|PaymentGatewayService]].
```
--------------------------------
### Flow Name Example
Source: https://www.eventcatalog.dev/docs/api/flow-api
Example of defining the display name for a flow. This name is rendered in the UI.
```yaml
---
name: User Cancels Subscription
---
```
--------------------------------
### Install Federation Generator
Source: https://www.eventcatalog.dev/docs/plugins/eventcatalog-federation/configuration
Install the federation generator in your main catalog to enable merging repositories.
```bash
npm install @eventcatalog/generator-federation
```
--------------------------------
### Get All Flows
Source: https://www.eventcatalog.dev/docs/sdk/functions/getFlows
Retrieves all flows from EventCatalog. You can optionally filter to get only the latest version of each flow.
```APIDOC
## GET /api/flows
### Description
Retrieves all flows from EventCatalog. You can optionally specify if you want to get the latest version of the flows.
### Method
GET
### Endpoint
/api/flows
### Query Parameters
- **directory** (string) - Required - The directory to scan for flows.
- **latestOnly** (boolean) - Optional - If true, only the latest version of each flow is returned.
### Response
#### Success Response (200)
- **flows** (Flow[]) - An array of flow objects.
### Response Example
```json
{
"flows": [
{
"name": "UserRegistered",
"version": "1.0.0",
"path": "/path/to/flow"
}
]
}
```
```
--------------------------------
### Basic Example: Document All Schemas
Source: https://www.eventcatalog.dev/docs/plugins/aws-glue-registry/examples
Generates events for every schema in a specified registry. Creates an event for each schema, a channel for the registry, and attaches schema files to each event.
```javascript
// eventcatalog.config.js
module.exports = {
generators: [
[
'@eventcatalog/generator-aws-glue',
{
region: 'us-east-1',
registryName: 'ecommerce-events',
},
],
],
}
```
--------------------------------
### Add Example to Event
Source: https://www.eventcatalog.dev/docs/sdk/functions/addExampleToEvent
This function allows you to add an example file to a specific event within the catalog.
```APIDOC
## POST /websites/eventcatalog_dev/addExampleToEvent
### Description
Add an example file to an event.
### Method
POST
### Endpoint
/websites/eventcatalog_dev/addExampleToEvent
### Parameters
#### Path Parameters
- **directory** (string) - Required - The name of the event directory to which the example will be added.
#### Request Body
- **id** (string) - Required - The unique identifier for the event.
- **example** (object) - Required - An object containing the example content and filename.
- **content** (string) - Required - The content of the example file.
- **fileName** (string) - Optional - The name of the example file. If not provided, a default name will be used.
- **version** (string) - Optional - The version of the event to which the example applies.
### Request Example
```json
{
"id": "InventoryAdjusted",
"example": {
"content": "{\"id\": \"123\"}",
"fileName": "basic.json"
},
"version": "0.0.1"
}
```
### Response
#### Success Response (200)
- **void** - This function does not return any value upon successful execution.
#### Response Example
```json
// No response body for a void function
```
```
--------------------------------
### Example File Structure
Source: https://www.eventcatalog.dev/docs/development/guides/messages/common/examples
Organize example files within an 'examples/' folder inside your message directory. EventCatalog supports various text-based formats.
```treeview
events/
OrderCreated/
index.mdx
schema.json
examples/
basic-order.json
international-order.json
```