Used to check for browser translation.
用于检测浏览器翻译。
ブラウザの翻訳を検出する
Blocklet Workflows

Create Project


The blocklet create command is the primary method for bootstrapping a new Blocklet project. It uses various starter templates to provide you with a complete, runnable application from the start. This is the recommended approach for creating new blocklets, as it sets up all the necessary configurations and dependencies for a specific use case, such as a React app, a static site, or a Node.js service.

This command acts as a wrapper for npx create-blocklet@latest, ensuring you always use the most up-to-date templates available.

Usage#

To start the interactive project creation wizard, run the command without any arguments:

blocklet create

You can also specify a project name directly to bypass the initial prompt:

blocklet create <name>

Options#

The create command supports several options to customize the project setup process.

Option

Description

Example

[name]

The name of your new blocklet. A directory with this name will be created for your project.

blocklet create my-awesome-blocklet

--did <did>

Specify a pre-existing DID to be used for the blocklet.

blocklet create my-app --did z...

--did-only

A utility mode that only generates a new Blocklet DID from your wallet without creating a project.

blocklet create --did-only

Interactive Creation#

Running the command without a name launches an interactive wizard. This is the simplest way to get started.

blocklet create

The CLI will guide you through selecting a template and configuring your new project.

Creating a Named Project#

To create a project in a new directory with a specific name, pass the name as an argument. The setup process will begin inside the newly created directory.

blocklet create my-first-blocklet

Creating a Project with a Specific DID#

If you have already created a DID for your blocklet, you can assign it during creation using the --did flag.

blocklet create my-app-with-did --did z8iZpKx1e9d1a3b4c5d6e7f8g9h0i1j2k3l4m5n6o7p8q9r0s

Generating a DID Only#

In some cases, you might need to generate a DID for a blocklet before creating the project itself. The --did-only flag allows you to do this. The command will connect to your wallet, generate a new DID, print it to the console, and then exit without creating any project files.

blocklet create --did-only

# Example Output:
# Created Blocklet DID: z8iZqabc...xyz

This is useful for reserving a DID that you plan to use later.

Troubleshooting npx Issues#

If you encounter an error while running blocklet create, it may be related to npx. You can try the following alternative commands:

  1. Execute the create-blocklet script directly:npx create-blocklet@latest your-blocklet-name

  2. Install create-blocklet globally and then run it:npm install -g create-blocklet
    create-blocklet your-blocklet-name


After creating your project from a template, the next step is to run it in a local development environment. Proceed to the Develop Mode guide for instructions.