Skip to content

CLI Reference

The comp-hub CLI provides a set of commands to manage your local dev server. Multiple projects can run simultaneously, each with its own port.

The CLI is published with three binary names — comphub, ch and comp-hub — all pointing to the same program. Every command below works with any of them, e.g. ch status, comp-hub -p 8080.

Command Overview

CommandDescription
comphubStart dev server for the current project
comphub statusView master status and all running projects
comphub stop <hash>Stop a specific project
comphub stop --allStop all projects
comphub killShut down master process
comphub fixFix common issues (stale runtime file, etc.)

comphub — Start Server

Run in the project directory to start the dev server and preview components in the browser.

bash
comphub

Options:

OptionShortTypeDefaultDescription
--port-pnumber5478Service port
--dir-dpath"./"Resource directory relative path
--log-level-lstring"error"Log level: debug, info, warn, error

| --version | -v | - | - | Show version | | --help | -h | - | - | Show help |

--port only applies when no master process is running yet. If a master is already up, the CLI reuses it and prints a warning that -p is ignored; run comphub kill first if you really need a different port.

Examples:

bash
# Start with default port
comphub

# Use a custom port
comphub -p 8080

# Specify directory
comphub -d ./src

After a successful start, you'll see the project info and access URL:

✓ comp-hub v0.44.11

   ██████╗  ██████╗  ███╗   ███╗ ██████╗       ██╗  ██╗ ██╗   ██╗ ██████╗
  ██╔════╝ ██╔═══██╗ ████╗ ████║ ██╔══██╗      ██║  ██║ ██║   ██║ ██╔══██╗
  ██║      ██║   ██║ ██╔████╔██║ ██████╔╝      ███████║ ██║   ██║ ██████╔╝
  ██║      ██║   ██║ ██║╚██╔╝██║ ██╔═══╝       ██╔══██║ ██║   ██║ ██╔══██╗
  ╚██████╗ ╚██████╔╝ ██║ ╚═╝ ██║ ██║           ██║  ██║ ╚██████╔╝ ██████╔╝
   ╚═════╝  ╚═════╝  ╚═╝     ╚═╝ ╚═╝           ╚═╝  ╚═╝  ╚═════╝  ╚═════╝


  Version  0.44.11
  Project  D:\project\housing\vue2
  Hash     94525912
  Port     5478

  URL      http://localhost:5478/94525912/main/

  ─────────────────────────────────────────────

  comphub status                View all projects
  comphub stop    94525912      Stop current project
  comphub stop    --all         Stop all projects
  comphub kill                  Shutdown master

Open the URL in your browser to enter the platform.

Startup Behaviour

  • Version check: before starting, the CLI asks the remote service whether the installed version is still allowed. If the current version is blocked, startup aborts with comp-hub must be upgraded before it can start; run npm install comp-hub@latest -g and start again. If a newer version is merely available, a notice is printed and startup continues.
  • Log streaming: after the banner, the CLI streams the MidwayJS logs of this project (SSE). Press Ctrl+C to stop — the project is deregistered from master automatically.

comphub status — View Status

See which projects are currently running.

bash
comphub status

Example output:

● Master Status

  Status      ● running
  Version     0.44.11
  Uptime      2m
  Projects    2

  ▸ Registered Projects (2):
  ────────────────────────────────────────────────────────
    hash     94525912
    path     D:\project\housing\vue2
    url      http://localhost:5478/94525912/main/
  ────────────────────────────────────────────────────────
    hash     a3f82109
    path     D:\project\housing\vue3
    url      http://localhost:5478/a3f82109/main/
  ────────────────────────────────────────────────────────

If no service is running:

✗ Master service is not running

comphub stop — Stop Projects

Stop one or all running projects without affecting others.

bash
# Stop a specific project (use status to find the hash)
comphub stop <hash>

# Stop all projects
comphub stop --all

Examples:

bash
# Stop project with hash 94525912
comphub stop 94525912

# Stop all projects at once
comphub stop --all

comphub kill — Shut Down All Services

Shut down all projects and services.

bash
comphub kill

This terminates the master process and all registered projects. Run comphub again to restart.


comphub fix — Fix Common Issues

Clean up stale runtime files and fix other common problems:

bash
comphub fix

This is useful when:

  • A previous shutdown left a stale process file that prevents a new startup
  • You need to reset the local runtime state

Running Multiple Projects

You can run different projects at the same time:

bash
# Terminal 1: Start project A
cd /path/to/project-a
comphub

# Terminal 2: Start project B
cd /path/to/project-b
comphub

# Check all running projects
comphub status

Each project gets its own port and is accessed via a different URL.

Components uploaded by users are open source