# raydium-io/raydium-ui-v3-public architecture

> Architecture diagram of the GitHub repository raydium-io/raydium-ui-v3-public, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/raydium-io/raydium-ui-v3-public
- Repository: https://github.com/raydium-io/raydium-ui-v3-public

## Overview

##### Project type and purpose
- This is a Next.js-based, React/TypeScript web application (“Raydium UI”) that provides a front-end interface to on-chain DeFi features (swap, farming, liquidity, launchpad, wallets) across Solana and EVM-compatible chains. It uses SSR/SSG for pages, dynamic routing, client-side hydration, and interactive state via Zustand.

##### File structure
- Top-level “pages” directory: Next.js routes, server-rendered or statically generated.
- “src/components”: shared UI primitives (Buttons, Charts, Modals) built with Chakra UI.
- “src/features”: domain modules (Swap, Farm, Pools, Launchpad) each containing pages, components, hooks, utils.
- “src/hooks”: reusable React hooks for fetching data, detecting viewport, event handling.
- “src/api”: Axios wrappers for third-party services (RPC nodes, BirdEye, transaction service).
- “src/provider”: React Context providers (Theme, Wallet, Ledger polyfills).
- “src/store”: Zustand stores for global state (markets, liquidity, swaps, settings).
- “src/utils”: generic helpers (date, number formatting, PDAs).
- Config files: next.config.js, TypeScript configs, Sentry configs.

##### README for additional insights
- Confirms folder conventions (components pure, features domain-oriented, store via createStore, providers wrapped in _app.tsx).
- Emphasizes separation of UI, logic, and async operations (Zustand actions in stores, hooks just invoke stores).

##### Detail is key—capture each layer and its connections
- “public/” as static asset server
- “pages/api/*” (if present) for serverless functions
- Sentry and Monitoring as sidecar to server and client
- I18n and theme providers as wrappers around the React tree
- Cluster feature sub-systems (Swap, Farm, Liquidity, Pool, Launchpad) to demonstrate modular structure

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client (Browser)" 
        direction TB
        Client["Browser\n(React App, Hydration)"]:::client
    end

    %% Server Layer
    subgraph "Next.js Server" 
        direction TB
        Pages["Next.js Pages\n(Routes & SSR/SSG)"]:::server
        API_Routes["Serverless API\n(pages/api)"]:::server
        Static["Static Assets\n(public/)"]:::server
    end

    %% Internal Modules
    subgraph "Internal Modules" 
        direction TB
        Providers["Context Providers\n(src/provider)"]:::internal
        Theme["Chakra Theme\n(src/theme)"]:::internal
        Components["Shared UI Primitives\n(src/components)"]:::internal
        subgraph "Feature Modules"
            direction TB
            Swap["Swap\n(src/features/Swap)"]:::internal
            Farm["Farm\n(src/features/Farm)"]:::internal
            Pools["Pools & Liquidity\n(src/features/Pools & src/features/Liquidity)"]:::internal
            Launchpad["Launchpad\n(src/features/Launchpad)"]:::internal
            Staking["Staking\n(src/features/Staking)"]:::internal
            Clmm["CLMM\n(src/features/Clmm)"]:::internal
            Portfolio["Portfolio\n(src/features/Portfolio)"]:::internal
            MoonpayFeat["Moonpay Feature\n(src/features/Moonpay)"]:::internal
        end
        Hooks["Data-Fetching & Side-Effect Hooks\n(src/hooks)"]:::internal
        API_Clients["API Clients (Axios wrappers)\n(src/api)"]:::internal
        Store["Zustand Stores\n(src/store)"]:::internal
        Utils["Utilities & Helpers\n(src/utils)"]:::internal
    end

    %% External Services
    subgraph "External Services" 
        direction TB
        Solana["Solana JSON-RPC"]:::external
        EVM["EVM RPC Endpoints"]:::external
        BirdEye["BirdEye API"]:::external
        TradingView["TradingView Datafeed"]:::external
        MoonPay["MoonPay & Payment"]:::external
    end

    %% Connections
    Client -->|HTTP request| Pages
    Pages -->|render HTML+JSON| Client
    Client -->|request static assets| Static
    Client -->|wrap with providers| Providers
    Providers --> Client
    ClientsideFlow[/"Clientside\nInteractions"/]:::note
    Client -->|invoke hooks| Hooks
    Hooks -->|dispatch action| Store
    Store -->|provide state| Client
    Hooks -->|use axios| API_Clients
    API_Clients -->|RPC call| Solana
    API_Clients -->|RPC call| EVM
    API_Clients -->|REST call| BirdEye
    API_Clients -->|stream| TradingView
    API_Clients -->|payment| MoonPay
    Client -->|call serverless| API_Routes

    %% Click Events
    click Pages "https://github.com/raydium-io/raydium-ui-v3-public/tree/master/src/pages"
    click Static "https://github.com/raydium-io/raydium-ui-v3-public/tree/master/public"
    click Providers "https://github.com/raydium-io/raydium-ui-v3-public/tree/master/src/provider"
    click Theme "https://github.com/raydium-io/raydium-ui-v3-public/tree/master/src/theme"
    click Components "https://github.com/raydium-io/raydium-ui-v3-public/tree/master/src/components"
    click Swap "https://github.com/raydium-io/raydium-ui-v3-public/tree/master/src/features/Swap"
    click Farm "https://github.com/raydium-io/raydium-ui-v3-public/tree/master/src/features/Farm"
    click Pools "https://github.com/raydium-io/raydium-ui-v3-public/tree/master/src/features/Pools"
    click Pools "https://github.com/raydium-io/raydium-ui-v3-public/tree/master/src/features/Liquidity"
    click Launchpad "https://github.com/raydium-io/raydium-ui-v3-public/tree/master/src/features/Launchpad"
    click Staking "https://github.com/raydium-io/raydium-ui-v3-public/tree/master/src/features/Staking"
    click Clmm "https://github.com/raydium-io/raydium-ui-v3-public/tree/master/src/features/Clmm"
    click Portfolio "https://github.com/raydium-io/raydium-ui-v3-public/tree/master/src/features/Portfolio"
    click MoonpayFeat "https://github.com/raydium-io/raydium-ui-v3-public/tree/master/src/features/Moonpay"
    click Hooks "https://github.com/raydium-io/raydium-ui-v3-public/tree/master/src/hooks"
    click API_Clients "https://github.com/raydium-io/raydium-ui-v3-public/blob/master/src/api/axios.ts"
    click Store "https://github.com/raydium-io/raydium-ui-v3-public/blob/master/src/store/createStore.ts"
    click Utils "https://github.com/raydium-io/raydium-ui-v3-public/tree/master/src/utils"

    %% Styles
    classDef client fill:#D0E8FF,stroke:#0366D6,color:#0366D6;
    classDef server fill:#DFF8E1,stroke:#28A745,color:#28A745;
    classDef internal fill:#F0F0F0,stroke:#888888,color:#333333;
    classDef external fill:#FFF4E5,stroke:#FF9F1C,color:#FF9F1C;
    classDef note fill:#FFF,stroke:#AAA,color:#555,stroke-dasharray: 2 2;
```
