# hafskjfha/kkuko-utils architecture

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

- Interactive diagram: https://gitdiagram.com/hafskjfha/kkuko-utils
- Repository: https://github.com/hafskjfha/kkuko-utils

## Overview

##### Project type and purpose
- This is a full-stack web application built with Next.js (using the app router), React, and Tailwind CSS.
- It provides user-facing tools (“kkuko-utils”) for word combination, word-list management, note retrieval, and other utilities, all backed by a Supabase (PostgreSQL) database.

##### File structure
- Top-level directories:
- app/ – Next.js “app router” directory with server & client components, layouts, pages, API routes
- lib/ – shared utility code (e.g. supabaseClient, business logic in CombinationsManager, DuemLaw, collections)
- public/ – static assets
- supabase/ – local Supabase CLI config
- store/ – Redux-style slice and store configuration
- components.json, tsconfig.json, next.config.ts, tailwind.config.ts – project configs
- app/api/ contains route.ts files that implement serverless API endpoints (get-note, get-words).
- app/components/ and app/components/ui/ hold reusable UI components.
- app/providers.tsx sets up global providers (probably Redux, theme).
- Manager-tool, word-combiner, release-note, words-docs subdirectories under app/ implement feature modules in a modular page/layout hierarchy.
- Configuration: Next.js config, Tailwind config, ESLint, environment types (env.d.ts), Supabase config.toml.

##### README
- Confirms Next.js/React/Tailwind on the frontend, Next.js server for backend API, Supabase/Postgres as the database, deployed on Vercel.
- Four high-level features: Word Combinator, Word List Organizer, Monthly Word Addition Tracker, Villain Word Board.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Client
    subgraph "Browser / Client"
        direction TB
        ClientUI["React Components & Tailwind CSS"]:::frontend
        ClientState["Redux Store / Context"]:::frontend
    end

    %% Next.js Server
    subgraph "Next.js Server (SSR + API Routes)"
        direction TB
        subgraph "SSR Pages & Layouts"
            direction TB
            Layout["app/layout.tsx"]:::backend
            HomePage["app/page.tsx"]:::backend
            ErrorPage["app/error.tsx"]:::backend
            NotFound["app/not-found.tsx"]:::backend
            click Layout "https://github.com/hafskjfha/kkuko-utils/blob/main/app/layout.tsx"
            click HomePage "https://github.com/hafskjfha/kkuko-utils/blob/main/app/page.tsx"
            click ErrorPage "https://github.com/hafskjfha/kkuko-utils/blob/main/app/error.tsx"
            click NotFound "https://github.com/hafskjfha/kkuko-utils/blob/main/app/not-found.tsx"
        end
        subgraph "Global UI Shell"
            direction TB
            Header["app/header.tsx"]:::backend
            Footer["app/footer.tsx"]:::backend
            GlobalsCSS["app/globals.css"]:::backend
            click Header "https://github.com/hafskjfha/kkuko-utils/blob/main/app/header.tsx"
            click Footer "https://github.com/hafskjfha/kkuko-utils/blob/main/app/footer.tsx"
            click GlobalsCSS "https://github.com/hafskjfha/kkuko-utils/blob/main/app/globals.css"
        end
        subgraph "Feature Modules"
            direction TB
            WordCombiner["Word Combinator Module"]:::backend
            ManagerTool["Manager Tool Module"]:::backend
            ReleaseNotes["Release Notes Module"]:::backend
            WordsDocs["Words Docs Module"]:::backend
            WordSearch["Word Search Utility"]:::backend
            Auth["Authentication Flow"]:::backend
            Profile["Profile Management"]:::backend
        end
        subgraph "API Routes"
            direction TB
            GetNote["app/api/get-note/route.ts"]:::backend
            GetWords["app/api/get-words/route.ts"]:::backend
            click GetNote "https://github.com/hafskjfha/kkuko-utils/blob/main/app/api/get-note/route.ts"
            click GetWords "https://github.com/hafskjfha/kkuko-utils/blob/main/app/api/get-words/route.ts"
        end
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer" 
        direction TB
        SupabaseClient["app/lib/supabaseClient.ts"]:::logic
        CombinationsMgr["app/lib/CombinationsManger.ts"]:::logic
        DuemLaw["app/lib/DuemLaw.ts"]:::logic
        Collections["app/lib/collections.ts"]:::logic
        click SupabaseClient "https://github.com/hafskjfha/kkuko-utils/blob/main/app/lib/supabaseClient.ts"
        click CombinationsMgr "https://github.com/hafskjfha/kkuko-utils/blob/main/app/lib/CombinationsManger.ts"
        click DuemLaw "https://github.com/hafskjfha/kkuko-utils/blob/main/app/lib/DuemLaw.ts"
        click Collections "https://github.com/hafskjfha/kkuko-utils/blob/main/app/lib/collections.ts"
    end

    %% Database
    SupabaseDB[(Supabase PostgreSQL)]:::database

    %% State Management Providers
    Providers["app/providers.tsx"]:::frontend
    click Providers "https://github.com/hafskjfha/kkuko-utils/blob/main/app/providers.tsx"

    %% Redux Store
    subgraph "State Management"
        direction TB
        Store["app/store/store.ts"]:::frontend
        Slice["app/store/slice.ts"]:::frontend
        click Store "https://github.com/hafskjfha/kkuko-utils/blob/main/app/store/store.ts"
        click Slice "https://github.com/hafskjfha/kkuko-utils/blob/main/app/store/slice.ts"
    end

    %% Connections
    ClientUI -->|"renders SSR pages"| Layout
    ClientUI -->|"client navigation"| HomePage
    ClientUI -->|"uses UI Shell"| Header
    ClientState -->|provides| ClientUI
    Providers -->|wraps| ClientUI
    ClientUI -->|"fetch()/useSWR"| GetNote
    ClientUI -->|"fetch()/useSWR"| GetWords

    GetNote -->|"calls"| SupabaseClient
    GetWords -->|"calls"| SupabaseClient
    Layout -->|imports| Header
    Layout -->|imports| Footer

    SupabaseClient -->|"queries"| SupabaseDB
    CombinationsMgr -->|uses| SupabaseClient
    DuemLaw -->|used by| CombinationsMgr
    Collections -->|used by| CombinationsMgr

    WordCombiner -->|uses| CombinationsMgr
    ManagerTool -->|uses| Collections
    ReleaseNotes -->|uses| SupabaseClient
    WordsDocs -->|uses| SupabaseClient
    WordSearch -->|uses| SupabaseClient
    Auth -->|uses| SupabaseClient
    Profile -->|uses| SupabaseClient

    Store -->|connects| ClientState

    %% Styles
    classDef frontend fill:#E0F2FE,stroke:#0284C7,stroke-width:1px
    classDef backend fill:#D1FAE5,stroke:#059669,stroke-width:1px
    classDef logic fill:#FEF9C3,stroke:#CA8A04,stroke-width:1px
    classDef database fill:#FFE4E6,stroke:#DB2777,stroke-width:1px
```
