# dmsammusic/unit-converters architecture

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

- Interactive diagram: https://gitdiagram.com/dmsammusic/unit-converters
- Repository: https://github.com/dmsammusic/unit-converters

## Overview

##### Project Type Analysis
This is an open-source TypeScript library focused on unit conversions. It's a modular, utility-based project with clear separation of concerns for different conversion types.

##### Key Components

A. Core Components Layer:
- Main.ts as the entry point
- TypeScript configuration and build system

B. Converter Modules Layer:
- Area Converter
- Length Converter
- Mass Converter
- Speed Converter
- Temperature Converter
- Time Converter
- Volume Converter

C. Testing Layer:
Jest testing infrastructure parallel to the main components

**[Use this layout structure]**

**┌─ Build & Config Layer ─┐**
- TypeScript | Jest      │
- ┬────────────┘
- ↓
**┌─ Core Layer ──────────┐**
- main.ts           │
- ┬────────────┘
- ↓
**┌─ Converters Layer ────┐**
- ┌─────┐ ┌─────┐ ┌────┐│
- Area │ │Mass │ │Time││
- ┘ └─────┘ └────┘│
- ┌─────┐ ┌─────┐ ┌────┐│
- Speed│ │Temp │ │Vol.││
- ┘ └─────┘ └────┘│
- ┬────────────┘
- ↓
**┌─ Testing Layer ───────┐**
- Jest Test Suites     │
- ┘

##### Additional Details

A. Module Relationships:
- How each converter module is independent
- Relationship between spec files and their implementations
- Connection to the main.ts entry point

B. External Interfaces:
- Npm package interface
- TypeScript type definitions
- Testing framework integration

##### Implementation Notes

- Version information and supported unit types
- Extensibility points for new converters

##### Key Architectural Aspects to Highlight

- Modular design with independent converters
- Type-safe implementation using TypeScript
- Test-driven development approach
- Easy extensibility for new unit types
- Clear separation of concerns

Remember to include a note about the build process and how the TypeScript compilation flows from source to distribution, as this is crucial for understanding the deployment architecture.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef config fill:#gray,stroke:#333,stroke-width:2px
    classDef core fill:#blue,stroke:#333,stroke-width:2px
    classDef converter fill:#green,stroke:#333,stroke-width:2px
    classDef testing fill:#orange,stroke:#333,stroke-width:2px

    %% Build & Config Layer
    subgraph ConfigLayer["Build & Config Layer"]
        TS["TypeScript Config"]
        Jest["Jest Config"]
    end
    click TS "https://github.com/dmsammusic/unit-converters/blob/main/tsconfig.json"
    click Jest "https://github.com/dmsammusic/unit-converters/blob/main/jest.config.ts"

    %% Core Layer
    subgraph CoreLayer["Core Layer"]
        Main["main.ts"]
    end
    click Main "https://github.com/dmsammusic/unit-converters/blob/main/src/main.ts"

    %% Converters Layer
    subgraph ConvertersLayer["Converters Layer"]
        Area["Area Converter"]
        Length["Length Converter"]
        Mass["Mass Converter"]
        Speed["Speed Converter"]
        Temp["Temperature Converter"]
        Time["Time Converter"]
        Volume["Volume Converter"]
    end
    click Area "https://github.com/dmsammusic/unit-converters/blob/main/src/converters/area/area-converter.ts"
    click Length "https://github.com/dmsammusic/unit-converters/blob/main/src/converters/length/length-converter.ts"
    click Mass "https://github.com/dmsammusic/unit-converters/blob/main/src/converters/mass/mass-converter.ts"
    click Speed "https://github.com/dmsammusic/unit-converters/blob/main/src/converters/speed/speed-converter.ts"
    click Temp "https://github.com/dmsammusic/unit-converters/blob/main/src/converters/temp/temperature-converter.ts"
    click Time "https://github.com/dmsammusic/unit-converters/blob/main/src/converters/time/time-converter.ts"
    click Volume "https://github.com/dmsammusic/unit-converters/blob/main/src/converters/volume/volume-converter.ts"

    %% Testing Layer
    subgraph TestingLayer["Testing Layer"]
        AreaTest["Area Tests"]
        LengthTest["Length Tests"]
        MassTest["Mass Tests"]
        SpeedTest["Speed Tests"]
        TempTest["Temperature Tests"]
        TimeTest["Time Tests"]
        VolumeTest["Volume Tests"]
    end
    click AreaTest "https://github.com/dmsammusic/unit-converters/blob/main/src/converters/area/area-converter.spec.ts"
    click LengthTest "https://github.com/dmsammusic/unit-converters/blob/main/src/converters/length/length.converter.spec.ts"
    click MassTest "https://github.com/dmsammusic/unit-converters/blob/main/src/converters/mass/mass-converter.spec.ts"
    click SpeedTest "https://github.com/dmsammusic/unit-converters/blob/main/src/converters/speed/speed-converter.spec.ts"
    click TempTest "https://github.com/dmsammusic/unit-converters/blob/main/src/converters/temp/temperature-converter.spec.ts"
    click TimeTest "https://github.com/dmsammusic/unit-converters/blob/main/src/converters/time/time-converter-spec.ts"
    click VolumeTest "https://github.com/dmsammusic/unit-converters/blob/main/src/converters/volume/volume-converter.spec.ts"

    %% Relationships
    ConfigLayer --> CoreLayer
    CoreLayer --> ConvertersLayer
    Area -.-> AreaTest
    Length -.-> LengthTest
    Mass -.-> MassTest
    Speed -.-> SpeedTest
    Temp -.-> TempTest
    Time -.-> TimeTest
    Volume -.-> VolumeTest

    %% Apply styles
    class TS,Jest config
    class Main core
    class Area,Length,Mass,Speed,Temp,Time,Volume converter
    class AreaTest,LengthTest,MassTest,SpeedTest,TempTest,TimeTest,VolumeTest testing
```
