CLI to run an opinionated Morpho Router.
npm install @morpho-dev/router-cli> Status: Alpha – this CLI is under active development and interfaces/behavior are subject to change.
CLI to run a router that serves offers and performs validations.
- Global install
``bash`
pnpm add -g @morpho-dev/router-cli
- One-off (no install)
`bash`
pnpx @morpho-dev/router-cli --helpor
pnpm dlx @morpho-dev/router-cli --help
Use router-cli to run a Router:
- Router starts on http://localhost:7891 by default
- Seed random offers with --seed
- Enable validation with --validation flag
- Load offers from JSON file with --file
- Start a local UI alongside the Router with --ui
- --db-offer-endpoint plug the router on top of a postgres
Examples:
`bashRouter with seeded random offers and UI
router-cli start --seed 100 --ui
$3
You can also run the UI without starting a local Router server, pointing it to any Router endpoint.
- By default, it targets the staging Router URL.
- Override the target with
--router-url.`bash
UI against default remote Router (https://router.morpho.dev)
router-cli uiUI against a custom Router endpoint (e.g., local)
router-cli ui --router-url http://localhost:7891
`The Router API is available at
http://localhost:7891 (or your custom port) and supports the same endpoints as the production Router.
$3
#### Global
`text
Usage: router-cli [options] [command]CLI to run an opinionated Morpho Router.
Options:
-V, --version output the version number
-h, --help display help for command
Commands:
start [options] Start a Router server.
tunnel [options] Expose the local Router via ngrok
mempool [options] Start a local chain with the mempool contract
help [command] display help for command
`#### start
`text
Usage: router-cli start [options]Start a Router server.
Options:
--port (default: 7891, env: ROUTER_PORT)
--chain (choices: "ethereum", "base",
"ethereum-virtual-testnet", "anvil", default: "ethereum",
env: ROUTER_CHAIN)
--rpc-url (env: ROUTER_RPC_URL)
--router-url (default: "https://router.morpho.dev", env:
ROUTER_REMOTE_URL)
--store (choices: "pglite", "pg", default: "pglite", env:
ROUTER_STORE)
--db-endpoint (env: ROUTER_DB_ENDPOINT)
--log-level (choices: "trace", "debug", "info", "warn", "error",
"fatal", "silent", default: "info", env:
ROUTER_LOG_LEVEL)
--block-window Block window to get logs from (default: 100)
--seed Seed random offers to router (default: 0)
--file Seed offers from a JSON file
--ui Start minimal UI (default: false)
-h, --help display help for command
`#### tunnel
`text
Usage: router-cli tunnel [options]Expose the local Router via ngrok
Options:
--port (default: 7891, env: ROUTER_PORT)
--ngrok-authtoken (env: NGROK_AUTHTOKEN)
-h, --help display help for command
`#### mempool
`text
Usage: router-cli mempool [options]Start a local chain with the mempool contract
Options:
--port (default: 8545, env: MEMPOOL_PORT)
--fork-url (default: "https://ethereum-rpc.publicnode.com",
env: MEMPOOL_FORK_URL)
--block-number (default: 0)
-h, --help display help for command
``