Publish Models or Business Network Definitions

Publish Models or Business Network Definitions for use by applications

Hyperledger Composer can optionally use the npm package manager to publish both business networks, and models. By publishing business networks to npm applications that need to reference the business networks (for example to introspect them, or deploy them) can declare a binary package dependency on the published npm package. Using semantic versioning of the npm package for the business network also allows applications to specify their tolerance for accepting incompatible changes to the business network.

The npm package manager is a powerful (Internet scale) mechanism to distribute any binaries, along with metadata expressed in a package.json file.

Similarly, a set of Composer domain models (CTO files) may be packaged into an npm package for publication. The ability to publish models allows the models to be reused across multiple business networks (by declaring a package.json dependency), as well as ensures that semantic versioning can be used to control the evolution of the models themselves.

However, publication to npm is not required to use Composer. You may bundle a business network inside an application, and simply manage its source files using version control software, such as git.

The easiest way to publish a model or business network definition for use by applications it to push the business network definition to the npm package manager using the npm publish command. This will allow the applications that would like to use the business network definition (for example to deploy it via API) to reference the business network definition as a dependency in their package.json file.

References