Quick Installation
Get started with tdepend in seconds
npm install -D tdependPowerful Features
Everything you need to maintain healthy architecture
Dependency Analysis
Analyze coupling between modules and components. Understand how your codebase is structured and identify tight coupling that may need refactoring.
Cycle Detection
Detect circular dependencies using Tarjan's strongly connected components algorithm. Find and eliminate problematic cycles in your architecture.
Architectural Metrics
Compute key fitness metrics including Afferent Coupling (Ca), Efferent Coupling (Ce), Instability (I), Abstractness (A), and Distance from the main sequence.
Configurable Fitness Functions
Define custom fitness functions and thresholds to enforce architectural rules. Set up quality gates that align with your team's standards.
Programmatic API
Use tdepend as a library in your Node.js/TypeScript projects. Access the full analysis pipeline, dependency graph, and metrics programmatically for custom integrations.
JSON Export & Serialization
Export complete analysis results to versioned JSON format. Includes serialized dependency graphs, normalized cycles with unique IDs, and full metric data for external tools.
Dual CLI/Library Mode
Works as both a standalone CLI tool and an importable library. Use --export flag for file output or import analyze() for programmatic usage in your scripts and workflows.
Tool Integration
Designed to work alongside ts-arch, dependency-cruiser, and custom dashboards. Export data in formats that other architectural tools can consume for comprehensive analysis.
Use as CLI or Library
Choose the approach that fits your workflow
CLI Usage
# Analyze your project
tdepend analyze
# Export results to JSON
tdepend analyze --export report.json
# CI mode with strict checks
tdepend analyze --ci --failOnCycle
Library Usage
import { analyze, exportToFile } from 'tdepend';
const result = await analyze({
rootDir: 'src',
failOnCycle: true
});
await exportToFile(result, 'analysis.json');