# uiwjs/json-viewer architecture

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

- Interactive diagram: https://gitdiagram.com/uiwjs/json-viewer
- Repository: https://github.com/uiwjs/json-viewer

## Overview

##### Main Components

a. Client-Side Application Layer:
- React Application Container
- JSON Editor Component
- JSON Preview/Viewer Component
- URL Parameter Handler
- State Management

b. External Integrations:
- GitHub Integration (for sharing and deployment)
- Browser URL System (for parameter handling)

**[Client Browser]**

- ▼
**[React Application Container]**

- [URL Parameter Handler]

- Handles: hidenheader, corner, cornerhref, view, json

- [JSON Editor Component]

- Features: Input handling, Syntax validation

- [JSON Preview Component]

- Features: Tree view, Pretty print

##### Technical Stack Elements to Highlight

- React (main framework)
- TypeScript (noted by .tsx files)
- CSS Modules (noted by .module.css)
- GitHub Actions (for CI/CD)

##### Implementation Details

- Modular component structure
- State flow between editor and preview components
- How URL parameters affect the application state

##### Additional Elements

- Version control integration points
- Build/deployment flow through GitHub Actions

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
    end

    subgraph "React Application"
        AppContainer["React Application Container"]:::react
        click AppContainer "https://github.com/uiwjs/json-viewer/blob/main/src/app/App.tsx"
        
        subgraph "Core Components"
            Editor["JSON Editor Component"]:::react
            Preview["JSON Preview Component"]:::react
            URLHandler["URL Parameter Handler"]:::utility
        end

        subgraph "Configuration"
            TSConfig["TypeScript Config"]:::config
            click TSConfig "https://github.com/uiwjs/json-viewer/blob/main/tsconfig.json"
            BuildConfig["Build Config"]:::config
            click BuildConfig "https://github.com/uiwjs/json-viewer/blob/main/.kktrc.ts"
            PackageConfig["Package Config"]:::config
            click PackageConfig "https://github.com/uiwjs/json-viewer/blob/main/package.json"
        end

        subgraph "Entry Points"
            IndexTS["Application Entry"]:::entry
            click IndexTS "https://github.com/uiwjs/json-viewer/blob/main/src/index.tsx"
            IndexHTML["HTML Entry"]:::entry
            click IndexHTML "https://github.com/uiwjs/json-viewer/blob/main/public/index.html"
        end

        subgraph "Styling"
            AppCSS["App Styles"]:::styles
            click AppCSS "https://github.com/uiwjs/json-viewer/blob/main/src/app/App.module.css"
            GlobalCSS["Global Styles"]:::styles
            click GlobalCSS "https://github.com/uiwjs/json-viewer/blob/main/src/index.css"
        end
    end

    subgraph "External Services"
        GitHub["GitHub Integration"]:::external
        click GitHub "https://github.com/uiwjs/json-viewer/blob/main/.github/workflows/ci.yml"
    end

    %% Relationships
    Browser --> AppContainer
    AppContainer --> Editor
    AppContainer --> Preview
    AppContainer --> URLHandler
    
    URLHandler -- "Parameters" --> Editor
    URLHandler -- "Parameters" --> Preview
    Editor -- "JSON Data" --> Preview

    %% Configuration Dependencies
    TSConfig -.-> AppContainer
    BuildConfig -.-> AppContainer
    PackageConfig -.-> AppContainer
    
    %% Entry Point Dependencies
    IndexTS --> AppContainer
    IndexHTML --> Browser
    
    %% Styling Dependencies
    AppCSS --> AppContainer
    GlobalCSS --> AppContainer
    
    %% External Integration
    GitHub -.-> AppContainer

    %% Styles
    classDef react fill:#61dafb,stroke:#000,stroke-width:2px
    classDef utility fill:#f9f9f9,stroke:#000
    classDef config fill:#ffe4b5,stroke:#000
    classDef entry fill:#98fb98,stroke:#000
    classDef styles fill:#ff69b4,stroke:#000
    classDef external fill:#deb887,stroke:#000

    %% Legend
    subgraph Legend
        L1["React Components"]:::react
        L2["Utility Services"]:::utility
        L3["Configuration Files"]:::config
        L4["Entry Points"]:::entry
        L5["Styling"]:::styles
        L6["External Services"]:::external
    end
```
