CLI Reference
The Trace CLI is the engine that maps your codebase. Run it from the root of your Next.js or Node.js project to generate a visual architectural map.
Quick Start
You don't need to install Trace globally. You can run it directly using `npx`:
This command performs a deep static analysis of your project. You'll see an output summarizing the parsed endpoints, outbound requests, and data edges:
✔ Outbound 2
✔ Data edges 7
The CLI will then upload this graph and provide a temporary, anonymous link that expires in 10 minutes.
Saving Permanent Maps
To save a map permanently to your account, pass your API key. The CLI will securely cache the API key locally, so you only need to provide it once!
Tip: You can also set the TRACE_API_KEY environment variable instead of using the -k flag.
Privacy & Team Sharing
Trace ensures your architecture maps are secure by default:
- Anonymous Maps (No API Key): Act as temporary public links. Anyone with the URL can view the map, but it is permanently deleted after 10 minutes.
- Saved Maps (With API Key): Are permanently saved to your account and set to Private by default. Only you can view them. Unauthorized visitors will simply see a 404 page.
How to Share Private Maps
To share a map with your colleagues, navigate to your Dashboard or the Team Hub. Click the Share option on any project card to open the Access Manager. From there you can:
- Invite by Email: Add specific team members to grant them secure access to your private map.
- Make Public: Toggle the map to Public, allowing anyone with the direct link to view it instantly.
CLI Options
| Flag | Description |
|---|---|
| -d, --dir <path> | Directory to scan (defaults to current directory). |
| -k, --key <key> | API key for Trace. Saves locally to ~/.trace/config.json automatically. |
| -n, --name <name> | Assign a custom name to the flow (e.g. "Billing Service"). |
| --json | Output raw JSON to stdout instead of uploading (useful for piping). |
| --include <globs> | Comma-separated extra glob patterns to include in the scan. |
| --exclude <globs> | Comma-separated extra ignore patterns (e.g. node_modules is ignored by default). |