Once you have a self-hosted setup running on your dev machine and have installed the agent from your portal, you are ready to create and run your own capabilities. To ensure this is the case, verify that your device is showing up as online (green dot) on your portal.
Before you proceed, make sure you have node.js 16+ installed. When the Transitive agent installs, it installs a copy of node.js 16 in
~/.transitive/usr/bin. If you like, you can add that folder to your
PATH, or you can install node.js directly from https://deb.nodesource.com/.
To initialize a new capability in the current folder, run:
npm init @transitive-sdk@latest mycap
mycap is the name you want your new capability to have. This will create a new folder with the same name, containing a ready-to-go template of a Transitive capability. Run
npm start inside that folder to start the new capability. This will:
- start the robot component on your local machine
- start the cloud component in a docker container
- start esbuild to bundle the front-end
Once this has all started up, go back to the portal where you should now see the capability running on your device.
Once the three parts of the capability are running, i.e., the robot component, the cloud component, and the front-end component, you are ready to start editing the starter template to develop the capability you want. For this, we recommend you first learn about the MqttSync class in the SDK Reference documentation. This class implements Transitive's transparent data-synchronization between the three components (robot, cloud, and web UI).