Skip to main content

Getting Started

Creating a New Widget​

You can scaffold a web widget in two ways:

ApproachCommandBest for
Offline starterpnpm exec nx generate @cdx-extensions/widget-template-web:widget <widget-name>Blank Module Federation remote with no catalog
Catalog templatespnpm exec nx run generate-web-widgetDI-backed starters from the extension template catalog

Both create a new app under widgets/web/ with the required Module Federation configuration. Only modify files inside src/app/ for your widget logic and UI.

For catalog-driven generation (category picker and npm template overlays), see Extension Template Catalog. Quick reference:

Bash
pnpm exec nx run generate-web-extensions          # interactive: type → category → template → name
pnpm exec nx run generate-web-widget # interactive: widget only
pnpm exec nx run generate-web-widget -- --template=agent --name=test-widget

In cdx-extensibility-apps, prefix Nx with pnpm exec. Build a named widget with pnpm run build -- agent-widget (package.json script — not pnpm exec). Do not run a bare pnpm run build at the repo root. See pnpm run vs pnpm exec.

Prerequisites​

Before you run either generator, complete the prerequisites and environment setup described in the CDX Extensibility Apps README. That reference repo uses pnpm (corepack enable, then pnpm run setup). Prefix Nx with pnpm exec. If corepack enable fails, see Troubleshooting. For when to use pnpm run vs pnpm exec, see pnpm run vs pnpm exec.

File / FolderCan you edit?Notes
src/app/YesAll your widget UI and business logic goes here
src/environments/YesSet apiUrl and feature flags per environment
src/assets/YesAdd images, fonts, static files
module-federation.config.tsPartiallyOnly change name and exposes
project.jsonPartiallyOnly change port under serve / serve-static
webpack.config.tsNoRequired for Module Federation — any change breaks loading in OLB
bootstrap.tsx / main.tsNoRequired async boundary for Module Federation
tsconfig*.json / jest.config.tsNoRequired for build and test tooling

Next Steps​

Web development guides: