Skip to content

CLI reference

The harmonic command manages the server. After a global install (npm install -g @mintopia/harmonic) it’s on your PATH; without one, prefix any command with npx @mintopia/harmonic. Running harmonic with no command, or with help / --help, prints usage.

Terminal window
harmonic <command> [options]
npx @mintopia/harmonic <command> [options]
CommandWhat it does
serveRun the server in the foreground (Ctrl-C to stop). Best for a quick one-off.
startRun the server in the background; logs to <data-dir>/harmonic.log. Returns immediately.
installInstall Harmonic as an OS service. Run harmonic install --help for the available options and platform-specific details.
statusReport whether a background server is running, and where. Exits non-zero if it isn’t, usable in scripts.
stopStop the background server started with start.
restartRestart the installed service, or the background server started with start.
versionPrint the installed version. Also --version or -v.
helpShow usage. Also --help, or running with no command.

Run Harmonic standalone when you want to manage its lifetime yourself: use harmonic serve to keep it in the foreground, or harmonic start to run its background daemon. Use harmonic install when you want your OS to manage Harmonic as a service instead. For service setup and options, run harmonic install --help.

Only one standalone background server runs per data directory. start launches it, status inspects it, and stop shuts it down. All three read the same --data-dir to find each other, so pass a matching --data-dir to every command when you run off the default.

restart stops and starts the server again. If an installed service exists, it restarts that service. Otherwise, if a background server is running, it restarts that server on the same port and host. If nothing is running, it starts a background server with the default port (4700) and host (0.0.0.0). restart accepts only --data-dir, like status and stop.

OptionCommandsDefaultDescription
--port <n>serve, start4700Port to listen on.
--host <h>serve, start0.0.0.0Bind address. 0.0.0.0 is reachable from your network; use 127.0.0.1 for local-only.
--data-dir <dir>all~/.harmonicWhere Harmonic keeps its data and background log.
--password <pw>serve, start—Set or update the operator password. Pass an empty value (--password '') to remove it and run ungated.

--data-dir applies to every command, including status and stop, which use it to locate the running server. status and stop accept only --data-dir; passing --port, --host, or --password to them is an error and exits non-zero. Those three flags belong to the commands that start a server (serve, start).

Run in the foreground on a custom port, local-only:

Terminal window
harmonic serve --host 127.0.0.1 --port 8080

Start a password-protected background server with its own data directory:

Terminal window
harmonic start --password 'correct horse' --data-dir ~/harmonic-work
harmonic status --data-dir ~/harmonic-work
harmonic restart --data-dir ~/harmonic-work
harmonic stop --data-dir ~/harmonic-work

Remove a previously set password (run ungated again):

Terminal window
harmonic start --password ''

Harmonic checks npm once an hour (and once at startup) using your npm config, so a private registry or mirror works. When a newer release is out, a banner appears in the app. Dismiss it to hide a version you’re not ready for; the next release brings it back.

Installed as an OS service (harmonic install, systemd or init.d), Harmonic upgrades itself. Click Upgrade and, the next time your fleet is idle, it installs the new release alongside the current one, checks it, and switches over, so nothing is interrupted mid-flight. If the new release keeps failing to start, it switches back to the previous one when the pre-upgrade database can still be restored. The README covers what to check when an upgrade fails.

Run any other way (a global install with harmonic start, npx, pm2, Docker), Harmonic doesn’t upgrade itself, because it can’t restart safely under a supervisor it doesn’t control. The banner shows the command to run instead. From a source checkout Harmonic doesn’t self-update; pull and rebuild instead.

Upgrading the package by hand (npm i -g) replaces the files on disk, but the running server keeps the old version until it restarts. Run harmonic restart to switch over. Until then, a banner says which version is installed and which is still running, and some pages may not work. If the server was upgraded while a tab was open, the banner offers a Reload instead.

A restart signs everyone out. Sessions are kept in the server’s memory, so when a password is set, open tabs return to the Login screen after the server restarts, and you sign in again with the same password.

  • Configuration reference: the environment variables (HARMONIC_DATA_DIR, HARMONIC_PASSWORD) that back these options, and what lives in the data directory.
  • Security: the password, host binding, and what “ungated” means before you expose Harmonic.
  • Quickstart: install and run from scratch.