# duydev/vietnamese-conversion architecture

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

- Interactive diagram: https://gitdiagram.com/duydev/vietnamese-conversion
- Repository: https://github.com/duydev/vietnamese-conversion

## Overview

Key Components to Include:

##### Core Components
- Input Handler (handles incoming text and source charset)
- Charset Converter Engine
- Output Formatter
- Supported Charsets (Unicode, VNI, TCVN3, VIQR)

##### Component Details

a. Input Layer:
- Two entry points:
- Class-based interface (VietnameseConversion class)
- Functional interface (direct conversion functions)
- Input validation for text and charset type

b. Processing Layer:
- Charset Registry (from charsets.ts)
- Conversion Engine (core logic)
- Character Mapping System
- Transformation Rules

c. Output Layer:
- Output Formatter
- Result Validation

##### Specific Elements

a. Components:
- Use rounded rectangles for entry points

b. Connections:

##### Technical Details to Highlight
- TypeScript interfaces (from VietnameseConversionInterface.ts)
- Character set definitions
- Conversion functions
- Type definitions (from types.ts)

##### Additional Notes
- Both the OOP and functional pathways
- Where type checking occurs
- Error handling points

Remember to:
- Version/build workflow indicators
- Test coverage points
- Where configuration is loaded
- Entry points for both npm and yarn installations

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Public API Layer"
        ClassAPI["Class-based API"]:::api
        FuncAPI["Functional API"]:::api
        EntryPoint["Main Entry Point"]:::api
    end

    subgraph "Conversion Core"
        ConvEngine["Conversion Engine"]:::core
        TypeSystem["Type System"]:::core
        ErrorHandler["Error Handler"]:::core
    end

    subgraph "Charset Mappings"
        CharsetDefs["Charset Definitions"]:::storage
        MappingStore["Mapping Storage"]:::storage
    end

    subgraph "Build & Testing"
        CI["CI/CD Pipeline"]:::build
        Tests["Test Suite"]:::build
        TSConfig["TypeScript Config"]:::build
    end

    %% Connections
    ClassAPI --> ConvEngine
    FuncAPI --> ConvEngine
    EntryPoint --> ClassAPI
    EntryPoint --> FuncAPI
    
    ConvEngine --> CharsetDefs
    ConvEngine --> MappingStore
    TypeSystem --> ConvEngine
    ConvEngine --> ErrorHandler
    
    Tests --> ClassAPI
    Tests --> FuncAPI
    CI --> Tests
    TSConfig --> ConvEngine

    %% Click Events
    click ClassAPI "https://github.com/duydev/vietnamese-conversion/blob/main/src/VietnameseConversion.ts"
    click FuncAPI "https://github.com/duydev/vietnamese-conversion/blob/main/src/functions.ts"
    click EntryPoint "https://github.com/duydev/vietnamese-conversion/blob/main/src/index.ts"
    click CharsetDefs "https://github.com/duydev/vietnamese-conversion/blob/main/src/charsets.ts"
    click TypeSystem "https://github.com/duydev/vietnamese-conversion/blob/main/src/VietnameseConversionInterface.ts"
    click CI "https://github.com/duydev/vietnamese-conversion/blob/main/.github/workflows/main.yml"
    click Tests "https://github.com/duydev/vietnamese-conversion/tree/main/tests"
    click TSConfig "https://github.com/duydev/vietnamese-conversion/blob/main/tsconfig.json"

    %% Styles
    classDef api fill:#2374ab,stroke:#2374ab,color:white
    classDef core fill:#48a9a6,stroke:#48a9a6,color:white
    classDef storage fill:#e4cc37,stroke:#e4cc37,color:black
    classDef build fill:#999999,stroke:#999999,color:white

    %% Legend
    subgraph Legend
        API["API Components"]:::api
        Core["Core Components"]:::core
        Storage["Storage Components"]:::storage
        Build["Build Components"]:::build
    end
```
