Scaffolding

When a user installs a custom integration, the integration can perform scaffolding.

Scaffolding lets an integration create folders, flows, and database tables on behalf of the user. This makes it possible for an integration to add powerful features to a project in a matter of seconds.

This topic explains how to add scaffolding features to an integration.

Prerequisites

  • You're familiar with flows and database tables.
  • You know how to create a manifest.json file.
  • You're familiar with TypeScript.

Step 1: Enable scaffolding

In the same directory as a manifest.json file, create a TypeScript file:

touch scaffolding.ts

(The name of the file isn't important.)

Then, in the manifest.json file, add a scaffolding.tsFile property to the features object:

{
  "features": {
    "scaffolding": {
      "tsFile": "installationValidation.ts"
    }
  }
}

This property must contain a relative path to the TypeScript file.

Step 2: Create a scaffold

In the TypeScript file, create a run function:

function run(config, project, context) {
  // code goes here
}

This function is where the scaffolding logic lives. It runs when a user adds the integration to their project.

The function receives the following parameters:

  • config
  • project
  • context

To learn more about these parameters, see Scaffolding API).

Step 3: Write the scaffolding logic

The run function's project parameter parameter contains methods for managing the project programmatically. Specifically, these methods let the integration create folders, flows, and database tables.

You can access the methods via the dataTableManager and flowManager properties:

function run(config, project, context) {
  console.log(project.dataTableManager);
  console.log(project.flowManager);
}

To learn more about these methods, see the following topics: