# damianotobasco/moredashboard architecture

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

- Interactive diagram: https://gitdiagram.com/damianotobasco/moredashboard
- Repository: https://github.com/damianotobasco/moredashboard

## Overview

##### Project type and purpose
- Full-stack, real-time crypto dashboard built in React/TypeScript (Vite/Tailwind)
- Serverless “backend” via Supabase Functions (Token Data, Transfers)
- Integrates on-chain data (PulseChain RPC) and off-chain APIs (DexScreener, Moralis)

##### Main components
A. Frontend (Client Browser)
- React app (src/)
- UI components: Dashboard, PriceChart, BurnInfo, TokenHolders, TransfersTable, TradingModule
- UI library bits: ButtonDemo, GlassPanel, KpiCard, shiny-text, shooting-stars (src/components/ui)
- Hooks & utilities: useDataFetching, useSwap, formatters, mockData
- Blockchain helper: wagmi.ts, contracts.ts in src/lib
- Wallet connection: WalletConnect.tsx
- Build toolchain/config: Vite, Tailwind, PostCSS, ESLint, TypeScript

B. Backend (Supabase Functions)
- token-data function (supabase/functions/token-data/index.ts)
- transfers function (supabase/functions/transfers/index.ts)
- (Optionally) Supabase Postgres DB (migrations/20250428015327_navy_dune.sql)

C. External Services
- PulseChain RPC (via VITE_PULSECHAIN_RPC)
- DexScreener API
- Moralis API (optional)

##### Relationships & data flow
1) User’s Browser loads React app (index.html → main.tsx)
2) React components retrieve data via two parallel paths:
a. Direct on-chain calls (Wagmi → PulseChain RPC)
- TokenInfo, PriceChart, BurnInfo, TradingModule for real-time on-chain state
b. HTTP calls → Supabase Functions
- /token-data → aggregates holders, price history, burn stats
- /transfers   → pull transfer history, paginated data
Both Supabase Functions in turn may query PulseChain RPC, DexScreener, Moralis, and/or Postgres DB.
3) React displays updated metrics, charts, tables.
4) TradingModule uses wagmi + user’s wallet (WalletConnect) to submit trades to the chain.

##### Architectural patterns & principles
- Component-driven UI (React) with separation of “dumb” UI vs data hooks
- Serverless “microservices” (Supabase Functions) for data aggregation
- Immutable on-chain source of truth + optional caching in Supabase/Postgres
- Environment-driven configuration (VITE_… variables)

##### Detailing Technologies & Config
- Frontend: Vite (vite.config.ts), Tailwind (tailwind.config.js), PostCSS, ESLint
- Code: TypeScript, React (TSX), custom hooks, supabase-js (for functions auth)
- Deployment: npm run dev/build → dist/ → static host
- Env vars: VITE_PULSECHAIN_RPC, VITE_TOKEN_ADDRESS, VITE_BURN_ADDRESS, VITE_MORALIS_API_KEY, VITE_DEXSCREENER_API_KEY

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Client / Browser"
        subgraph "React App"
            Main["src/main.tsx"]:::frontend
            App["src/App.tsx"]:::frontend
            subgraph "UI Components"
                Dash["Dashboard"]:::frontend
                Price["PriceChart"]:::frontend
                Burn["BurnInfo"]:::frontend
                TokenInfo["TokenInfo"]:::frontend
                TokenHolders["TokenHolders"]:::frontend
                Transfers["TransfersTable"]:::frontend
                Trading["TradingModule"]:::frontend
                WalletConnectComp["WalletConnect"]:::frontend
            end
            subgraph "UI Library"
                Button["ButtonDemo"]:::frontend
                Glass["GlassPanel"]:::frontend
                Kpi["KpiCard"]:::frontend
                Shiny["shiny-text"]:::frontend
                Stars["shooting-stars"]:::frontend
            end
            subgraph "Hooks & Utilities"
                DataFetch["useDataFetching"]:::frontend
                Swap["useSwap"]:::frontend
                Formatter["formatters"]:::frontend
                Mock["mockData"]:::frontend
            end
            subgraph "Blockchain Helpers"
                Wagmi["wagmi.ts"]:::frontend
                Contracts["contracts.ts"]:::frontend
                UtilsLib["utils.ts"]:::frontend
            end
        end
        subgraph "Config & Types"
            Vite["vite.config.ts"]:::frontend
            Tailwind["tailwind.config.js"]:::frontend
            PostCSS["postcss.config.js"]:::frontend
            ESLint["eslint.config.js"]:::frontend
            ViteEnv["src/vite-env.d.ts"]:::frontend
            Types["src/types/index.ts"]:::frontend
        end
    end

    subgraph "Serverless Backend"
        TokenData["token-data Function"]:::backend
        TransfersFunc["transfers Function"]:::backend
        DB["Supabase Postgres"]:::backend
    end

    subgraph "External Services"
        RPC["PulseChain RPC"]:::external
        Dex["DexScreener API"]:::external
        Moralis["Moralis API"]:::external
    end

    Wallet["User's Wallet"]:::external

    Main --> App
    App -->|renders| Dash
    App -->|renders| Price
    App -->|renders| Burn
    App -->|renders| TokenInfo
    App -->|renders| TokenHolders
    App -->|renders| Transfers
    App -->|renders| Trading
    App -->|renders| WalletConnectComp

    Dash -->|REST/fetch| TokenData
    Price -->|REST/fetch| TokenData
    Burn -->|REST/fetch| TokenData
    TokenInfo -->|REST/fetch| TokenData
    TokenHolders -->|REST/fetch| TokenData
    Transfers -->|REST/fetch| TransfersFunc

    Price -->|"Wagmi/JSON-RPC"| RPC
    Burn -->|"Wagmi/JSON-RPC"| RPC
    TokenInfo -->|"Wagmi/JSON-RPC"| RPC
    Trading -->|"Wagmi/JSON-RPC"| RPC

    WalletConnectComp -->|"connect"| Wallet
    Wallet -->|"JSON-RPC"| RPC

    TokenData -->|"fetch"| RPC
    TokenData -->|"fetch"| Dex
    TokenData -->|"fetch"| Moralis
    TokenData -->|"query"| DB

    TransfersFunc -->|"fetch"| RPC
    TransfersFunc -->|"query"| DB

    classDef frontend fill:#AED6F1,stroke:#21618C,color:#1B4F72
    classDef backend fill:#FAD7A0,stroke:#AF601A,color:#784212
    classDef external fill:#ABEBC6,stroke:#1D8348,color:#145A32

    click Main "https://github.com/damianotobasco/moredashboard/blob/main/src/main.tsx"
    click App "https://github.com/damianotobasco/moredashboard/blob/main/src/App.tsx"
    click Dash "https://github.com/damianotobasco/moredashboard/blob/main/src/components/Dashboard.tsx"
    click Price "https://github.com/damianotobasco/moredashboard/blob/main/src/components/PriceChart.tsx"
    click Burn "https://github.com/damianotobasco/moredashboard/blob/main/src/components/BurnInfo.tsx"
    click TokenInfo "https://github.com/damianotobasco/moredashboard/blob/main/src/components/TokenInfo.tsx"
    click TokenHolders "https://github.com/damianotobasco/moredashboard/blob/main/src/components/TokenHolders.tsx"
    click Transfers "https://github.com/damianotobasco/moredashboard/blob/main/src/components/TransfersTable.tsx"
    click Trading "https://github.com/damianotobasco/moredashboard/blob/main/src/components/TradingModule.tsx"
    click WalletConnectComp "https://github.com/damianotobasco/moredashboard/blob/main/src/components/WalletConnect.tsx"
    click Button "https://github.com/damianotobasco/moredashboard/blob/main/src/components/ui/ButtonDemo.tsx"
    click Glass "https://github.com/damianotobasco/moredashboard/blob/main/src/components/ui/GlassPanel.tsx"
    click Kpi "https://github.com/damianotobasco/moredashboard/blob/main/src/components/ui/KpiCard.tsx"
    click Shiny "https://github.com/damianotobasco/moredashboard/blob/main/src/components/ui/shiny-text.tsx"
    click Stars "https://github.com/damianotobasco/moredashboard/blob/main/src/components/ui/shooting-stars.tsx"
    click DataFetch "https://github.com/damianotobasco/moredashboard/blob/main/src/hooks/useDataFetching.ts"
    click Swap "https://github.com/damianotobasco/moredashboard/blob/main/src/hooks/useSwap.ts"
    click Formatter "https://github.com/damianotobasco/moredashboard/blob/main/src/utils/formatters.ts"
    click Mock "https://github.com/damianotobasco/moredashboard/blob/main/src/utils/mockData.ts"
    click Wagmi "https://github.com/damianotobasco/moredashboard/blob/main/src/lib/wagmi.ts"
    click Contracts "https://github.com/damianotobasco/moredashboard/blob/main/src/lib/contracts.ts"
    click UtilsLib "https://github.com/damianotobasco/moredashboard/blob/main/src/lib/utils.ts"
    click Vite "https://github.com/damianotobasco/moredashboard/blob/main/vite.config.ts"
    click Tailwind "https://github.com/damianotobasco/moredashboard/blob/main/tailwind.config.js"
    click PostCSS "https://github.com/damianotobasco/moredashboard/blob/main/postcss.config.js"
    click ESLint "https://github.com/damianotobasco/moredashboard/blob/main/eslint.config.js"
    click ViteEnv "https://github.com/damianotobasco/moredashboard/blob/main/src/vite-env.d.ts"
    click Types "https://github.com/damianotobasco/moredashboard/blob/main/src/types/index.ts"
    click TokenData "https://github.com/damianotobasco/moredashboard/blob/main/supabase/functions/token-data/index.ts"
    click TransfersFunc "https://github.com/damianotobasco/moredashboard/blob/main/supabase/functions/transfers/index.ts"
    click DB "https://github.com/damianotobasco/moredashboard/blob/main/supabase/migrations/20250428015327_navy_dune.sql"
```
