dev
The blocklet dev command is the cornerstone of the local development workflow. It starts a development environment for your blocklet by installing it into a running Blocklet Server instance, enabling features like hot-reloading and easy debugging. The command streams logs directly to your terminal and automatically cleans up the development instance when you stop the process.
This command significantly simplifies development by managing the entire lifecycle of a temporary blocklet instance. Before using this command, ensure you have a Blocklet Server running. For more details, see our Getting Started guide.
How It Works#
The blocklet dev command automates the install-run-debug-cleanup cycle. The following diagram illustrates the typical sequence of events when you run the command:
Usage#
blocklet dev [options]Options#
Option | Description |
|---|---|
| Specifies the DID of the parent application to install the current blocklet into as a component. Essential for developing components. Can also be set via the |
| The path where the component will be mounted within the parent application (e.g., |
| Automatically opens the blocklet's URL in your default web browser after it starts successfully. |
| Specifies a Blocklet Store URL to resolve component dependencies from. Overrides the default store. |
| When developing a component, this flag ensures all other components within the parent application are also started. |
| Runs the blocklet in end-to-end testing mode. |
Scenarios#
Developing a Standalone Blocklet#
For a blocklet that is not a component of another application, simply run the command in the project's root directory.
# Navigate to your blocklet project
cd /path/to/my-blocklet
# Start the development session
blocklet dev --openDeveloping a Component Blocklet#
When developing a blocklet that acts as a component for a parent application, you must specify the parent's DID and a mount point.
# Start a development session for a component
blocklet dev --app-did zNKj... --mount-point /my-component --openThis command will install your blocklet at the /my-component path within the application identified by zNKj....
Subcommands#
blocklet dev also includes several subcommands for more granular control over the development lifecycle.
install#
Installs the blocklet in development mode on the Blocklet Server but does not start it. This is useful for pre-setting up an environment.
blocklet dev installremove#
Removes a blocklet that was previously installed in development mode.
blocklet dev removereset#
Resets the data for a blocklet in development. If the blocklet is not installed, it will be installed temporarily, reset, and then removed.
blocklet dev resetfaucet#
Claims test tokens from a faucet for the blocklet's wallet, which is useful for testing features that require tokens. The blocklet must be installed first.
blocklet dev faucet --token <token_symbol_or_address>studio#
Opens the Blocklet Studio for the application. If the application is not installed, it will be installed first.
blocklet dev studioAfter developing and testing your blocklet, the next step is to package it for distribution. To learn more, proceed to the bundle command documentation.