Skip to content

CLI

The EventCatalog CLI connects your .ec files to your EventCatalog. Import models into your catalog, export existing resources to .ec files, and automate workflows in CI/CD.

Install

The CLI runs via npx with no install required:

Terminal window
npx @eventcatalog/cli --help

Command pattern

Terminal window
npx @eventcatalog/cli --dir <catalog-path> <command> [options]

The --dir flag points to your EventCatalog directory.

Import .ec files into EventCatalog

Take your .ec models and create or update resources in your catalog:

Terminal window
# Import a single file
npx @eventcatalog/cli --dir ./catalog import ./main.ec
# Import multiple files
npx @eventcatalog/cli --dir ./catalog import ./core.ec ./payments.ec
# Preview changes without writing
npx @eventcatalog/cli --dir ./catalog import ./main.ec --dry-run
# Read from stdin
cat ./main.ec | npx @eventcatalog/cli --dir ./catalog import --stdin

Import flags

FlagWhat it does
--dry-runPreview creates, updates, and versioning without writing
--flatWrite resources in top-level folders instead of nesting
--no-initSkip initialization prompts (useful in CI/CD)

Export EventCatalog to .ec files

Pull existing resources out of your catalog as .ec files:

Terminal window
# Export everything
npx @eventcatalog/cli --dir ./catalog export --all --stdout
# Export one resource type
npx @eventcatalog/cli --dir ./catalog export --resource service --stdout
# Export a specific resource
npx @eventcatalog/cli --dir ./catalog export --resource event --id OrderCreated --version 1.0.0 --stdout

Export flags

FlagWhat it does
--allExport every resource in the catalog
--resource <type>Filter by resource type (service, event, etc.)
--id <name>Export a specific resource by ID
--version <ver>Target a specific version
--hydrateInclude referenced resources in output
--output <path>Write to a file instead of stdout
--playgroundOpen exported DSL in EventCatalog Compass

CI/CD usage

Run imports in your pipeline to keep documentation in sync with .ec file changes:

Terminal window
npx @eventcatalog/cli --dir ./catalog import ./main.ec --no-init

Use --no-init to skip interactive prompts in automated environments.