# grammyjs/link-checker architecture

> Architecture diagram of the GitHub repository grammyjs/link-checker, 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/grammyjs/link-checker
- Repository: https://github.com/grammyjs/link-checker

## Overview

##### Main Components Identification

The system should be represented with these key components:

a) Input Sources
- Website Documentation (Markdown files)
- TSDoc/JSDoc Documentation
- GitHub Repository Content

b) Core Processing Components
- Link Parser
- Link Validator
- Issue Detector
- Auto-fixer
- GitHub API Integration

c) Output Handlers
- Issue Reporter
- Fix Applier

##### Component Relationships

**Input Sources → Link Parser → Link Validator → Issue Detector → Output Handlers**
- ↕
- GitHub API Integration

##### Detailed Component Breakdown

a) Input Sources (Blue):
- Markdown Files Processor (website.ts)
- TSDoc Processor (tsdoc.ts)
- File System Interface (deps/std/*)

b) Core Processing (Green):
- Link Parser
- Markdown Parser (deps/markdown-it/*)
- DOM Parser (deps/deno_dom.ts)
- Link Validator (group_links.ts)
- URL Validator
- Anchor Validator
- Extension Validator

c) GitHub Integration (Purple):
- Octokit App Integration (deps/octokit_app.ts)
- Content API Handler
- Rate Limiting Handler

d) Issue Management (Orange):
- Issue Detector (issues.ts)
- Auto-fixer
- Cache Manager (Debug Mode)

e) CLI Interface (Gray):
- Website CLI (website_cli.ts)
- TSDoc CLI (tsdoc_cli.ts)

##### Additional Elements

Supporting elements:

- Error handling flows
- Configuration options from CLI
- Environment variable dependencies
- File system interactions

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        WD["Website Documentation"]:::input
        TD["TSDoc Documentation"]:::input
        GR["GitHub Repository"]:::input
    end

    subgraph "Core Processing"
        LP["Link Parser"]:::core
        DOM["DOM Parser"]:::core
        LV["Link Validator"]:::core
        ID["Issue Detector"]:::core
        AF["Auto-fixer"]:::core
    end

    subgraph "Document Processors"
        WP["Website Processor"]:::processor
        TP["TSDoc Processor"]:::processor
        FSI["File System Interface"]:::processor
    end

    subgraph "GitHub Integration"
        GH["GitHub API"]:::github
        OA["Octokit App"]:::github
        RL["Rate Limiter"]:::github
    end

    subgraph "CLI Layer"
        WC["Website CLI"]:::cli
        TC["TSDoc CLI"]:::cli
    end

    subgraph "Configuration"
        CF["Constants"]:::config
        TY["Types"]:::config
    end

    subgraph "Output Handlers"
        IR["Issue Reporter"]:::output
        FA["Fix Applier"]:::output
    end

    subgraph "Utilities"
        UF["URL Fetcher"]:::util
        MA["Markdown Anchor"]:::util
        UT["Utilities"]:::util
    end

    %% Relationships
    WD --> WP
    TD --> TP
    GR --> FSI

    WP --> LP
    TP --> LP
    FSI --> LP

    LP --> DOM
    DOM --> LV
    LV --> ID
    ID --> AF
    AF --> FA

    LV <--> GH
    GH <--> OA
    OA <--> RL

    WC --> WP
    TC --> TP

    CF --> LP
    CF --> LV
    TY --> LP
    TY --> LV

    ID --> IR

    UF --> LV
    MA --> LP
    UT --> LP
    UT --> LV

    %% Styles
    classDef input fill:#a8d1f0
    classDef core fill:#90EE90
    classDef processor fill:#FFB6C1
    classDef github fill:#DDA0DD
    classDef cli fill:#D3D3D3
    classDef config fill:#F0E68C
    classDef output fill:#FFA07A
    classDef util fill:#98FB98

    %% Click Events
    click WP "https://github.com/grammyjs/link-checker/blob/main/website.ts"
    click TP "https://github.com/grammyjs/link-checker/blob/main/tsdoc.ts"
    click LP "https://github.com/grammyjs/link-checker/blob/main/deps/markdown-it/mod.ts"
    click DOM "https://github.com/grammyjs/link-checker/blob/main/deps/deno_dom.ts"
    click LV "https://github.com/grammyjs/link-checker/blob/main/group_links.ts"
    click OA "https://github.com/grammyjs/link-checker/blob/main/deps/octokit_app.ts"
    click IR "https://github.com/grammyjs/link-checker/blob/main/issues.ts"
    click WC "https://github.com/grammyjs/link-checker/blob/main/website_cli.ts"
    click TC "https://github.com/grammyjs/link-checker/blob/main/tsdoc_cli.ts"
    click FSI "https://github.com/grammyjs/link-checker/blob/main/deps/std/path.ts"
    click TY "https://github.com/grammyjs/link-checker/blob/main/types.ts"
    click CF "https://github.com/grammyjs/link-checker/blob/main/constants.ts"
    click UF "https://github.com/grammyjs/link-checker/blob/main/fetch.ts"
    click MA "https://github.com/grammyjs/link-checker/blob/main/deps/markdown-it/anchor.ts"
    click UT "https://github.com/grammyjs/link-checker/blob/main/utilities.ts"
```
