# pitch-io/uix architecture

> Architecture diagram of the GitHub repository pitch-io/uix, 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/pitch-io/uix
- Repository: https://github.com/pitch-io/uix

## Overview

##### Main Components Structure

a) Core Library Components:
- Compiler subsystem (from /core/src/uix/compiler)
- Hooks system (from /core/src/uix/hooks)
- React Integration Layer
- State Management

b) DOM Rendering Layer:
- Client-side rendering
- Server-side rendering capabilities
- DOM-specific optimizations

##### Key Relationships to Highlight

a) External Dependencies:
- React.js (v19.0.0)
- React DOM
- ClojureScript Runtime

b) Internal Flow:
- Component Compilation Pipeline
- Hook System Integration
- State Management Flow
- Server/Client Rendering Paths

##### Specific Elements

**[React.js Ecosystem] ←→ [UIx Core]**
- ↑                   ↓
- [React DOM]  ←→    [UIx DOM]
- ↓                   ↓
**[Browser/Server Runtime]  [ClojureScript App]**

##### Important Subsystems to Detail

a) Compiler Pipeline:
**[ClojureScript Code] → [UIx Compiler] → [React Elements]**

b) Hook System:
**[UIx Hooks API] → [React Hooks] → [State/Effects]**

##### Development Tools Integration

A separate section showing:
- Hot Reloading Support
- React DevTools Integration
- Code Linting
- Testing Infrastructure

##### The developer experience tooling

Keep the abstraction level high enough to show the overall architecture while including enough detail to understand the key interactions between components. Focus on showing how UIx provides an idiomatic ClojureScript interface while maintaining direct access to React's features.

Remember to include a notes section explaining any performance optimizations, compilation strategies, and key architectural decisions that might not be immediately apparent from the visual representation.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph External ["External Dependencies"]
        React["React.js v19.0.0"]:::external
        ReactDOM["React DOM"]:::external
        CLJS["ClojureScript Runtime"]:::external
    end

    subgraph Core ["UIx Core"]
        Compiler["Compiler Subsystem"]:::core
        CompilerMain["Main Compiler"]:::core
        CompilerAOT["AOT Compilation"]:::core
        CompilerAttrs["Attributes Handler"]:::core
        
        Hooks["Hooks System"]:::core
        HooksImpl["Core Hooks Implementation"]:::core
        HooksMacros["Hooks Macros"]:::core
        
        ReactInteg["React Integration Layer"]:::core
        ReFrameInteg["Re-frame Integration"]:::core
        
        State["State Management"]:::core
    end

    subgraph DOM ["DOM Rendering Layer"]
        ClientRender["Client-side Rendering"]:::dom
        ServerRender["Server-side Rendering"]:::dom
        DOMOpt["DOM Optimizations"]:::dom
    end

    subgraph DevTools ["Development Tools"]
        HotReload["Hot Reloading"]:::dev
        DevToolsInteg["React DevTools Integration"]:::dev
        Linting["Code Linting"]:::dev
        Testing["Testing Infrastructure"]:::dev
    end

    %% Core relationships
    Compiler --> CompilerMain
    Compiler --> CompilerAOT
    Compiler --> CompilerAttrs
    
    Hooks --> HooksImpl
    Hooks --> HooksMacros
    
    %% External dependencies
    React --> ReactInteg
    ReactDOM --> ClientRender
    ReactDOM --> ServerRender
    CLJS --> Compiler
    
    %% Core to DOM flow
    ReactInteg --> ClientRender
    ReactInteg --> ServerRender
    
    %% Development tools connections
    HotReload --> ReactInteg
    DevToolsInteg --> ReactInteg
    Linting --> Compiler
    Testing --> ReactInteg

    %% Click events for component mapping
    click Compiler "https://github.com/pitch-io/uix/tree/master/core/src/uix/compiler/"
    click CompilerMain "https://github.com/pitch-io/uix/blob/master/core/src/uix/compiler/alpha.cljs"
    click CompilerAOT "https://github.com/pitch-io/uix/blob/master/core/src/uix/compiler/aot.cljs"
    click CompilerAttrs "https://github.com/pitch-io/uix/blob/master/core/src/uix/compiler/attributes.cljs"
    click Hooks "https://github.com/pitch-io/uix/tree/master/core/src/uix/hooks/"
    click HooksImpl "https://github.com/pitch-io/uix/blob/master/core/src/uix/hooks/alpha.cljs"
    click HooksMacros "https://github.com/pitch-io/uix/blob/master/core/src/uix/hooks/alpha.clj"
    click ClientRender "https://github.com/pitch-io/uix/blob/master/dom/src/uix/dom.cljs"
    click ServerRender "https://github.com/pitch-io/uix/blob/master/dom/src/uix/dom/server.cljs"
    click HotReload "https://github.com/pitch-io/uix/blob/master/core/src/uix/dev.cljs"
    click Linting "https://github.com/pitch-io/uix/blob/master/core/src/uix/linter.clj"
    click Testing "https://github.com/pitch-io/uix/blob/master/core/test/uix/test_runner.cljs"
    click ReactInteg "https://github.com/pitch-io/uix/blob/master/core/src/uix/core.cljs"
    click ReFrameInteg "https://github.com/pitch-io/uix/blob/master/core/src/uix/re_frame.cljs"

    %% Styling
    classDef core fill:#2b6cb0,stroke:#1a4971,color:white
    classDef external fill:#48bb78,stroke:#2f855a,color:white
    classDef dom fill:#ed8936,stroke:#c05621,color:white
    classDef dev fill:#805ad5,stroke:#553c9a,color:white

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["External Dependencies"]:::external
        L3["DOM Layer"]:::dom
        L4["Development Tools"]:::dev
    end
```
