# prazzon/flexbox-labs architecture

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

- Interactive diagram: https://gitdiagram.com/prazzon/flexbox-labs
- Repository: https://github.com/prazzon/flexbox-labs

## Overview

##### Main Application Architecture

a) Frontend Layer (Top Level):
- Main layout component (app/layout.tsx)
- Two main routes: Flexbox and Grid playgrounds

b) Core Components Layer:
Create distinct sections for:
- Playground Components
- UI Components
- Header
- Sidebar Components
- Pages Components

##### State Management Layer
A Redux store section showing:
- Flexbox slice (flexboxSlice.ts)
- Grid slice (gridSlice.ts)
- Connection to components via hooks

##### Features and Services Layer
Create sections for:
- Settings Context
- Hooks Layer
- Utils Layer
- Data Layer

Use these specific visualization guidelines:

##### Component Hierarchy
**┌─ App Container ─────────────────────┐**
- ┌─ Header ─────────────────────────┐│

- ┘│
- ┌─ Main Content ──┐ ┌─ Sidebar ────┐│
- About      ││
- Playground    │ │ - Edit      ││
- Grid/Flexbox  │ │ - Layout    ││
- Items         │ │ - Save      ││
- Settings  ││
- ┘ └─────────────┘│
- ┘

##### State Management Details
**┌─ Redux Store ──────────┐**
- ┌─ Flexbox Slice ────┐│
- Container Config  ││
- Items Config      ││
- Layouts          ││
- ┘ │
- ┌─ Grid Slice ──────┐│
- Container Config ││
- Items Config     ││
- Layouts         ││
- ┘ │
- ┘

##### Key Integration Points
- Connections between UI components and hooks
- Data flow between playground and code generation
- Relationship between settings context and components

##### Technical Stack Indicators
- Next.js framework
- TypeScript
- SASS Modules
- Framer Motion
- Redux

- Blue: Core components
- Green: State management
- Yellow: Utils and helpers
- Purple: Context providers
- Gray: External services/libraries

Important Elements to Highlight:
##### Settings management

Keep the abstraction level focused on the main architectural components while showing the relationships between:
- UI Components
- State Management
- Feature Modules
- Helper Utilities

This will provide a clear understanding of how the application's various parts interact while maintaining the right balance between detail and clarity.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Legend"
        L1[Component]:::component
        L2[(Database)]:::database
        L3{Decision}:::decision
        L4([Service]):::service
        style Legend fill:#f5f5f5,stroke:#333
    end

    subgraph "Frontend Layer"
        Layout["Main Layout"]:::component
        click Layout "https://github.com/prazzon/Flexbox-Labs/blob/master/app/layout.tsx"
        
        subgraph "Routes"
            FlexboxRoute["Flexbox Route"]:::route
            GridRoute["Grid Route"]:::route
            click FlexboxRoute "https://github.com/prazzon/Flexbox-Labs/blob/master/app/(playground)/flexbox/page.tsx"
            click GridRoute "https://github.com/prazzon/Flexbox-Labs/blob/master/app/(playground)/grid/page.tsx"
        end
        
        subgraph "Core Components"
            Playground["Playground"]:::component
            Header["Header"]:::component
            Sidebar["Sidebar"]:::component
            UIComponents["UI Components"]:::component
            
            click Playground "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_components/Playground/Playground.tsx"
            click Header "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_components/Header/Header.tsx"
            click Sidebar "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_components/SideBar/SideBar.tsx"
            click UIComponents "https://github.com/prazzon/Flexbox-Labs/tree/master/app/_components/UI/"
        end
        
        subgraph "Page Components"
            FlexboxPage["Flexbox Page"]:::component
            GridPage["Grid Page"]:::component
            click FlexboxPage "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_components/Pages/Flexbox/FlexboxPage.tsx"
            click GridPage "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_components/Pages/Grid/GridPage.tsx"
        end
        
        subgraph "Sidebar Components"
            About["About"]:::component
            Edit["Edit"]:::component
            LayoutComp["Layout"]:::component
            Save["Save"]:::component
            Settings["Settings"]:::component
            
            click About "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_components/SideBar/About/About.tsx"
            click Edit "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_components/SideBar/Edit/Edit.tsx"
            click LayoutComp "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_components/SideBar/Layout/Layout.tsx"
            click Save "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_components/SideBar/Save/Save.tsx"
            click Settings "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_components/SideBar/Settings/Settings.tsx"
        end
    end
    
    subgraph "State Management"
        ReduxStore["Redux Store"]:::store
        FlexboxSlice["Flexbox Slice"]:::slice
        GridSlice["Grid Slice"]:::slice
        
        click ReduxStore "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_lib/store.ts"
        click FlexboxSlice "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_lib/features/flexbox/flexboxSlice.ts"
        click GridSlice "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_lib/features/grid/gridSlice.ts"
    end
    
    subgraph "Features Layer"
        SettingsContext["Settings Context"]:::context
        FlexboxHook["Flexbox Hook"]:::hook
        GridHook["Grid Hook"]:::hook
        
        click SettingsContext "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_context/SettingsContext.tsx"
        click FlexboxHook "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_hooks/useFlexbox.ts"
        click GridHook "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_hooks/useGrid.ts"
    end
    
    subgraph "Data Layer"
        FlexboxData["Flexbox Data"]:::data
        GridData["Grid Data"]:::data
        
        click FlexboxData "https://github.com/prazzon/Flexbox-Labs/tree/master/app/_data/flexbox/"
        click GridData "https://github.com/prazzon/Flexbox-Labs/tree/master/app/_data/grid/"
    end
    
    subgraph "Utils Layer"
        CodeGen["Code Generation"]:::util
        CSSConverter["CSS Converter"]:::util
        Formatters["Formatters"]:::util
        
        click CodeGen "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_utils/generateFullHtml.ts"
        click CSSConverter "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_utils/cssTailwindConverter.ts"
        click Formatters "https://github.com/prazzon/Flexbox-Labs/blob/master/app/_utils/formatters.ts"
    end

    %% Connections
    Layout --> FlexboxRoute & GridRoute
    FlexboxRoute --> FlexboxPage
    GridRoute --> GridPage
    FlexboxPage & GridPage --> Playground
    Playground --> UIComponents
    
    ReduxStore --> FlexboxSlice & GridSlice
    FlexboxSlice --> FlexboxHook
    GridSlice --> GridHook
    
    Sidebar --> About & Edit & LayoutComp & Save & Settings
    
    FlexboxHook --> FlexboxData
    GridHook --> GridData
    
    SettingsContext --> Settings
    
    %% Styles
    classDef component fill:#a8d1ff,stroke:#333
    classDef route fill:#ffcccb,stroke:#333
    classDef store fill:#c1f0c1,stroke:#333
    classDef slice fill:#d4edda,stroke:#333
    classDef context fill:#e6c3e6,stroke:#333
    classDef hook fill:#f8d7da,stroke:#333
    classDef data fill:#fff3cd,stroke:#333
    classDef util fill:#d1ecf1,stroke:#333
    classDef service fill:#ffeeba,stroke:#333
    classDef database fill:#d6d8db,stroke:#333
    classDef decision fill:#e2e3e5,stroke:#333
```
