# banaanas/cyrilo-mots architecture

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

- Interactive diagram: https://gitdiagram.com/banaanas/cyrilo-mots
- Repository: https://github.com/banaanas/cyrilo-mots

## Overview

**┌─ Client Layer ─────────────────────┐**
- Next.js Frontend                 │
- React Components                 │
- Zustand State Management        │
- ┬────────────────┘
- ↕
**┌─ API Layer ──────┴────────────────┐**
- Next.js API Routes              │
- Authentication Handlers         │
- ┬────────────────┘
- ↕
**┌─ External Services ────────────────┐**
- Supabase (Auth & Database)      │
- Wiktionary API                  │
- ┘

##### Component Details

Frontend (Client Layer):
- Layout Components (Header, Layout)
- Word Management (WordSearch, WordsList, WordDefinitions)
- Authentication Components (LoginPage, LoginForm, LoginGithub)
- Common Components (Loader, MaxWidthWrapper)

State Management:
- A Zustand store section showing the four stores:
- useMaxRangeStore
- useWordsAccordionStore
- useWordsSearchStore
- useWordsStore

API Integration:
- Create sections for:
- Supabase API calls (all-words, search-word, word operations)
- Wiktionary API integration (definitions retrieval)

##### Data Flow Indicators

- User authentication flow (Login → Supabase Auth)
- Word search and retrieval (Search → Supabase → Wiktionary API)
- State updates (Components → Zustand Store)

##### Technical Stack Indicators

Technology badges for:
- Next.js
- React
- TypeScript
- Supabase
- Emotion
- Zustand
- Radix UI

##### Notes

Annotations for:
- Authentication methods supported
- Word definition retrieval process
- Pagination implementation
- State management strategy
- SEO optimization approach

##### Component hierarchy and interaction

Remember to emphasize the application's key features:
- Two different word lists (All Words/Unread Words)
- Search functionality
- Authentication system
- Word definition retrieval
- Pagination
- Responsive design considerations

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Layout["Layout Component"]
        Header["Header Component"]
        WordMgmt["Word Management"]
        AuthComps["Authentication Components"]
        CommonComps["Common Components"]
        
        subgraph WordComponents
            WordComp["Word Component"]
            WordDef["Word Definitions"]
            WordSearch["Word Search"]
            WordsList["Words List"]
        end
        
        subgraph AuthenticationComponents
            LoginPage["Login Page"]
            LoginForm["Login Form"]
            LoginGithub["GitHub Login"]
        end
        
        subgraph CommonComponents
            Loader["Loader"]
            MaxWidth["MaxWidth Wrapper"]
        end
    end
    
    subgraph StateManagement
        MaxRangeStore["Max Range Store"]
        AccordionStore["Words Accordion Store"]
        SearchStore["Words Search Store"]
        WordsStore["Words Store"]
    end
    
    subgraph APILayer
        SupabaseClient["Supabase Client"]
        WordOps["Word Operations"]
        WiktionaryInt["Wiktionary Integration"]
    end
    
    subgraph ExternalServices
        Supabase[(Supabase)]
        WiktionaryAPI["Wiktionary API"]
    end
    
    subgraph Styling
        GlobalStyles["Global Styles"]
        ThemeConfig["Theme Configuration"]
        CSSVars["CSS Variables"]
    end
    
    subgraph SEO
        SEOConfig["SEO Configuration"]
        SEOData["SEO Data"]
    end

    Layout --> Header
    Layout --> WordMgmt
    WordMgmt --> WordComponents
    AuthComps --> AuthenticationComponents
    
    WordComponents --> StateManagement
    AuthenticationComponents --> APILayer
    
    APILayer --> ExternalServices
    WiktionaryInt --> WiktionaryAPI
    SupabaseClient --> Supabase
    WordOps --> Supabase

    %% Click events for component mapping
    click Layout "https://github.com/Banaanas/cyrilo-mots/blob/main/Components/Layout/Layout.tsx"
    click Header "https://github.com/Banaanas/cyrilo-mots/blob/main/Components/Layout/Header/Header.tsx"
    click WordComp "https://github.com/Banaanas/cyrilo-mots/blob/main/Components/Word/Word.tsx"
    click WordDef "https://github.com/Banaanas/cyrilo-mots/blob/main/Components/Word/WordDefinitions/WordDefinitions.tsx"
    click WordSearch "https://github.com/Banaanas/cyrilo-mots/blob/main/Components/WordSearch/WordsSearch.tsx"
    click WordsList "https://github.com/Banaanas/cyrilo-mots/blob/main/Components/WordsList/WordsList.tsx"
    click LoginPage "https://github.com/Banaanas/cyrilo-mots/tree/main/Components/_Pages/LoginPage"
    click LoginForm "https://github.com/Banaanas/cyrilo-mots/blob/main/Components/_Pages/LoginPage/LoginForm/LoginForm.tsx"
    click LoginGithub "https://github.com/Banaanas/cyrilo-mots/blob/main/Components/_Pages/LoginPage/LoginGithub/LoginGitHub.tsx"
    click Loader "https://github.com/Banaanas/cyrilo-mots/blob/main/Components/Common/Loader.tsx"
    click MaxWidth "https://github.com/Banaanas/cyrilo-mots/blob/main/Components/Common/MaxWidthWrapper.tsx"
    click MaxRangeStore "https://github.com/Banaanas/cyrilo-mots/blob/main/lib/zustand-store/useMaxRangeStore.ts"
    click AccordionStore "https://github.com/Banaanas/cyrilo-mots/blob/main/lib/zustand-store/useWordsAccordionStore.ts"
    click SearchStore "https://github.com/Banaanas/cyrilo-mots/blob/main/lib/zustand-store/useWordsSearchStore.ts"
    click WordsStore "https://github.com/Banaanas/cyrilo-mots/blob/main/lib/zustand-store/useWordsStore.ts"
    click SupabaseClient "https://github.com/Banaanas/cyrilo-mots/blob/main/lib/api-calls/supabase/supabase-client.ts"
    click WordOps "https://github.com/Banaanas/cyrilo-mots/blob/main/lib/api-calls/supabase/word.ts"
    click WiktionaryInt "https://github.com/Banaanas/cyrilo-mots/blob/main/lib/api-calls/wiktionary/get-wiktionary-definitions.ts"
    click SEOConfig "https://github.com/Banaanas/cyrilo-mots/blob/main/SEO/next-seo.config.ts"
    click SEOData "https://github.com/Banaanas/cyrilo-mots/blob/main/SEO/seo-data.ts"
    click GlobalStyles "https://github.com/Banaanas/cyrilo-mots/blob/main/styles/GlobalStyles.tsx"
    click ThemeConfig "https://github.com/Banaanas/cyrilo-mots/blob/main/styles/appTheme.ts"
    click CSSVars "https://github.com/Banaanas/cyrilo-mots/tree/main/styles/CSS-variables"

    classDef frontend fill:#2196F3,stroke:#1565C0,color:white
    classDef state fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef api fill:#4CAF50,stroke:#388E3C,color:white
    classDef external fill:#FF9800,stroke:#F57C00,color:white
    classDef styling fill:#607D8B,stroke:#455A64,color:white
    classDef seo fill:#795548,stroke:#5D4037,color:white

    class Layout,Header,WordMgmt,AuthComps,CommonComps,WordComponents,AuthenticationComponents,CommonComponents frontend
    class MaxRangeStore,AccordionStore,SearchStore,WordsStore state
    class SupabaseClient,WordOps,WiktionaryInt api
    class Supabase,WiktionaryAPI external
    class GlobalStyles,ThemeConfig,CSSVars styling
    class SEOConfig,SEOData seo
```
