Quick Start
This chapter will guide you through the installation and startup of comp-hub, which takes no more than 5 minutes.
Requirements
- Node.js >= 16.0.0
- npm >= 8.0.0
Supported Frameworks
| Framework | Version | Status |
|---|---|---|
| Vue | 2.x | ✅ Supported |
| Vue | 3.x | ✅ Supported |
| React | - | ⏳ Planned |
Installation
Method 1: Global Installation (Recommended)
Install comp-hub CLI globally. After installation, you can use the comphub command directly:
npm install comp-hub@latest -gMethod 2: Local Dev Dependency Installation
Install only in the current project, suitable for team collaboration scenarios:
npm install comp-hub@latest -DStart Service
Start after Global Installation
Execute in the project directory:
comphubStart after Local Installation
If you installed locally with -D, you need to execute via npx:
npx comphubAfter successful startup, the terminal will display output similar to the following:
✅ comp-hub v0.24.11
2026-04-17 20:38:56.589 INFO 25672 cwd: /path/to/your/project
2026-04-17 20:38:56.589 INFO 25672 env: prod
2026-04-17 20:38:56.602 INFO 25672 [midway:socketio] Socket.io server start success and attach to web server
2026-04-17 20:38:56.611 INFO 25672 Local Address: http://localhost:5000
2026-04-17 20:38:56.611 INFO 25672 Network Address: http://192.168.x.x:5000
2026-04-17 20:38:56.611 INFO 25672 [midway:bootstrap] current app startedUse a browser to access the displayed address (default is http://localhost:5000) to enter the comp-hub platform.
CLI Command Line Parameters
You can also configure startup options via command line parameters:
comphub [options]Parameter Description:
| Parameter | Short | Type | Default | Description |
|---|---|---|---|---|
--port | -p | number | 5000 | Service port |
--dir | -d | path | "./" | Resource directory relative path |
--log | -l | level | "info" | Log level |
--version | -v | - | - | Show version number |
--help | -h | - | - | Show help information |
Usage Examples:
# Start with specified port
comphub -p 8080
# Specify resource directory and log level
comphub -d ./src -l debug
# View version number
comphub -v
# View help information
comphub -hConfiguration
To customize the port or specify the component directory, you can create a .comphub.json or .comphub.js file in the project root directory:
Configuration File Format
JSON Format (.comphub.json):
{
"port": 5000,
"dir": "./src",
"log": "info",
"allowDebug": false
}JS Format (.comphub.js):
module.exports = {
port: 5000,
dir: './src',
log: 'info',
allowDebug: false
}Configuration Items
| Configuration Item | Type | Default | Description |
|---|---|---|---|
port | number | 5000 | Service startup port |
dir | string | "./" | Relative path to the component code root directory. Only this directory and its subdirectories can be operated during upload/download |
log | string | "info" | Log level, optional values: "debug", "info", "warn", "error" |
allowDebug | boolean | false | Whether to allow debug mode |
Configuration File Loading Priority
- Try to load
.comphub.jsonfirst - If the JSON file does not exist, try to load
.comphub.js - If neither exists, use default configuration
Configuration Priority
Configuration value priority from high to low:
- Command line parameters (e.g.,
-p 8080) - Configuration file (
.comphub.jsonor.comphub.js) - Default configuration
Next Steps
After the service starts, you can:
- Upload Component — Publish your components to the platform
- Preview & Download — View and use components from others