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

Development Workflow


The Blocklet development lifecycle is a structured process that takes you from an initial idea to a deployed application. This workflow is designed to be straightforward, leveraging the Blocklet CLI to handle the heavy lifting at each stage. Understanding this process is key to efficiently building and managing your blocklets.

Before diving in, you might want to familiarize yourself with the basic Project Structure of a blocklet and the different Bundling modes available.

The Core Workflow at a Glance#

The typical development journey can be visualized as a sequence of distinct steps, each corresponding to a specific CLI command.

Blocklet Server (Local or Remote)

Local Machine

blocklet init

blocklet dev

blocklet bundle

blocklet deploy

Developer Idea

Create Project

Develop & Test

Bundle for Production

Deploy to Server

Blocklet is Live


Step-by-Step Guide#

Let's walk through each stage of the development process.

1. Initialize Your Project#

Every new blocklet starts with the init command. This utility scaffolds a new project in your current directory by creating the necessary files and folders, such as blocklet.yml, blocklet.md, and a .gitignore file. It will prompt you for essential information like the blocklet's title, description, and group.

# Navigate to your workspace and run:
blocklet init

This interactive process ensures your project is set up correctly from the start. For a complete list of options, see the blocklet init command reference.

2. Develop and Test Locally#

Once your project is initialized, you can start the local development environment using blocklet dev. This command is central to the development process. It installs your blocklet in development mode onto your local Blocklet Server, starts it, and provides you with a URL for access. Any changes you make to your code will trigger an automatic reload, allowing for a fast and efficient feedback loop.

# From within your project directory, run:
blocklet dev

This command handles:

  • Installing the blocklet and its component dependencies.
  • Starting the blocklet's processes.
  • Providing a live URL for testing.

This is where you'll spend most of your time coding and testing features. For more advanced use cases, check out the Develop a Blocklet guide.

3. Bundle for Production#

When your blocklet is ready for deployment, you need to package it into a distributable format. The bundle command compiles your code, packages assets, and creates a release artifact. This process prepares your blocklet to be run in a production environment.

# From within your project directory, run:
blocklet bundle

This command creates a .blocklet directory containing the bundled application, ready for the final step. Depending on your project's needs, you can choose from different bundling modes. Learn more in our guide on Bundling.

4. Deploy to a Server#

The final step is to deploy your bundled blocklet to a Blocklet Server. The deploy command uploads your bundle and installs it. You can deploy to your local server for final testing or to a remote server for production use.

To deploy a blocklet as a component of an existing application, you must specify the application's DID.

# Deploy the bundled blocklet from the current directory
blocklet deploy . --app-id z8iZpA6z3M8YwJjJdYn9E5vK9k5Z6a7B4c3d

This command uploads the contents of your bundle to the specified Blocklet Server, making it live. For detailed instructions on deploying to local and remote servers, refer to the blocklet deploy command reference.


By following this workflow, you can move smoothly from concept to a fully deployed blocklet. To put this into practice, head over to our Getting Started guide.