Skip to main content

Installation

View as Markdown

Deprecated

The @eventcatalog/generator-federation generator is deprecated. Federation is now built into EventCatalog and runs with eventcatalog federate. See the EventCatalog Federation docs to get started.

This page documents the legacy generator for existing users.

The EventCatalog Federation plugin is designed for your main catalog.

This plugin will allow you to merge multiple EventCatalog instances into a single catalog.

Prerequisites​

Installation​

Run the command below to install the EventCatalog Federation plugin.

npm i @eventcatalog/generator-federation

Configuration​

Configure the plugin in your eventcatalog.config.js file.

Add the plugin to the generators.

eventcatalog.config.js
// ...
generators: [
[
'@eventcatalog/generator-federation',
{
// Pulling information from a GitHub repository, (generator supports any Git source e.g GitLab, Bitbucket, etc)
source: 'git@github.com:event-catalog/generators.git',

// specifying the branch to pull from (default is main)
branch: 'main',

// optional (specify which files you want to copy from the repository)
copy: [
{
// importing content from the customer-experience-team catalog
content: 'examples/generator-federation/basic/customer-experience-team/services',
// specify the target path in your main catalog, here we are importing the services from the customer-experience-team catalog
destination: path.resolve(__dirname, 'services')
},
{
// importing content from the customer-experience-team catalog
content: 'examples/generator-federation/basic/customer-experience-team/teams',
// specify the target path in your main catalog, here we are importing the services from the customer-experience-team catalog
destination: path.resolve(__dirname, 'teams')
},
{
// importing content from the customer-experience-team catalog
content: 'examples/generator-federation/basic/customer-experience-team/users',
// specify the target path in your main catalog, here we are importing the services from the customer-experience-team catalog
destination: path.resolve(__dirname, 'users')
}
],

// optional, if you want to merge and override any conflicts then set to true (default is false)
override: true,

// optional, if you want the plugin to error
// if there are duplicate resources in your
// main catalog then set to true (default is false)
enforceUniqueResources: true
},
],
// Payment Team
// When no `copy` values are provided, the plugin will copy eventcatalog files for you.
[
'@eventcatalog/generator-federation',
{
// Pulling information from a GitHub repository
source: 'git@github.com:event-catalog/generators.git',

// specifying the directory of the eventcatalog in your project (default it the root directory)
// This example clones the generators repository, and looks for the eventcatalog in the my-project-eventcatalog directory
sourceRootDir: 'my-project-eventcatalog'

// specifying the branch to pull from (default is main)
branch: 'main',

// optional, if you want to merge and override any conflicts then set to true (default is false)
override: true,

// optional, if you want the plugin to error
// if there are duplicate resources in your
// main catalog then set to true (default is false)
enforceUniqueResources: true
},
],
],

License​

The EventCatalog Federation plugin is open source under the MIT License and doesn't need a license key.

If your config still sets licenseKey or an EVENTCATALOG_LICENSE_KEY_* variable, you can remove it; it's ignored.

Run the generator​

Once you have configured the plugin you can run the generator.

npm run generate

View your catalog​

Run your catalog locally to see the changes.

npm run dev

Any questions or need help?​

If you get stuck, find an issue or need help, please raise an issue on GitHub or join our Discord community.