Skip to content

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

FrameworkVersionStatus
Vue2.x✅ Supported
Vue3.x✅ Supported
React-⏳ Planned

Installation

Install comp-hub CLI globally. After installation, you can use the comphub command directly:

bash
npm install comp-hub@latest -g

Method 2: Local Dev Dependency Installation

Install only in the current project, suitable for team collaboration scenarios:

bash
npm install comp-hub@latest -D

Start Service

Start after Global Installation

Execute in the project directory:

bash
comphub

Start after Local Installation

If you installed locally with -D, you need to execute via npx:

bash
npx comphub

After 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 started

Use 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:

bash
comphub [options]

Parameter Description:

ParameterShortTypeDefaultDescription
--port-pnumber5000Service port
--dir-dpath"./"Resource directory relative path
--log-llevel"info"Log level
--version-v--Show version number
--help-h--Show help information

Usage Examples:

bash
# 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 -h

Configuration

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):

json
{
  "port": 5000,
  "dir": "./src",
  "log": "info",
  "allowDebug": false
}

JS Format (.comphub.js):

javascript
module.exports = {
  port: 5000,
  dir: './src',
  log: 'info',
  allowDebug: false
}

Configuration Items

Configuration ItemTypeDefaultDescription
portnumber5000Service startup port
dirstring"./"Relative path to the component code root directory. Only this directory and its subdirectories can be operated during upload/download
logstring"info"Log level, optional values: "debug", "info", "warn", "error"
allowDebugbooleanfalseWhether to allow debug mode

Configuration File Loading Priority

  1. Try to load .comphub.json first
  2. If the JSON file does not exist, try to load .comphub.js
  3. If neither exists, use default configuration

Configuration Priority

Configuration value priority from high to low:

  1. Command line parameters (e.g., -p 8080)
  2. Configuration file (.comphub.json or .comphub.js)
  3. Default configuration

Next Steps

After the service starts, you can:

Components uploaded by users are open source