The following details how to set up your environment to develop a plugin on your local machine. This should not be run on the Busby server when developing.
First, nodejs version 20 must be installed on your computer.
It is strongly recommended to use Visual Studio Code. If you are using this, install the Busby delopment plugin by downloading the .vsix file from this page
To use a develop a custom typescript service you will need to set up NPM to be able to authenticate and use the Squaredpaper NPM repository for access to the busby packages.
The main package required for a custom service is @busby/esb.
To connect to our repository run this command. Please contact us to obtain the user name and password. For the email address enter your email address. This will login and set the @busby scope to be available from our registry.
npm login --global --scope busby --registry https://npm.squaredpaper.co.uk/
Once the environment has been set up to create a plugin using a template, run:
npm create @busby@latest <app-name>
Replace <app-name> with the name for the application, or omit this entirely and it will prompt you for the name. This will be the name of the folder that gets created.
It will prompt you for which type of app you are creating (Select Typescript Service) and a couple of other questions. Once done it will show you some additional commands to run at the end.
First you must create a Busby service to run your app against.
To do this, log into the Busby Configuration Editor and add a new service.
Click on custom service.

In the service details page, give your service a name, and select at least 1 host that the service will run on. It should not be started during development, but it needs to be assigned to at least one host to create the service and generate the provider config and an id for the provider to use to provide the service.
In the language drop down select node
Enter a javascript file name which will be generated when you webpack your service, the default is the name of the folder for your service + ".js" e.g. testService.js
Enter a folder name e.g. /var/squaredpaper/services/testService
Optionally set additional log levels
Ensure that login parameters is ticked
If you are wanting to run the sample boiler plate code, it requires a connection to the authentication service.
Put the following JSON in the advanced configuration box at the bottom:
{
"services": {
"authenticationService": "authenticationService"
}
}

You now need to publish your configuration
In VS Code you can now run the service.
Click on the run and debug menu on the left hand side of VS Code and then at the top click on launch program

Enter the IP address or hostname of the Busby core server you are developing against (You must be able to connect to port 5672 of this host, and it must be the core where RabbitMQ is running)
Then from the list select the provider ID of the service you just configured. If no providers are listed, check your connectivity and firewall rules as this is also a check that you can connect to the system on port 5672

If your config is correct and your code runs you should see in the console of VS Code that the service is running, and if you look in Busby Admin you should see that your service is active.


Once your service is production ready you will need to build the service as a production build and upload it to the Busby machine(s) where it will run.
There is a build command included in the package.json so you can run npm run build and then upload the contents of the build folder to the busby machine(s) to the path /var/squaredpaper/services/<name> name the folder the same as what you have called it in the custom service configuration.
Once uploaded you should be able to start your service from the Busby Admin user interface.