# roechsli/feed-the-llama architecture

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

- Interactive diagram: https://gitdiagram.com/roechsli/feed-the-llama
- Repository: https://github.com/roechsli/feed-the-llama

## Overview

**Client Layer (Browser) → Next.js Application Layer → Static Assets/Public**

##### Detailed Component Breakdown

- Inside this container, create three main sections:
1. Pages/Routes (showing /generate, /statistics, and root route)
2. Components Layer
3. Utilities & Hooks Layer

- Main UI components:
- Game Rules Dialog
- Sortable Data Table
- Guess Input
- Math Equation Input Mask

C. State Management (Right side):
- Local Storage Integration (from useLocalStorage hook)
- States Management (from states.tsx)
- To the components that utilize them

D. Utility Services (Left side):
- Utility functions:
- Linear State Generator
- Random State Generator
- General Utils

##### Data Flow Indicators

- Client-server interaction
- State updates
- Component relationships
- Data flow between utilities and components

##### Technical Details

Annotations for:
- TypeScript integration
- CSS modules
- Component library integration
- Build optimization features

##### Infrastructure Layer (Next.js Core)

Important Elements to Highlight:
- App Router architecture
- Client-side interactivity points
- State management flow
- Data persistence strategy

Keep the following in mind:
- Version numbers for major dependencies
- Build/deployment flow if relevant

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Browser"]
        Browser["Web Browser"]:::client
    end

    subgraph AppRouter["Next.js App Router"]
        Layout["Root Layout"]:::server
        click Layout "https://github.com/roechsli/feed-the-llama/blob/main/src/app/layout.tsx"
        
        subgraph Pages["Pages Layer"]
            direction TB
            Home["Home Page"]:::page
            click Home "https://github.com/roechsli/feed-the-llama/blob/main/src/app/page.tsx"
            Generate["Generate Page"]:::page
            click Generate "https://github.com/roechsli/feed-the-llama/blob/main/src/app/generate/page.tsx"
            Statistics["Statistics Page"]:::page
            click Statistics "https://github.com/roechsli/feed-the-llama/blob/main/src/app/statistics/page.tsx"
        end
    end

    subgraph Components["Components Layer"]
        direction TB
        subgraph UIComponents["UI Components"]
            direction TB
            Button["Button"]:::ui
            click Button "https://github.com/roechsli/feed-the-llama/blob/main/src/components/ui/button.tsx"
            Dialog["Dialog"]:::ui
            click Dialog "https://github.com/roechsli/feed-the-llama/blob/main/src/components/ui/dialog.tsx"
            Input["Input"]:::ui
            click Input "https://github.com/roechsli/feed-the-llama/blob/main/src/components/ui/input.tsx"
            Table["Table"]:::ui
            click Table "https://github.com/roechsli/feed-the-llama/blob/main/src/components/ui/table.tsx"
            Logo["Logo"]:::ui
            click Logo "https://github.com/roechsli/feed-the-llama/blob/main/src/components/ui/logo-text.tsx"
        end

        subgraph FeatureComponents["Feature Components"]
            direction TB
            Confetti["Confetti"]:::feature
            click Confetti "https://github.com/roechsli/feed-the-llama/blob/main/src/components/Confetti.tsx"
            GameRules["Game Rules Dialog"]:::feature
            click GameRules "https://github.com/roechsli/feed-the-llama/blob/main/src/components/game-rules-dialog.tsx"
            GuessInput["Guess Input"]:::feature
            click GuessInput "https://github.com/roechsli/feed-the-llama/blob/main/src/components/guess-input.tsx"
            DataTable["Data Table"]:::feature
            click DataTable "https://github.com/roechsli/feed-the-llama/blob/main/src/components/SortableDataTable.tsx"
        end
    end

    subgraph State["State & Utils Layer"]
        direction TB
        MainState["Main State"]:::state
        click MainState "https://github.com/roechsli/feed-the-llama/blob/main/src/app/states/states.tsx"
        LocalStorage["Local Storage Hook"]:::state
        click LocalStorage "https://github.com/roechsli/feed-the-llama/blob/main/src/hooks/useLocalStorage.ts"
        
        subgraph Utils["Utilities"]
            direction TB
            MainUtils["Main Utils"]:::util
            click MainUtils "https://github.com/roechsli/feed-the-llama/blob/main/src/lib/utils.ts"
            LinearState["Linear State Utils"]:::util
            click LinearState "https://github.com/roechsli/feed-the-llama/blob/main/src/app/utils/get-linear-state.tsx"
            RandomState["Random State Utils"]:::util
            click RandomState "https://github.com/roechsli/feed-the-llama/blob/main/src/app/utils/get-random-state.tsx"
        end
    end

    subgraph Assets["Assets & Config"]
        direction TB
        GlobalCSS["Global Styles"]:::asset
        click GlobalCSS "https://github.com/roechsli/feed-the-llama/blob/main/src/app/globals.css"
        TailwindConfig["Tailwind Config"]:::asset
        click TailwindConfig "https://github.com/roechsli/feed-the-llama/blob/main/tailwind.config.ts"
        Fonts["Font Optimization"]:::asset
        click Fonts "https://github.com/roechsli/feed-the-llama/tree/main/src/app/fonts"
    end

    Browser --> Layout
    Layout --> Pages
    Pages --> Components
    Components --> State
    State --> Assets

    %% Styling
    classDef client fill:#2196F3,stroke:#1565C0,color:white
    classDef server fill:#4CAF50,stroke:#388E3C,color:white
    classDef page fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef ui fill:#00BCD4,stroke:#0097A7,color:white
    classDef feature fill:#FF9800,stroke:#F57C00,color:white
    classDef state fill:#F44336,stroke:#D32F2F,color:white
    classDef util fill:#795548,stroke:#5D4037,color:white
    classDef asset fill:#607D8B,stroke:#455A64,color:white

    %% Legend
    subgraph Legend
        direction TB
        L1["Client-Side"]:::client
        L2["Server-Side"]:::server
        L3["Pages"]:::page
        L4["UI Components"]:::ui
        L5["Feature Components"]:::feature
        L6["State Management"]:::state
        L7["Utilities"]:::util
        L8["Assets & Config"]:::asset
    end
```
