Skip to content

platformatic/watt-admin

Repository files navigation

watt-admin

CLI Tool

The project includes a command-line interface tool to check available Platformatic runtimes.

Installation

After installing the project dependencies, you can run the tool directly:

./cli.js

To run the CLI on a custom port, you can just pass it as an argument with ./cli.js --port 4321.

To record a flamegraph session, and choose to profile either the cpu or the heap, you can run the CLI with ./cli.js --record --profile heap. Once you will stop the process, an HTML one-file bundle will be auto-generated, and you will be able to navigate (even offline) the watt-admin app, looking at the flamegraph and at the metrics stored for the whole time you have run the CLI.

The tool is also available as a binary when installed globally or linked:

npm link  # Link the package locally
watt-runtime  # Run the command

Usage

The tool automatically discovers all available Platformatic runtimes. If multiple runtimes are found, it will prompt you to select one using an interactive menu.

$ watt-runtime
Select a runtime: (Use arrow keys)
❯ runtime-name (PID: 12345) (Started at 3/10/2025, 10:00:00 AM)
  another-runtime (PID: 54321) (Started at 3/10/2025, 9:30:00 AM)

If only one runtime is available, it will be automatically selected.

Project setup

npm install && cp .env.sample .env

Build

npm run build

Start

npm run start

Dev Mode

This will auto-reload both the backend and frontend when changes are made.

npm run dev

Navigate the app

  1. check you started watt-admin
  2. you should now see an info log like Platformatic is now listening at http://127.0.0.1:{PORT} (open the local URL)
  3. click on link above to navigate the frontend app
  4. you can call the backend by prefixing the local URL with /api
  5. call the /api/runtimes endpoint (you should receive the PID)
  6. call the /api/runtimes/{pid}/metrics endpoint