# thangpaisen/randomquotes architecture

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

- Interactive diagram: https://gitdiagram.com/thangpaisen/randomquotes
- Repository: https://github.com/thangpaisen/randomquotes

## Overview

##### Main System Components

a) Frontend Layer (Mobile App)
- React Native/Expo Application
- Navigation System
- UI Components
- State Management
- API Integration

b) External Services
- Random Quotes API (quotable)

##### Detailed Component Breakdown

A. Presentation Layer
- Home Screen (Random Quotes)
- Search Screen (Authors & Tags)
- Bookmark Screen
- Quote By Author Screen
- With the navigation system (MainBottomNavigation.tsx)

B. Component Layer
- Reusable components:
- HeaderNormal
- IconSvgView
- LoadingView
- Search Components (AuthorList, SearchTabs, TagsList)

C. Business Logic Layer
- Custom Hooks:
- useListAuthors
- useListQuoteByAuthor
- useListQuoteByTag
- useListRandomQuote
- useStore

D. Data Management Layer
- Store:
- User Store (for bookmarks)
- API Service:
- External API communication

**┌─────────────────────────────────────────────────────┐**
- Mobile Application                  │
- ┌─────────────────┐  ┌─────────────────────────┐  │
- Presentation  │  │      Components         │  │
- Layer      │  │                         │  │
- ┬────────┘  └─────────────┬─────────┘  │

- ┌────────┴────────┐  ┌─────────────┴─────────┐  │
- Business Logic │  │    Data Management    │  │
- Layer      │  │         Layer         │  │
- ┬────────┘  └─────────────┬─────────┘  │
- ┼──────────────────────────┼────────────┘

- ┐ ┌────────┘

- ┌─────┴─┴───────┐
- External API  │
- ┘

##### Important Relationships to Highlight

- How the Hooks layer interfaces between UI and API
- State management flow for bookmarks
- Demonstrate the navigation structure between screens
- Data flow from API to UI components

##### Technical Details

- React Native/Expo as the main framework
- Navigation system using React Navigation
- Custom hooks for data fetching
- Local storage for bookmarks
- API integration patterns

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Mobile["Mobile Application"]
        subgraph PL["Presentation Layer"]
            HS["Home Screen"]:::screen
            SS["Search Screen"]:::screen
            BS["Bookmark Screen"]:::screen
            QA["Quote By Author Screen"]:::screen
            NAV["Navigation System"]:::nav
        end

        subgraph CL["Component Layer"]
            HC["HeaderNormal"]:::component
            IC["IconSvgView"]:::component
            LC["LoadingView"]:::component
            
            subgraph SC["Search Components"]
                AL["AuthorList"]:::component
                ST["SearchTabs"]:::component
                TL["TagsList"]:::component
            end
        end

        subgraph BL["Business Logic Layer"]
            LA["useListAuthors"]:::hook
            LQA["useListQuoteByAuthor"]:::hook
            LQT["useListQuoteByTag"]:::hook
            LRQ["useListRandomQuote"]:::hook
            US["useStore"]:::hook
            EH["Error Handler"]:::util
        end

        subgraph DM["Data Management Layer"]
            API["API Service"]:::service
            Store["User Store"]:::store
        end
    end

    EXT["External Quotes API"]:::external

    %% Relationships
    NAV --> HS & SS & BS & QA
    HS & SS & BS & QA --> HC
    SS --> SC
    
    LA & LQA & LQT & LRQ --> API
    API --> EXT
    
    US --> Store
    HS & BS --> US
    
    %% Click Events
    click NAV "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Navigators/MainBottomNavigation.tsx"
    click HS "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Containers/Home/HomeScreen.tsx"
    click SS "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Containers/Search/SearchScreen.tsx"
    click BS "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Containers/Bookmark/BookmarkScreen.tsx"
    click QA "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Containers/QuoteByAuthor/QuoteByAuthorScreen.tsx"
    click HC "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Components/HeaderNormal.tsx"
    click IC "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Components/IconSvgView.tsx"
    click LC "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Components/LoadingView.tsx"
    click AL "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Containers/Search/Components/AuthorList.tsx"
    click ST "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Containers/Search/Components/SearchTabs.tsx"
    click TL "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Containers/Search/Components/TagsList.tsx"
    click LA "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Hooks/useListAuthors.ts"
    click LQA "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Hooks/useListQuoteByAuthor.ts"
    click LQT "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Hooks/useListQuoteByTag.ts"
    click LRQ "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Hooks/useListRandomQuote.ts"
    click US "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Hooks/useStore.ts"
    click EH "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Helpers/handleError.ts"
    click API "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Service/api.ts"
    click Store "https://github.com/thangpaisen/RandomQuotes/blob/main/src/Stores/User/User.ts"

    %% Styles
    classDef screen fill:#2196F3,color:white
    classDef component fill:#4CAF50,color:white
    classDef hook fill:#9C27B0,color:white
    classDef service fill:#FF9800,color:white
    classDef store fill:#673AB7,color:white
    classDef external fill:#F44336,color:white
    classDef nav fill:#607D8B,color:white
    classDef util fill:#795548,color:white
```
