After almost 2 years maintaining the mesg-js library, we decided to do some reorganization.

The previous mesg-js library was responsible for many things, like managing access to the MESG API, creating an SDK to develop services quickly, and at the same time exposing functions to connect with external API. Having all this in a single library was messy, hard to manage, and complicated to work on and use. Because of our experimentation and heavy development, we did multiple updates of the library that were not impacting services but still considered as a breaking change for this multi-purpose library.

We also moved our CLI from Golang to Node about a year ago. This has been great to separate the business logic of the Engine and to force us to think carefully about the different APIs we needed to create. The CLI was a single repository that was dependent on the mesg-js library. This dependency, along with the fact that the CLI was not part of the same repository of the mesg-js library, made it complicated to update, because it required us to release a new version of the mesg-js library just to be able to update the CLI.

After seeing all these inefficiencies, we decided to merge all of these tools into a general Javascript SDK. This SDK is now composed of 4 independent libraries:

  • @mesg/api: This library is responsible for the communication with the MESG Engine API. It handles the conversion of the data to Protobuf messages sent to the gRPC server providing functions with promises for unary calls and event emitters for the different streams that are available in the API.
  • @mesg/service: This library handles the connection with the MESG Engine, authentications, and finally, the service functions that listen to tasks sent by the Engine or emit events that your service needs to expose to the Engine.
  • @mesg/application: This library lets you connect to the MESG Engine to listen for any event or result that you might be interested too. It also allows you to execute a task, either synchronously or asynchronously.
  • @mesg/cli: This is the CLI of MESG mesg-cli that lets you interact with your MESG Engine to create/test/deploy services and processes through a command-line interface (CLI).

Now that the libraries have become a series of simple libraries, one problem persisted: the dependencies between these libraries. All of these libraries are dependent on each other, and updates between them could be hard to manage, so we decided to use a single mono-repo. We used the fantastic library lerna to manage the dependencies without juggling between multiple repositories and having dependent pull requests to ship a new feature.

This reorganization helps us be more productive as we could work on a single code base to create a specific feature instead of multiples while having smaller and more stable libraries that would need fewer updates.

We also decided to release these libraries in 0.x.x versions, as we are still in heavy development, and we might do more experimentation for the preparation of the coming testnet.

If you have services or application using mesg-js we highly encourage you to update it using the new js-sdk to be compatible with the future versions of the Engine.