# ctrlplusb/easy-peasy architecture

> Architecture diagram of the GitHub repository ctrlplusb/easy-peasy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ctrlplusb/easy-peasy
- Repository: https://github.com/ctrlplusb/easy-peasy

## Overview

##### Main Components

a) Core Library Components:
- Store Creation Layer
- Action Management System
- State Management Layer
- Computed Properties Engine
- Effects/Listeners System
- Persistence Layer
- Debug/DevTools Integration

b) Integration Components:
- React Bindings
- Redux Integration
- Provider System
- Hooks Interface

##### Architectural Relationships

**Application Layer**
- ↑↓
**React Integration Layer (Hooks & Provider)**
- ↑↓
**Easy Peasy Core**
- ↑↓
**Redux Foundation**

##### Specific Implementation Details

- Rectangles (Blue): Core features (Store, Actions, State)
- Hexagons (Green): Integration points (React Hooks, Provider)
- Diamonds (Orange): Processing units (Computed Properties, Effects)
- Rounded Rectangles (Gray): Development Tools

##### Data Flow Representation

- Store ↔ React Components (via Hooks)
- Actions ↔ State Updates
- Computed Properties ↔ State
- Effects ↔ External Systems

##### Key Elements to Highlight

a) Store Layer:
- Model Definition
- Action Creators
- State Container
- Computed Properties

b) React Integration:
- StoreProvider
- useStoreState
- useStoreActions
- useStore

c) Features Layer:
- Persistence
- Hot Reloading
- DevTools
- Testing Utils

##### Implementation Details

- Proper labeling of all components
- Flow direction indicators
- Version compatibility notes
- Integration points with external systems

##### Notes for Scale

- Global Store Pattern
- Context Store Pattern
- Local Store Pattern

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Application Layer"
        RC[React Components]
    end

    subgraph "React Integration Layer"
        SP["Store Provider"]:::react
        RH["React Hooks"]:::react
        LH["Local Store Hooks"]:::react
    end

    subgraph "Easy Peasy Core"
        direction TB
        SCL["Store Creation"]:::core
        AMS["Action Management"]:::core
        SML["State Management"]:::core
        CPE["Computed Properties"]:::core
        ELS["Effects & Listeners"]:::core
        PL["Persistence Layer"]:::storage
        DT["Debug Tools"]:::tools
    end

    subgraph "Redux Foundation"
        RD[Redux Store]
        RDM[Redux Middleware]
    end

    subgraph "Development & Testing"
        TS["TypeScript Support"]:::dev
        TU["Testing Utils"]:::dev
        DOC["Documentation"]:::dev
    end

    %% Connections
    RC <--> SP
    SP <--> RH
    SP <--> LH
    RH <--> SCL
    LH <--> SCL
    SCL <--> AMS
    AMS <--> SML
    SML <--> CPE
    SML <--> ELS
    SML <--> PL
    SCL <--> RD
    RD <--> RDM
    DT <--> RD

    %% Click Events
    click SCL "https://github.com/ctrlplusb/easy-peasy/blob/master/src/create-store.js"
    click AMS "https://github.com/ctrlplusb/easy-peasy/blob/master/src/actions.js"
    click CPE "https://github.com/ctrlplusb/easy-peasy/blob/master/src/computed-properties.js"
    click ELS "https://github.com/ctrlplusb/easy-peasy/blob/master/src/effects.js"
    click PL "https://github.com/ctrlplusb/easy-peasy/blob/master/src/persistence.js"
    click DT "https://github.com/ctrlplusb/easy-peasy/blob/master/src/constants.js"
    click RH "https://github.com/ctrlplusb/easy-peasy/blob/master/src/hooks.js"
    click SP "https://github.com/ctrlplusb/easy-peasy/blob/master/src/provider.js"
    click LH "https://github.com/ctrlplusb/easy-peasy/blob/master/src/use-local-store.js"
    click SML "https://github.com/ctrlplusb/easy-peasy/blob/master/src/create-reducer.js"
    click TS "https://github.com/ctrlplusb/easy-peasy/tree/master/tests/typescript"
    click TU "https://github.com/ctrlplusb/easy-peasy/tree/master/tests/testing"
    click DOC "https://github.com/ctrlplusb/easy-peasy/tree/master/website/docs/docs/api"

    %% Styling
    classDef core fill:#2374ab,stroke:#2374ab,color:#fff
    classDef react fill:#61dafb,stroke:#61dafb,color:#000
    classDef storage fill:#8338ec,stroke:#8338ec,color:#fff
    classDef tools fill:#ff9f1c,stroke:#ff9f1c,color:#000
    classDef dev fill:#e9ecef,stroke:#e9ecef,color:#000

    %% Legend
    subgraph Legend
        C1["Core Components"]:::core
        R1["React Integration"]:::react
        S1["Storage"]:::storage
        T1["Tools"]:::tools
        D1["Development"]:::dev
    end
```
