CLI reference
Every flag the `krouter` command supports. Tray mode, port override, MITM toggle, log streaming, version pinning.
The krouter command is what NPM installs globally and what you run to start the server. It boots the dashboard on localhost:20128 and (optionally) launches a tray icon.
Basics
# Start in the foreground with logs in the terminal
krouter
# Start in the background with a tray icon
krouter -t
# Stop a running tray-mode instance
pkill -f krouterAll flags
| Flag | What it does |
|---|---|
-t, --tray | Launch the tray icon and detach from the terminal. The dashboard runs in the background. |
-p PORT, --port PORT | Override the default 20128 port. Useful if you have another service on that port. |
-l, --logs | Stream the server log to your terminal (only meaningful without -t). |
-v, --version | Print the installed version and exit. |
-h, --help | Show usage and exit. |
--reset-password | Reset the dashboard login password to the value of INITIAL_PASSWORD (default 123456). Use if you lost your password. |
--no-mitm | Force-disable MITM mode on this run, even if it's enabled in the saved settings. Useful for troubleshooting. |
--config FILE | Load a JSON config file overriding env vars. Mostly for CI / scripted setups. |
Common workflows
Quick dashboard view
krouter -t
# Tray icon → right-click → Open Dashboard
# Or just visit http://localhost:20128/dashboardTest that an upgrade works
# Stop the running server
pkill -f krouter
# Upgrade
npm install -g @sifxprime/krouter@latest
# Start fresh in the terminal so you can see boot logs
krouterRun on a non-standard port
krouter -p 28128
# Dashboard: http://localhost:28128If you run on a custom port, IDEs you've already configured will keep pointing to :20128. Update your IDE's endpoint URL too.
Run on a server (no tray)
On Linux servers without a graphical environment, drop the -t flag and use a process manager instead:
# pm2 (recommended)
npm install -g pm2
pm2 start "$(which krouter)" --name krouter
pm2 save
pm2 startup
# Or systemd
sudo tee /etc/systemd/system/krouter.service << 'EOF'
[Unit]
Description=kRouter
After=network.target
[Service]
Type=simple
User=youruser
WorkingDirectory=/home/youruser
ExecStart=/usr/bin/env krouter
Restart=on-failure
Environment=PORT=20128
Environment=HOSTNAME=0.0.0.0
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now krouterStream logs without restarting
If kRouter is running in tray mode and you want to see the live log:
# macOS / Linux
tail -F "$HOME/.krouter/logs/server.log"
# Windows PowerShell
Get-Content -Wait "$env:APPDATA\krouter\logs\server.log"Exit codes
kRouter returns standard Unix exit codes:
| Code | Meaning |
|---|---|
0 | Clean exit (Ctrl-C or krouter --version) |
1 | Generic error — check the log |
2 | Port already in use |
3 | Database lock (another process is holding data.sqlite) |
4 | Missing/corrupted MITM certificate (run --reset-mitm) |
5 | Out of memory (try a node arg: NODE_OPTIONS=--max-old-space-size=4096 krouter) |
Where to go next
- Deployment — VPS, Docker, Cloudflare Workers
- Security — credentials, certificates, JWT
- Troubleshooting — common problems with the CLI