# 0xtonyth/token-overview-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/0xtonyth/token-overview-dashboard
- Repository: https://github.com/0xtonyth/token-overview-dashboard

## Overview

##### Main Components Identification

The system should be represented with these key components:

a) Frontend Layer (Client-Side)
- Next.js Application (App Router)
- React Components
- Wagmi Integration (Web3 Connectivity)
- Theme Provider
- Global State Management

b) API Layer
- Next.js API Routes
- Axios Instance for External API Calls

c) External Services
- Ethereum Blockchain
- Web3 Provider
- External APIs (implied by axios instance)

**┌─────────────────────────────────────────────────────────┐**
- Client Browser                        │
- ┬─────────────────────────┘
- ↓
**┌─────────────────────────────────────────────────────────┐**
- Next.js Application                   │
- ┌─────────────┐  ┌─────────────┐  ┌─────────────┐     │
- Pages     │  │ Components  │  │   Libs      │     │
- Home     │  │ - Layout   │  │ - Wagmi     │     │
- Pools    │  │ - Common   │  │ - Axios     │     │
- Tokens   │  │ - Dashboard│  │             │     │
- ┘  └─────────────┘  └─────────────┘     │
- ┬─────────────┬─────────────────┬────────────┘
- ↓             ↓                 ↓
**┌──────────────┐  ┌─────────────┐  ┌─────────────────────┐**
- Ethereum    │  │  External   │  │  Static Assets      │
- Network     │  │   APIs      │  │  (Public Directory) │
- ┘  └─────────────┘  └─────────────────────┘

##### Component Relationships

- Client-server communication
- Data flow between components
- Web3 interactions
- API calls

##### Key Architectural Elements to Highlight

a) Next.js App Router Structure:
- Hierarchy of pages under src/app
- Dynamic routes ([poolAddress] and [tokenAddress])

b) Component Organization:
- Common components
- Dashboard components
- Layout components

c) Integration Points:
- Wagmi configuration for Web3
- Axios instance for API calls
- Theme provider for styling

##### Notes for Implementation

- The app's focus on Ethereum pools and tokens
- The separation of concerns between components
- The role of providers (Wagmi, Theme)
- The handling of dynamic data through the pool and token routes

Remember to maintain a balance between showing the overall architecture while including enough detail to understand the specific purpose of this DeFi-focused application.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Browser"]
        User((User))
    end

    subgraph NextApp["Next.js Application"]
        direction TB
        subgraph Pages["Pages Layer"]
            direction TB
            Home["Home Page"]:::page
            Pools["Pools Page"]:::page
            Tokens["Tokens Page"]:::page
        end

        subgraph Components["Components Layer"]
            direction TB
            Layout["Main Layout"]:::component
            Header["Header"]:::component
            Footer["Footer"]:::component
            
            subgraph Dashboard["Dashboard Components"]
                PoolDash["Pool Dashboard"]:::component
                TokenDash["Token Dashboard"]:::component
                PoolChart["Pool Chart Widget"]:::component
                TokenChart["Token Chart Widget"]:::component
            end
            
            subgraph Common["Common Components"]
                Search["Search"]:::component
                SearchModal["Search Modal"]:::component
            end
        end

        subgraph Integration["Integration Layer"]
            direction TB
            WagmiConfig["Wagmi Config"]:::service
            AxiosInstance["Axios Instance"]:::service
            ThemeProvider["Theme Provider"]:::service
        end

        subgraph Utils["Utilities"]
            direction TB
            NumberFormat["Number Formatting"]:::util
            AddressFormat["Address Shortening"]:::util
        end

        subgraph Types["Type Definitions"]
            direction TB
            PoolTypes["Pool Types"]:::type
            TokenTypes["Token Types"]:::type
        end

        subgraph Static["Static Assets"]
            direction TB
            NetworkImg["Network Images"]:::asset
            DefaultImg["Default Images"]:::asset
            SocialImg["Social Icons"]:::asset
        end
    end

    subgraph External["External Services"]
        direction TB
        Ethereum["Ethereum Network"]:::blockchain
        ExternalAPIs["External APIs"]:::external
    end

    %% Relationships
    User --> Home
    Home --> Layout
    Layout --> Header
    Layout --> Footer
    Header --> Search
    Search --> SearchModal
    
    Pools --> PoolDash
    PoolDash --> PoolChart
    Tokens --> TokenDash
    TokenDash --> TokenChart
    
    WagmiConfig --> Ethereum
    AxiosInstance --> ExternalAPIs

    %% Styles
    classDef page fill:#2563eb,color:white
    classDef component fill:#3b82f6,color:white
    classDef service fill:#059669,color:white
    classDef util fill:#6b7280,color:white
    classDef type fill:#8b5cf6,color:white
    classDef asset fill:#d97706,color:white
    classDef blockchain fill:#dc2626,color:white
    classDef external fill:#0891b2,color:white

    %% Click Events
    click Home "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/app/page.tsx"
    click Pools "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/app/pools/ethereum/[poolAddress]/page.tsx"
    click Tokens "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/app/tokens/ethereum/[tokenAddress]/page.tsx"
    click Layout "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/components/layout/layout.tsx"
    click Header "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/components/layout/header.tsx"
    click Footer "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/components/layout/footer.tsx"
    click PoolDash "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/components/dashboard/pool-dashboard.tsx"
    click TokenDash "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/components/dashboard/token-dashboard.tsx"
    click PoolChart "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/components/dashboard/pool-chart-widget.tsx"
    click TokenChart "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/components/dashboard/token-chart-widget.tsx"
    click Search "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/components/common/search/search.tsx"
    click SearchModal "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/components/common/search/search-modal.tsx"
    click WagmiConfig "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/libs/wagmi/wagmiConfig.ts"
    click AxiosInstance "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/libs/axios/axiosInstance.ts"
    click ThemeProvider "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/theme/theme-provider.tsx"
    click PoolTypes "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/types/pool.d.ts"
    click TokenTypes "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/types/token.d.ts"
    click NumberFormat "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/utils/formatNumber.ts"
    click AddressFormat "https://github.com/0xtonyth/token-overview-dashboard/blob/main/src/utils/shortenAddress.ts"
    click NetworkImg "https://github.com/0xtonyth/token-overview-dashboard/tree/main/public/images/network"
    click DefaultImg "https://github.com/0xtonyth/token-overview-dashboard/tree/main/public/images/defaults"
    click SocialImg "https://github.com/0xtonyth/token-overview-dashboard/tree/main/public/images/socials"
```
