Getting Started
This guide provides a straightforward path to installing the Blocklet Server CLI, initializing a new server instance, and getting it running. Follow these steps to set up your environment quickly.
Prerequisites#
Before you begin, ensure you have Node.js (version 16 or higher) and npm installed on your system.
The Quickest Way: start --auto-init
#
For the fastest setup, you can initialize and start your server with a single command. This is the recommended approach for new users who want to get started with default settings.
Step 1: Create a Directory
It's best practice to create a dedicated directory for your Blocklet Server instance. This keeps your configuration and data files organized.
# Create a new directory and navigate into it
mkdir my-blocklet-server && cd my-blocklet-server
Step 2: Install the CLI
Next, install the @blocklet/cli
package globally using npm. This gives you access to the blocklet
and blocklet server
commands from anywhere in your terminal.
npm install -g @blocklet/cli
Step 3: Initialize and Start the Server
Now, run the start
command with the --auto-init
flag. This command checks if a server configuration exists. If not, it automatically initializes a new one with default settings and then starts the server daemon.
blocklet server start --auto-init
Once the server starts, it will display the access URLs for your web dashboard. Open one of these URLs in your browser to manage your server and install blocklets.
The Manual Way: init
and start
#
If you prefer to configure the server during setup, you can run the init
and start
commands separately.
Step 1: Install the CLI and Create a Directory
Follow steps 1 and 2 from the previous section to create a directory and install the CLI.
Step 2: Initialize the Server Interactively
Run the init
command without any flags. This will launch an interactive setup wizard that guides you through configuring your server's name, port, routing engine, and other settings.
blocklet server init
If you want to accept all default settings without the prompts, you can use the force (-f
) flag:
# Initialize with default settings non-interactively
blocklet server init -f
Step 3: Start the Server
After initialization is complete, start the server daemon process.
blocklet server start
The terminal will then display the access URLs for your web dashboard.
What's Next?#
Your Blocklet Server is now running. You can explore the web dashboard to get familiar with its features or dive into the following sections to learn more about managing your server and blocklets.