# mshafir/reactlit architecture

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

- Interactive diagram: https://gitdiagram.com/mshafir/reactlit
- Repository: https://github.com/mshafir/reactlit

## Overview

##### Main Components

The system architecture should be organized into these key areas:

a) Core Library Components:
- Hooks System
- View Definition System
- Plugin Architecture
- State Management
- Data Fetching Layer

b) Input Libraries:
- Vanilla Inputs
- Radix Inputs

c) Documentation & Examples:
- Documentation Site (Astro-based)
- Example Applications (Next.js-based)

**Layer 1 (Core):**

- @reactlit/core |
- View System   |
- State Hooks   |
- Plugins       |

- ↑
**Layer 2 (Input Libraries):**

- @reactlit/vanilla|     |  @reactlit/radix |
- Basic Inputs   |     | - Radix UI Based |

- ↑                        ↑
**Layer 3 (Applications):**

- Documentation   |     |    Examples      |
- (Astro Site)    |     |  (Next.js Apps)  |

##### Component Details

Core Library (@reactlit/core):
- Plugin architecture (data-fetching, layout)
- View definition system
- Utility functions

Input Libraries:
- Relationship between vanilla and radix components
- How they extend the core functionality
- Various input types available

Applications:
- How the documentation site consumes the libraries
- Example applications structure

##### Flow and Interactions

- Data flow between components
- Component dependencies
- Plugin integration points
- State management flow

##### Additional Elements

Include:
- Version information
- External dependencies (React, Radix UI)
- Build and compilation flow

##### Specific Implementation Details

- The procedural nature of the UI components
- How the library simplifies React development
- Plugin system architecture
- Integration points with React ecosystem

Remember to:
- Technical details but avoid overwhelming complexity
- Architectural decisions and patterns
- Clear separation of concerns between packages

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Core["@reactlit/core"]
        direction TB
        Hooks["Hooks System"]
        ViewDef["View Definition System"]
        Plugins["Plugin Architecture"]
        State["State Management"]
        DataFetch["Data Fetching Layer"]
        FormCore["Form Input Core"]
        Utils["Core Utilities"]
        
        Hooks --> ViewDef
        Plugins --> ViewDef
        State --> ViewDef
        DataFetch --> Plugins
        Utils --> ViewDef
        FormCore --> ViewDef
    end

    subgraph InputLibs["Input Libraries"]
        direction TB
        Vanilla["Vanilla Inputs"]
        Radix["Radix Inputs"]
    end

    subgraph Apps["Applications"]
        direction TB
        Docs["Documentation Site"]
        Examples["Example Applications"]
        
        subgraph DocContent["Documentation Content"]
            Guides["Guides"]
            APIRef["API Reference"]
            Layouts["Example Layouts"]
        end
        
        DocContent --> Docs
    end

    Core --> InputLibs
    InputLibs --> Apps

    %% Click events for component mapping
    click Hooks "https://github.com/mshafir/reactlit/tree/main/libs/core/src/hooks"
    click ViewDef "https://github.com/mshafir/reactlit/blob/main/libs/core/src/reactlit.tsx"
    click Plugins "https://github.com/mshafir/reactlit/tree/main/libs/core/src/plugins"
    click State "https://github.com/mshafir/reactlit/blob/main/libs/core/src/hooks/use-reactlit-state.ts"
    click DataFetch "https://github.com/mshafir/reactlit/blob/main/libs/core/src/plugins/data-fetching.ts"
    click Vanilla "https://github.com/mshafir/reactlit/tree/main/libs/vanilla/src/inputs"
    click Radix "https://github.com/mshafir/reactlit/tree/main/libs/radix/src/inputs"
    click Docs "https://github.com/mshafir/reactlit/tree/main/apps/reactlit-docs"
    click Examples "https://github.com/mshafir/reactlit/tree/main/apps/reactlit-examples"
    click Utils "https://github.com/mshafir/reactlit/tree/main/libs/core/src/utils"
    click Layouts "https://github.com/mshafir/reactlit/tree/main/apps/reactlit-docs/src/examples/layouts"
    click FormCore "https://github.com/mshafir/reactlit/blob/main/libs/core/src/inputs/form.input.tsx"
    click Guides "https://github.com/mshafir/reactlit/tree/main/apps/reactlit-docs/src/content/docs/guides"
    click APIRef "https://github.com/mshafir/reactlit/tree/main/apps/reactlit-docs/src/content/docs/reference"

    %% Styling
    classDef core fill:#2374ab,color:#fff
    classDef input fill:#2a9d8f,color:#fff
    classDef app fill:#e76f51,color:#fff
    classDef content fill:#f4a261,color:#fff

    class Hooks,ViewDef,Plugins,State,DataFetch,Utils,FormCore core
    class Vanilla,Radix input
    class Docs,Examples app
    class Guides,APIRef,Layouts,DocContent content
```
