# mrrootsec/assetviz architecture

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

- Interactive diagram: https://gitdiagram.com/mrrootsec/assetviz
- Repository: https://github.com/mrrootsec/assetviz

## Overview

##### Main Components
- CLI/Entry Point: Represented by main.go, this is the starting point that handles command-line arguments (e.g., the “-f” flag or STDIN input).
- Input Handler: A module that processes input either via file (using the “-f” flag) or piped STDIN data.
- Parsing/Processing Engine: The logic that takes the subdomain lines, parses them, and builds an internal representation of the domain’s structure.
- Visualization/Report Generator: The component that converts the processed subdomain data into a mind map and then generates an HTML report in the output folder (.report). This might include formatting and layout algorithms.
- File/Output Manager: Responsible for writing the generated HTML report to the designated location with a timestamped filename.
- (Optionally) Configuration & Dependency Management: Indicated by Go modules files (go.mod and go.sum) which also outline external libraries that may be used.

##### Relationships and Interactions
- The CLI (main.go) receives the command-line arguments. It then calls the Input Handler.
- The Input Handler reads either the file specified by the “-f” flag or directly from STDIN.
- The raw data is passed to the Parsing/Processing Engine, which constructs a structured model representing the hierarchy of subdomains.
- The model is provided to the Visualization component, which transforms the data into a visual representation (a mind map).
- Finally, the Output Manager takes the visualization and saves it as an HTML file (placed in the .report folder) with an appropriate timestamp.
- Optionally, error handling, logging, and configuration components can be added as auxiliary parts.

##### Architectural Patterns and Technologies
- Modular design: Each step (input handling, processing, and visualization) is split into discrete, independent modules.
- Single Responsibility Principle: Each component (CLI, parser, visualizer, output manager) carries a unique responsibility.
- Technology: Go for the core application logic, with external packages managed via go.mod (they could be for HTML templating, file I/O, or CLI parsing).

##### Elements
- Also, include feedback loops if error handling returns information back to the CLI.
- User interface components (the CLI).
- Data processing components (Input Handler and Parsing Engine).
- Output components (Visualization and Report Generation).
- Annotations (like notes) to mention that modules like configuration or dependency management (go.mod) exist even if they are not directly part of the runtime flow.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Main Components
    CLI["CLI (main.go)"]:::cli
    InputHandler["Input Handler (File/STDIN)"]:::processing
    ParsingEngine["Parsing/Processing Engine"]:::processing
    Visualization["Visualization/Report Generator"]:::output
    OutputManager["File/Output Manager (HTML Report)"]:::output
    TestData["Test Data (subdomain files)"]:::data

    %% Runtime Flow
    CLI -->|"calls"| InputHandler
    InputHandler -->|"sends data"| ParsingEngine
    ParsingEngine -->|"builds model"| Visualization
    Visualization -->|"generates report"| OutputManager

    %% Additional Relationship: InputHandler can receive file inputs
    TestData ---|"provides sample inputs"| InputHandler

    %% Auxiliary Subgraph for Configuration & Dependencies 
    subgraph "Configuration & Dependencies"
        GoMod["go.mod"]:::config
        GoSum["go.sum"]:::config
    end

    %% Click Events
    click CLI "https://github.com/mrrootsec/assetviz/blob/main/main.go"
    click InputHandler "https://github.com/mrrootsec/assetviz/blob/main/main.go"
    click ParsingEngine "https://github.com/mrrootsec/assetviz/blob/main/main.go"
    click Visualization "https://github.com/mrrootsec/assetviz/blob/main/main.go"
    click OutputManager "https://github.com/mrrootsec/assetviz/blob/main/main.go"
    click GoMod "https://github.com/mrrootsec/assetviz/blob/main/go.mod"
    click GoSum "https://github.com/mrrootsec/assetviz/blob/main/go.sum"
    click TestData "https://github.com/mrrootsec/assetviz/tree/main/test_data/"

    %% Styles
    classDef cli fill:#f9e79f,stroke:#d35400,stroke-width:2px;
    classDef processing fill:#aed6f1,stroke:#2980b9,stroke-width:2px;
    classDef output fill:#a9dfbf,stroke:#27ae60,stroke-width:2px;
    classDef config fill:#e8daef,stroke:#8e44ad,stroke-width:2px;
    classDef data fill:#fceabb,stroke:#f39c12,stroke-width:2px;
```
