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#
How It Works#
Running blocklet create initiates an interactive command-line interface that guides you through the setup process. You will be prompted to:
- Enter a name for your blocklet (if not provided as an argument).
- 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 createIf you already have a name in mind, you can provide it directly:
Direct Mode
blocklet create my-awesome-blockletOptions#
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-onlyThis 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...A9Troubleshooting#
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-blocklet2. 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-blockletAfter creating your project, the next step is to run it in a local development environment. For more information, proceed to the Develop Mode guide.