What is Blocklet Composition?
To understad what is blocklet composition, please check out: Blocklet Composition
Compose in blocklet.yml
The blocklet.yml file allows you to define and compose multiple blocklets within your main blocklet. This feature enables you to create modular and reusable applications by incorporating other blocklets as components.
The components section in your blocklet.yml file is where you define the blocklets you want to include in your main blocklet. Here's the structure:
components:
- name: did-comments
mountPoint: /did-comments
required: false
source:
store: https://store.blocklet.dev
name: did-comments
version: latest
- name: meilisearch
required: true
mountPoint: /meilisearch
source:
store: https://dev.store.blocklet.dev
name: meilisearch
version: latest
- name: payment-kit
required: true
source:
store: https://store.blocklet.dev
name: z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk
version: latestFields Explanation:
name: required, The identifier for the component within your blocklet, should be DID for most casesmountPoint: optional, The path where the component will be accessible in your blocklet.required: optional, Boolean indicating whether the component is essential for your blocklet to function.source: required: Specifies where to obtain the component blocklet.store: URL of the blocklet store containing the component.name: Name or DID of the blocklet in the store.version: Version of the blocklet to use (e.g., "latest" or a specific version number).url: if your blocklet is not hosted in any store, you can provide its bundle URL
To make blocklet composition much easier to accomplish, here are the steps:
- Go to https://store.blocklet.dev/ and find the blocklet you want to include as a dependency
- Open the blocklet detail, such as https://test.store.blocklet.dev/blocklets/z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9
- Click the extra actions section on the left of Launch, and then click "Add Component"
- Then go to your blocklet source code repo, paste and run the component add command
- Then restart your blocklet, blocklet server will handle dependency blocklet automatically