# morpho-org/morpho-lite-apps architecture

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

- Interactive diagram: https://gitdiagram.com/morpho-org/morpho-lite-apps
- Repository: https://github.com/morpho-org/morpho-lite-apps

## Overview

##### Project type and purpose
- This is a frontend-focused monorepo containing two production React single-page apps (“fallback” and “lite”) plus a shared component library (“uikit”).
- The “fallback” app is a minimal-dependency emergency UI for Morpho vault interactions. The “lite” app is a richer, multi-chain, whitelabel-ready UI. The “uikit” package provides styled components and hooks shared by both apps.

##### File structure
- Top-level folders:
- apps/fallback – emergency SPA
- apps/lite – full-featured SPA
- packages/uikit – shared React component library
- Each app has:
- public assets (public/) and HTML entry (index.html)
- src/ folder with React components, routing (lite has React Router), hooks, GraphQL layer
- build tooling (vite.config.ts), tsconfig, test configs
- deployment configs (vercel.json for lite, fleek/s3 CI workflows)
- Monorepo tooling: pnpm-workspace.yaml, GitHub Actions workflows for CI, fleek-deploy, s3-deploy.

##### README for additional insights
- Both apps use React 19, Vite, shadcn UI, wagmi for Web3.
- Lite app adds GraphQL client, React Router, Alchemy-tuned RPCs, Merkl rewards.
- UIKit includes shadcn-based components, hooks for contract events, utilities, and tevm contract types.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Developer and Source Control
    Developer["Developer Machine (pnpm, VSCode)"]:::developer
    GitHub["GitHub Repository"]:::external

    Developer -->|"push code"| GitHub

    %% Monorepo Root
    Monorepo["Monorepo Root (pnpm-workspace.yaml)"]:::root
    GitHub -->|"workspace defined"| Monorepo
    click Monorepo "https://github.com/morpho-org/morpho-lite-apps/blob/main/pnpm-workspace.yaml"

    %% CI/CD Pipelines
    subgraph "CI/CD Pipelines"
        direction TB
        CI["GitHub Actions CI"]:::ci
        FleekDeploy["Fleek Deploy Workflow"]:::ci
        S3Deploy["S3 Deploy Workflow"]:::ci

        Monorepo -->|"triggers CI"| CI
        CI -->|"on merge"| FleekDeploy
        CI -->|"on merge"| S3Deploy

        click CI "https://github.com/morpho-org/morpho-lite-apps/blob/main/.github/workflows/ci.yaml"
        click FleekDeploy "https://github.com/morpho-org/morpho-lite-apps/blob/main/.github/workflows/fleek-deploy.yaml"
        click S3Deploy "https://github.com/morpho-org/morpho-lite-apps/blob/main/.github/workflows/s3-deploy.yaml"
    end

    %% Deployment Targets
    subgraph "Deployment Targets"
        direction TB
        Fleek["Fleek/S3 (fallback)"]:::deploy
        Vercel["Vercel (lite)"]:::deploy
        Script["Deploy Script"]:::deploy

        FleekDeploy -->|deploy fallback| Fleek
        S3Deploy -->|upload assets| Fleek
        CI -->|deploy lite| Vercel
        CI -->|run script| Script

        click FleekConfig "https://github.com/morpho-org/morpho-lite-apps/blob/main/fleek.config.ts"
        click Vercel "https://github.com/morpho-org/morpho-lite-apps/blob/main/apps/lite/vercel.json"
        click Script "https://github.com/morpho-org/morpho-lite-apps/blob/main/scripts/deploy.sh"
    end

    %% Shared UI Library
    subgraph "packages/uikit" 
        direction TB
        UI_pkg["package.json"]:::code
        UI_vite["vite.config.ts"]:::code
        UIF_comp["src/components/shadcn/"]:::code
        UI_comp["src/components/*.tsx"]:::code
        UI_hook["src/hooks/use-contract-events/use-contract-events.ts"]:::code
        UI_abis["src/assets/abis/"]:::code
        UI_utils["src/lib/utils.ts"]:::code

        Monorepo -->|includes| UI_pkg
        click UI_pkg "https://github.com/morpho-org/morpho-lite-apps/blob/main/packages/uikit/package.json"
        click UI_vite "https://github.com/morpho-org/morpho-lite-apps/blob/main/packages/uikit/vite.config.ts"
        click UIF_comp "https://github.com/morpho-org/morpho-lite-apps/tree/main/packages/uikit/src/components/shadcn"
        click UI_comp "https://github.com/morpho-org/morpho-lite-apps/blob/main/packages/uikit/src/components/*.tsx"
        click UI_hook "https://github.com/morpho-org/morpho-lite-apps/blob/main/packages/uikit/src/hooks/use-contract-events/use-contract-events.ts"
        click UI_abis "https://github.com/morpho-org/morpho-lite-apps/tree/main/packages/uikit/src/assets/abis"
        click UI_utils "https://github.com/morpho-org/morpho-lite-apps/blob/main/packages/uikit/src/lib/utils.ts"
    end

    %% Fallback Application
    subgraph "apps/fallback SPA" 
        direction TB
        FB_html["index.html"]:::code
        FB_main["src/main.tsx"]:::code
        FB_dash["src/app/dashboard/page.tsx"]:::code
        FB_const["src/lib/constants.ts"]:::code
        FB_vite["vite.config.ts"]:::code

        Monorepo -->|contains| FB_html
        Monorepo --> FB_main
        Monorepo --> FB_dash
        Monorepo --> FB_const
        Monorepo --> FB_vite

        click FB_html "https://github.com/morpho-org/morpho-lite-apps/blob/main/apps/fallback/index.html"
        click FB_main "https://github.com/morpho-org/morpho-lite-apps/blob/main/apps/fallback/src/main.tsx"
        click FB_dash "https://github.com/morpho-org/morpho-lite-apps/blob/main/apps/fallback/src/app/dashboard/page.tsx"
        click FB_const "https://github.com/morpho-org/morpho-lite-apps/blob/main/apps/fallback/src/lib/constants.ts"
        click FB_vite "https://github.com/morpho-org/morpho-lite-apps/blob/main/apps/fallback/vite.config.ts"
    end

    %% Lite Application
    subgraph "apps/lite SPA"
        direction TB
        L_html["index.html"]:::code
        L_main["src/main.tsx"]:::code
        L_dash["src/app/dashboard/page.tsx"]:::code
        L_graphql["src/graphql/graphql.ts"]:::code
        L_wagmi["src/lib/wagmi-config.ts"]:::code
        L_merkl["src/hooks/use-merkl-rewards.tsx"]:::code
        L_vite["vite.config.ts"]:::code

        Monorepo --> L_html
        Monorepo --> L_main
        Monorepo --> L_dash
        Monorepo --> L_graphql
        Monorepo --> L_wagmi
        Monorepo --> L_merkl
        Monorepo --> L_vite

        click L_html "https://github.com/morpho-org/morpho-lite-apps/blob/main/apps/lite/index.html"
        click L_main "https://github.com/morpho-org/morpho-lite-apps/blob/main/apps/lite/src/main.tsx"
        click L_dash "https://github.com/morpho-org/morpho-lite-apps/blob/main/apps/lite/src/app/dashboard/page.tsx"
        click L_graphql "https://github.com/morpho-org/morpho-lite-apps/blob/main/apps/lite/src/graphql/graphql.ts"
        click L_wagmi "https://github.com/morpho-org/morpho-lite-apps/blob/main/apps/lite/src/lib/wagmi-config.ts"
        click L_merkl "https://github.com/morpho-org/morpho-lite-apps/blob/main/apps/lite/src/hooks/use-merkl-rewards.tsx"
        click L_vite "https://github.com/morpho-org/morpho-lite-apps/blob/main/apps/lite/vite.config.ts"
    end

    %% Runtime External Services
    subgraph "Runtime Flows"
        direction TB
        RPC_pub["Public RPC Provider"]:::external
        RPC_alc["Alchemy RPC Provider"]:::external
        EthNet["Ethereum Networks"]:::external
        GraphQLAPI["Merkl Rewards GraphQL API"]:::external

        FB_main -->|"wagmi hooks"| RPC_pub
        RPC_pub --> EthNet

        L_main -->|"wagmi hooks"| RPC_alc
        RPC_alc --> EthNet

        L_graphql -->|"fetch rewards"| GraphQLAPI
    end

    %% Build-time Integration
    UI_pkg -->|"shared components/hooks"| FB_main
    UI_pkg -->|"shared components/hooks"| L_main

    %% Classes
    classDef code fill:#ADD8E6,stroke:#000;
    classDef ci fill:#90EE90,stroke:#000;
    classDef external fill:#FFA500,stroke:#000;
    classDef deploy fill:#DDA0DD,stroke:#000;
    classDef root fill:#87CEFA,stroke:#000;
    classDef developer fill:#E0FFFF,stroke:#000;
```
