Codify design solutions into reusable modules
A Blueprint module is a node module that contains a reusable Blueprint entities that can be applied to a Blueprint application. The goal of a Blueprint module is to provide functionality that address a certain application concern. For example, a Blueprint module many provide support for MongoDB, or it may implement a solution for integrating a paywall into your application. This way, the Blueprint application developer does not have to implement the solution themselves.
It is not hard to create a Blueprint module. First, you need to create a standard Blueprint application.
blueprint new [name]
After the Blueprint application is created, add
keywordsproperty in the generated
packaged.jsonfile. Now, save the application and publish it using
You have now created your first Blueprint module.
The Blueprint application automatically loads all Blueprint modules. It does so by using a postorder depth-first search of the dependencies defined in
package.json, and loading all modules that have the keyword
blueprint-module. This ensures that all dependencies are available to the parent module, or application, when it is loaded into memory.
A Blueprint module can depend on other Blueprint modules.
When a Blueprint module is loaded into memory, the module is added to the Blueprint application and the entities in the Blueprint module are merged with the entities in the application. If an entity with the same type and name already appears in the application, it is overwritten. The overwritten entity, however, will still be accessible via the application. You just have to include the Blueprint module name when you are perform a lookup operation. For example
blueprint.lookup ('module-a:model:message'); // using lookup() method
blueprint.model ('module-a:message'); // using model() method
The following entities can be loaded from a Blueprint module into a Blueprint application:
When a router is loaded from a Blueprint module, its routes are not automatically added to the Blueprint application. Instead, you must mount a router for it to be useable from the Blueprint application.
The following is a list of know Blueprint modules.