CLI Scanner
The Routemage CLI scans your Next.js, Express, Fastify, or NestJS project, generates a manifest of every endpoint, and auto-uploads it to your workspace in one command. No file shuffling required.
Supported Frameworks
The CLI auto-detects which framework(s) your project uses based on package.json and the file layout. Multi-framework monorepos are fully supported — every framework with matching files contributes endpoints to a single manifest.
Installation
No install required for one-off use. Run the latest version with npx:
Or install globally to skip the npx prefix on every run:
Logging In
Before the CLI can upload manifests, it needs your API key. Run routemage login once — you only ever need to do this once per machine.
The CLI will prompt you to paste your API key and verify it against the app. On success, the key is saved to ~/.routemage/config.json.
API key priority. When the CLI needs a key, it checks these locations in order — first match wins:
ROUTEMAGE_API_KEYenvironment variable — highest priority, ideal for CI/CD~/.routemage/config.json— set byroutemage login.routemage.config.jsonin the project root — optional team-shared key
Scanning a Project
Run the scan command from the root of your project. After login, this uploads automatically:
The CLI detects which frameworks your project uses, walks the relevant directories (app/, pages/api/, controller files, route files), and analyses each one with TypeScript AST parsing — including cross-file type resolution for DTOs and shared schemas.
Understanding the Output
The CLI prints a summary table to your terminal and writes routemage/manifest.json locally before uploading:
Each endpoint entry includes:
Auto-Upload
After a successful login, routemage scan uploads automatically every time. There is no separate upload step. The workspace URL is printed at the end of each scan.
If no API key is found, the CLI writes the manifest locally and prints instructions to run routemage login. No upload happens, but your local manifest is still available.
ROUTEMAGE_API_KEY as a secret environment variable. No routemage login step is needed.Scan Flags
The --output and --no-upload flags are useful for air-gapped environments or when you want to inspect the manifest before sending it. The resulting JSON file can be imported manually via the Import button in the web app sidebar.
The --generate-docs flag triggers a background AI job that generates documentation for every route. The CLI exits immediately — you'll receive an email when generation finishes.
Getting Your API Key
Your API key is available in the web app. Open the Settings panel from the bottom of the sidebar. Your key is shown there and can be copied or rotated at any time.
- Rotating a key immediately invalidates the old one — update CI secrets and re-run
routemage loginon any affected machines - Never commit your API key to version control — use environment variables or a secret manager
Logging Out
To remove the saved API key from your machine:
This clears ~/.routemage/config.json. The next routemage scan will print instructions to log in again, or will use ROUTEMAGE_API_KEY if set.