Create Project


The blocklet create command is the fastest way to start a new Blocklet project. It uses create-blocklet, an interactive scaffolding tool that lets you choose from various official starter templates. This command is the recommended method for bootstrapping a new application.

Usage#

The command serves as a convenient wrapper for npx create-blocklet@latest.

Command

blocklet create [name] [options]

Arguments#

[name]
string
The name for your new blocklet project. If you omit the name, the interactive setup process will prompt you for one.

How It Works#

Running blocklet create initiates an interactive command-line interface that guides you through the setup process. You will be prompted to:

  1. Enter a name for your blocklet (if not provided as an argument).
  2. Choose a starter template (e.g., React, Vue, Static, etc.).

The tool will then create a new directory with the specified name, download the template, and install the necessary dependencies.

Examples#

To start an interactive session, simply run the command without any arguments:

Interactive Mode

blocklet create

If you already have a name in mind, you can provide it directly:

Direct Mode

blocklet create my-awesome-blocklet

Options#

--did <did>
string
Pre-assigns a specific Decentralized Identifier (DID) to the blocklet during creation.
--did-only
boolean
A special utility mode. This flag does not create a project. Instead, it connects to your DID Wallet to generate and display a new DID suitable for a blocklet. This is useful for creating a DID in advance.

Generating a Blocklet DID Only#

If you only need to create a DID for a future blocklet without starting a new project, use the --did-only flag.

Generate DID

blocklet create --did-only

This command will connect to your wallet, generate a new DID with the moniker 'blocklet', and print the result to your console.

Example Output

Created Blocklet DID: z2...A9

Troubleshooting#

Occasionally, issues related to npx (the Node.js package runner), such as outdated caches, can cause the create command to fail. If you encounter an error, here are a couple of workarounds.

1. Run create-blocklet Directly#

You can bypass the blocklet create wrapper and execute create-blocklet directly using npx:

Direct npx Execution

npx create-blocklet@latest my-new-blocklet

2. Install Globally#

Alternatively, you can install create-blocklet globally on your system and then run it.

Global Installation

# Step 1: Install globally
npm install -g create-blocklet

# Step 2: Run the command
create-blocklet my-new-blocklet

After creating your project, the next step is to run it in a local development environment. For more information, proceed to the Develop Mode guide.