Getting started
Requirements
Section titled “Requirements”- Node.js 18+
Install
Section titled “Install”Arclens is published on npm. Install it globally:
npm install -g arclensOr run it without installing:
npx arclens analyze ./src --insightsAnalyze a project
Section titled “Analyze a project”From your app directory, analyze a source folder:
npx arclens analyze ./src --insightsThis command:
- Scans TypeScript and TSX files under
./src - Prints a terminal report (node counts, relationships, external libraries, top connections)
- Writes
graph.jsonin the current working directory
Use --insights to include architecture suggestions and ESLint-style hints in the terminal output. Insights are always embedded in graph.json for the viewer.
Gitignore
Section titled “Gitignore”Arclens writes generated files into your project. Add these to .gitignore so they are not committed by mistake:
.arclens/graph.json.arclens/— parse cache and optional snippet sidecars (with--with-snippets)graph.json— graph output fromanalyzeorwatch
Open the viewer
Section titled “Open the viewer”After analysis, start the bundled viewer:
npx arclens viewOpen the URL printed in the terminal (default http://127.0.0.1:5173). The viewer loads graph.json from your current directory.
Add --open to launch it in your default browser automatically.
Watch mode
Section titled “Watch mode”To re-analyze on file changes:
npx arclens watch ./src --insightsRun watch and the viewer together by opening a second terminal:
npx arclens viewPass through CLI flags as needed:
npx arclens watch ./src --insights --no-cacheTypical workflow
Section titled “Typical workflow”npx arclens analyze ./src --insights— generategraph.jsonnpx arclens view— explore the graph- Refactor, then re-run analyze or use
npx arclens watchfor live updates
From source (contributors)
Section titled “From source (contributors)”To work on Arclens itself, clone the repo and use pnpm:
git clone https://github.com/JCalmCrasher/arclens.gitcd arclenspnpm installFrom the repo, prefix commands with pnpm arclens (for example pnpm arclens analyze ./samples --insights). Use pnpm dev:watch to run watch mode and the viewer together during development.
Next steps
Section titled “Next steps”- CLI reference: all flags and commands
- Viewer guide: search, entry points, insights badge
- Concepts: nodes, edges, and insight criteria