create
The blocklet create command bootstraps a new blocklet project using a starter template. It leverages the create-blocklet utility to provide an interactive setup experience, making it the recommended way to start a new project.
For creating a barebones project without a template, see the blocklet init command. For a more detailed walkthrough, refer to our Create a Blocklet guide.
Usage#
blocklet create [name] [options]Parameters#
Name | Type | Description |
|---|---|---|
|
| Optional. The name for your new blocklet project. If omitted, an interactive prompt will appear. |
Options#
Option | Description |
|---|---|
| Specifies a pre-existing DID to be associated with the blocklet upon creation. |
| A special mode to generate a new Blocklet DID using DID Wallet without creating a project. |
Examples#
Create a Blocklet Interactively#
Running the command without a name starts an interactive wizard that guides you through selecting a template and naming your project.
blocklet createThis will trigger the create-blocklet scaffolder, which will prompt you for the project name and the template you wish to use.
Create a Blocklet with a Specific Name#
To skip the interactive prompt for the project name, you can provide it directly as an argument.
blocklet create my-awesome-blockletThe command will create a new directory named my-awesome-blocklet and set up the project inside it.
Create a Blocklet with a Pre-existing DID#
If you have already generated a DID that you want to use for your new blocklet, you can pass it using the --did option.
blocklet create my-did-blocklet --did z1..._some_did_...Generate a Blocklet DID Only#
If you only need to generate a new DID for a blocklet without scaffolding a new project, use the --did-only flag. This is useful when you need to assign a DID to an existing project or service.
blocklet create --did-onlyThis command will generate a QR code for DID Connect. After you scan it with your DID Wallet and approve the request, the CLI will output the newly created Blocklet DID.
Example Response
Created Blocklet DID: zt12...rest_of_the_didTroubleshooting NPX Issues#
This command relies on npx to fetch and run the latest version of create-blocklet. If you encounter issues related to npx (e.g., network problems or cache errors), you can try the following alternatives:
- Run
create-blockletdirectly withnpx:npx create-blocklet@latest my-awesome-blocklet - Install
create-blockletglobally and run it:npm install -g create-blocklet
create-blocklet my-awesome-blocklet
After creating your blocklet, the next step is to run it in a local development environment. Proceed to the blocklet dev command reference or follow the Develop a Blocklet guide to get started.