# headsrooms/configclasses architecture

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

- Interactive diagram: https://gitdiagram.com/headsrooms/configclasses
- Repository: https://github.com/headsrooms/configclasses

## Overview

##### Main Components

a) Core Components:
- Configuration Decorator (@configclass)
- Config Loaders System
- Config Dumpers System
- Type Conversion System
- Exception Handling System

b) File Format Support:
- ENV files (.env)
- YAML files (.yaml)
- TOML files (.toml)
- INI files (.ini)
- JSON files (.json)

**┌─ User Application Code ─┐**
- @configclass           │
- Class Definitions      │
- ┬────────────┘

**┌─ Config Processing Layer ──┐**
- ┌─ Loaders ─┐ ┌─ Dumpers ┐│
- .env      │ │.env      ││
- .yaml     │ │.yaml     ││
- .toml     │ │.toml     ││
- .ini      │ │.ini      ││
- .json     │ │.json     ││
- ┘ └──────────┘│
- ┘

**┌─ Core Services ──────────┐**
- Type Conversion         │
- Environment Variables   │
- File System Access      │
- ┘

##### Data Flow Representation

- Configuration Definition → Config Processing
- Config Processing → File System / Environment
- File System / Environment → Config Processing
- Config Processing → Type Conversion
- Type Conversion → Final Config Object

##### Integration Points

How the system integrates with:
- Environment Variables
- File System
- Python Type System
- User's Application Code

##### Technical Details

- Python 3.8+ requirement
- Optional dependencies for different file formats
- Support for nested configuration classes
- Type conversion capabilities
- Prefix support

##### The extensible nature of the format support

Remember to show both the static structure (components and their relationships) and the dynamic behavior (how configuration data flows through the system) in separate views if necessary.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef userInterface fill:#b3d1ff,stroke:#333,stroke-width:2px
    classDef core fill:#98fb98,stroke:#333,stroke-width:2px
    classDef storage fill:#fff59d,stroke:#333,stroke-width:2px
    classDef error fill:#ffcdd2,stroke:#333,stroke-width:2px
    classDef fileFormat fill:#e1bee7,stroke:#333,stroke-width:2px

    %% User Interface Layer
    subgraph UserLayer["User Interface Layer"]
        UserApp["User Application Code"]:::userInterface
        ConfigDecorator["@configclass Decorator"]:::userInterface
        ExampleImpl["Example Implementation"]:::userInterface
    end

    %% Core Processing Layer
    subgraph CoreLayer["Core Processing Layer"]
        ConfigProcessor["Configuration Processor"]:::core
        TypeConversion["Type Conversion System"]:::core
        ExceptionHandler["Exception Handling"]:::core
        
        subgraph LoaderSystem["Loader System"]
            Loaders["Config Loaders"]:::core
            EnvLoader["ENV Loader"]:::core
            YamlLoader["YAML Loader"]:::core
            TomlLoader["TOML Loader"]:::core
            IniLoader["INI Loader"]:::core
            JsonLoader["JSON Loader"]:::core
        end
        
        subgraph DumperSystem["Dumper System"]
            Dumpers["Config Dumpers"]:::core
            EnvDumper["ENV Dumper"]:::core
            YamlDumper["YAML Dumper"]:::core
            TomlDumper["TOML Dumper"]:::core
            IniDumper["INI Dumper"]:::core
            JsonDumper["JSON Dumper"]:::core
        end
    end

    %% Storage Layer
    subgraph StorageLayer["Storage Layer"]
        EnvVars["Environment Variables"]:::storage
        FileSystem["File System"]:::storage
        
        subgraph ConfigFiles["Configuration Files"]
            EnvFile[".env Files"]:::fileFormat
            YamlFile[".yaml Files"]:::fileFormat
            TomlFile[".toml Files"]:::fileFormat
            IniFile[".ini Files"]:::fileFormat
            JsonFile[".json Files"]:::fileFormat
        end
    end

    %% Relationships
    UserApp --> ConfigDecorator
    ConfigDecorator --> ConfigProcessor
    ConfigProcessor --> TypeConversion
    ConfigProcessor --> ExceptionHandler
    ConfigProcessor --> Loaders
    ConfigProcessor --> Dumpers
    
    Loaders --> EnvLoader & YamlLoader & TomlLoader & IniLoader & JsonLoader
    Dumpers --> EnvDumper & YamlDumper & TomlDumper & IniDumper & JsonDumper
    
    EnvLoader --> EnvVars
    YamlLoader & TomlLoader & IniLoader & JsonLoader --> FileSystem
    
    EnvFile --> EnvLoader
    YamlFile --> YamlLoader
    TomlFile --> TomlLoader
    IniFile --> IniLoader
    JsonFile --> JsonLoader

    %% Click Events
    click ConfigDecorator "https://github.com/headsrooms/configclasses/blob/master/configclasses/configclasses.py"
    click Loaders "https://github.com/headsrooms/configclasses/blob/master/configclasses/loaders.py"
    click Dumpers "https://github.com/headsrooms/configclasses/blob/master/configclasses/dumpers.py"
    click ExceptionHandler "https://github.com/headsrooms/configclasses/blob/master/configclasses/exceptions.py"
    click TypeConversion "https://github.com/headsrooms/configclasses/blob/master/configclasses/helpers.py"
    click EnvFile "https://github.com/headsrooms/configclasses/blob/master/tests/test_files/.env"
    click YamlFile "https://github.com/headsrooms/configclasses/blob/master/tests/test_files/configclass.yaml"
    click TomlFile "https://github.com/headsrooms/configclasses/blob/master/tests/test_files/configclass.toml"
    click IniFile "https://github.com/headsrooms/configclasses/blob/master/tests/test_files/configclass.ini"
    click JsonFile "https://github.com/headsrooms/configclasses/blob/master/tests/test_files/configclass.json"
    click ExampleImpl "https://github.com/headsrooms/configclasses/blob/master/tests/example/example.py"

    %% Legend
    subgraph Legend
        UI["User Interface"]:::userInterface
        Core["Core Component"]:::core
        Storage["Storage"]:::storage
        Error["Error Handling"]:::error
        Format["File Format"]:::fileFormat
    end
```
