This boilerplate code simplifies setting up and managing ArcXP IFX in an imperative way.
It comes with standard commands to manage your integrations, deliver your code, and utilities for faster development.
./integrations/
- Contains all the integrations../packages/commands
- Contains all commands that can be run for integrations (e.g.,pnpm run ifx -- <command>
)../packages/shared
- Contains shared code between commands and integrations, such as logger, ArcAPI, and utilities../packages/tsconfig
- Contains the TypeScript configurations (tsconfig
) for all packages.
- Node.js 20.x or higher.
- pnpm 8.x or higher.
- Run
pnpm install
to install all dependencies. - Create
.env.sandbox
by duplicating.env.example
and updating the necessary values.
- Duplicate the
./integrations/hello
folder and rename it to your integration name. - Update
package.json
: Setname
to match your integration name. - Update
ifx-definition.yaml
: Add your integration settings. Ensure to setignore: false
to allow running commands on this integration.
Exampleifx-definition.yaml
:integrationName: my-first-integration description: "This is my first ArcXP IFX integration" email: [email protected] events: - story:update - story:create runtime: node enabled: true ignore: false
- Install dependencies:
pnpm install
. - Run
pnpm run ifx -- provision
to create the integration on ArcXP. Wait for the provisioning system bundle. - Run
pnpm run ifx -- deploy
to deploy the new bundle to IFX. - Run
pnpm run ifx -- provision
again to subscribe to events, set up environment variables, enable/disable the integration, etc. - Write event handlers:
- Add handlers to the
eventsHandlers
folder. - Export them in
eventsHandlers.ts
. - Define their usage in the
eventsRouter.json
.
- Add handlers to the
Note: Look at handler example here: ./integrations/hello/src/eventsHandlers/example.ts
.
- By default, all commands run in the
sandbox
environment. Use the--env=prod
flag to run commands in production. - Running
pnpm run ifx
implicitly runsturbo run ifx
— it tries to apply this script to all integrations and packages. - To run commands for a specific integration:
- Run it inside the integration's folder.
- Use
turbo --filter=@ifx/my-integration-name
.
Manages the integration.
- Applies settings from
ifx-definition.yml
to ArcXP. - If the integration doesn't exist, it will be created. After creation, you must deploy a bundle before updating it any further.
- If the integration exists, it will handle actions like:
- Enabling/disabling.
- Subscribing/unsubscribing to events.
- Adding secrets (fetched from
.env.sandbox
or.env.prod
).
Note: Integration-specific .env.sandbox
files override the root's .env.sandbox
.
Delivers your code to ArcXP:
- Lints, builds, and packages the integration code.
- Uploads a new bundle and promotes it on ArcXP.
Builds the integration:
- Runs necessary steps for creating a valid build. (see
build.cmd.ts
) - Runs a
health
handler to verify the validity of the build.
Promotes (makes live) the selected bundle.
- It's recommended to run this in the specific integration folder.
- You will be prompted to select the bundle to promote.
Deletes all integrations.
Prints the latest logs for every integration.
Prints detailed information about the integrations, including:
- The integration object itself.
- Bundles.
- Subscriptions.
- Secrets.
Starts a development server in watch mode:
- The server listens for
POST
requests to/
. - By default, it uses a random port. Override it with the
PORT
environment variable.
Example request:
curl --location 'http://localhost:54265/' \
--header 'Content-Type: application/json' \
--data '{
"key": "story:create",
"body": {
"id": "test"
}
}'
- Environment: Always specify the environment (
sandbox
orproduction
) using the--env
flag when necessary. - Command Scope: Run commands within an integration folder for scope, or use
turbo --filter
to target a specific integration.
Feel free to explore all commands and contribute to optimizing the flow for managing ArcXP integrations.