# sverweij/dependency-cruiser architecture

> Architecture diagram of the GitHub repository sverweij/dependency-cruiser, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sverweij/dependency-cruiser
- Repository: https://github.com/sverweij/dependency-cruiser

## Overview

##### Main Components
The system should be organized into these primary components:

a. Core Processing Pipeline:
- Extract Module (src/extract/): Handles dependency extraction from source files
- Validate Module (src/validate/): Processes validation rules
- Enrich Module (src/enrich/): Enhances dependency information
- Report Module (src/report/): Generates various output formats

b. Supporting Systems:
- Configuration Management (src/config-utl/)
- Cache System (src/cache/)
- CLI Interface (src/cli/)
- Graph Utilities (src/graph-utl/)

##### Component Relationships

**[CLI Interface] → [Config Management] → [Core Pipeline]**
- ↓
**[Source Files] → [Extract] → [Validate] → [Enrich] → [Report] → [Output]**
- ↑           ↑            ↑          ↑
- [Cache System]─────┘          |
- [Graph Utilities]─────────────┘

##### Detailed Component Breakdown

Extract Module:
- Parsers (acorn, swc, typescript)
- Resolution logic
- Transpiler support

Validate Module:
- Rule engine
- Pattern matching
- Dependency validation

Enrich Module:
- Metrics calculation
- Dependency analysis
- Graph enhancement

Report Module:
- Multiple format generators (dot, html, json, etc.)
- Visualization helpers
- Output formatting

##### Integration Points

Clear interfaces between:
- CLI and configuration management
- Extract module and various parsers
- Report module and output formats
- Cache system and core pipeline

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Legend
        L1[Core Processing]:::core
        L2[Input/Output]:::io
        L3[Support Systems]:::support
        L4[External Systems]:::external
    end

    subgraph "Input Layer"
        SRC[Source Files]:::external
        CLI["CLI Interface"]:::io
        CONF["Configuration Management"]:::io
    end

    subgraph "Core Processing Pipeline"
        EXT["Extract Module"]:::core
        VAL["Validate Module"]:::core
        ENR["Enrich Module"]:::core
        REP["Report Module"]:::core
    end

    subgraph "Support Systems"
        CACHE["Cache System"]:::support
        GRAPH["Graph Utilities"]:::support
    end

    subgraph "Output Layer"
        OUT_DOT["DOT Output"]:::io
        OUT_HTML["HTML Output"]:::io
        OUT_JSON["JSON Output"]:::io
    end

    CLI --> CONF
    CONF --> EXT
    SRC --> EXT
    EXT --> VAL
    VAL --> ENR
    ENR --> REP
    REP --> OUT_DOT
    REP --> OUT_HTML
    REP --> OUT_JSON
    
    CACHE --> EXT
    CACHE --> VAL
    CACHE --> ENR
    
    GRAPH --> EXT
    GRAPH --> REP

    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef io fill:#2ecc71,stroke:#27ae60,color:white
    classDef support fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white

    click EXT "https://github.com/sverweij/dependency-cruiser/tree/main/src/extract/"
    click VAL "https://github.com/sverweij/dependency-cruiser/tree/main/src/validate/"
    click ENR "https://github.com/sverweij/dependency-cruiser/tree/main/src/enrich/"
    click REP "https://github.com/sverweij/dependency-cruiser/tree/main/src/report/"
    click CONF "https://github.com/sverweij/dependency-cruiser/tree/main/src/config-utl/"
    click CACHE "https://github.com/sverweij/dependency-cruiser/tree/main/src/cache/"
    click CLI "https://github.com/sverweij/dependency-cruiser/tree/main/src/cli/"
    click GRAPH "https://github.com/sverweij/dependency-cruiser/tree/main/src/graph-utl/"
```
