DYNO-UI

2 Squirrels AI

Technology Stack

AI Engine Claude AI
Framework Vercel AI SDK
Frontend Next.js + React
Styling Tailwind CSS
Components shadcn/ui

Architecture Note: AI-powered React component generator with live preview, virtual file system, and iterative refinement through conversational UI.

System Components

πŸ€–
Claude AI
Component Generation
πŸ“
Virtual FS
In-Memory File System
⚑
Live Preview
Hot Reload Sandbox
πŸ’¬
Chat Interface
Iterative Refinement

AI Component Generation Pipeline

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart LR
    subgraph Input["πŸ“₯ User Request"]
        UR["πŸ’¬ Component Description"]
        REF["πŸ“Έ Reference Image"]
    end

    subgraph Process["βš™οΈ AI Processing"]
        SP["πŸ“ System Prompt
React + Tailwind Expert"] CL["πŸ€– Claude AI
Anthropic API"] ST["πŸ“‘ Streaming Response"] end subgraph Parse["πŸ”§ Code Extraction"] PE["πŸ“¦ Parse TSX Blocks"] VL["βœ… Validate Syntax"] end subgraph Output["πŸ“€ Generated Code"] RC["βš›οΈ React Component"] TW["🎨 Tailwind Styles"] TS["πŸ“ TypeScript Types"] end UR --> SP REF --> SP SP --> CL CL --> ST ST --> PE PE --> VL VL --> RC VL --> TW VL --> TS

Virtual File System Architecture

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart TB
    subgraph Generate["πŸ€– AI Generation"]
        AI["πŸ€– Claude Response"]
        CODE["πŸ“ Generated TSX"]
    end

    subgraph VFS["πŸ“ Virtual File System"]
        MAP[("πŸ—ΊοΈ File Map
In-Memory")] IDX["πŸ“‹ File Index"] VER["πŸ”’ Version Control"] end subgraph Files["πŸ“„ Virtual Files"] COMP["βš›οΈ components/*.tsx"] UTIL["πŸ”§ utils/*.ts"] STYLE["🎨 styles/*.css"] end subgraph Preview["⚑ Preview Engine"] SAND["πŸ“¦ Sandpack"] HOT["πŸ”₯ Hot Reload"] end AI --> CODE CODE --> MAP MAP --> IDX MAP --> VER IDX --> COMP IDX --> UTIL IDX --> STYLE COMP --> SAND UTIL --> SAND STYLE --> SAND SAND --> HOT

Conversational UI Flow

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart TB
    subgraph User["πŸ‘€ User Interface"]
        MSG["πŸ’¬ Chat Message"]
        IMG["πŸ“Έ Image Upload"]
    end

    subgraph Chat["πŸ’¬ Chat Engine"]
        HIS[("πŸ’Ύ Chat History")]
        CTX["πŸ“‹ Context Builder"]
    end

    subgraph AI["πŸ€– Vercel AI SDK"]
        STR["πŸ“‘ useChat Hook"]
        CL["🧠 Claude API"]
        TOK["πŸ“Š Token Stream"]
    end

    subgraph Render["πŸ–₯️ UI Render"]
        MD["πŸ“ Markdown Parser"]
        CB["πŸ“¦ Code Blocks"]
        PRV["⚑ Live Preview"]
    end

    MSG --> HIS
    IMG --> HIS
    HIS --> CTX
    CTX --> STR
    STR --> CL
    CL --> TOK
    TOK --> MD
    MD --> CB
    CB --> PRV
                

Live Preview Engine

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart LR
    subgraph Code["πŸ“ Generated Code"]
        TSX["βš›οΈ Component TSX"]
        CSS["🎨 Tailwind Classes"]
    end

    subgraph Bundle["πŸ“¦ Bundler"]
        ESB["⚑ ESBuild/SWC"]
        DEP["πŸ“š Resolve Deps"]
    end

    subgraph Sandbox["πŸ–οΈ Sandpack Runtime"]
        IF["πŸ“„ iframe Sandbox"]
        RC["βš›οΈ React Runtime"]
        TW["🎨 Tailwind CDN"]
    end

    subgraph Display["πŸ–₯️ Preview"]
        RND["🎯 Rendered UI"]
        ERR["⚠️ Error Boundary"]
        ACT["πŸ–±οΈ Interactive"]
    end

    TSX --> ESB
    CSS --> ESB
    ESB --> DEP
    DEP --> IF
    IF --> RC
    IF --> TW
    RC --> RND
    RC --> ERR
    RND --> ACT
                

Iterative Refinement Loop

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart TB
    subgraph Initial["πŸ“₯ Initial Request"]
        REQ["πŸ’¬ Create component"]
    end

    subgraph Generate["πŸ€– Generation"]
        GEN["🧠 Claude generates"]
        V1["πŸ“¦ Version 1"]
    end

    subgraph Preview["⚑ Preview"]
        PRV["πŸ–₯️ Live Preview"]
        CHK{"βœ… Satisfied?"}
    end

    subgraph Refine["πŸ”„ Refinement"]
        FB["πŸ’¬ User Feedback"]
        CTX["πŸ“‹ Context + History"]
        UPD["πŸ”§ Update Code"]
    end

    subgraph Final["πŸ“€ Output"]
        EXP["πŸ“¦ Export Code"]
        DL["⬇️ Download"]
    end

    REQ --> GEN
    GEN --> V1
    V1 --> PRV
    PRV --> CHK
    CHK -->|"No"| FB
    FB --> CTX
    CTX --> UPD
    UPD --> PRV
    CHK -->|"Yes"| EXP
    EXP --> DL
                

Complete System Architecture

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#C17852', 'primaryTextColor': '#F0F6FC', 'primaryBorderColor': '#4A5E32', 'lineColor': '#E6C98F', 'secondaryColor': '#161B22', 'tertiaryColor': '#0D1117', 'background': '#0D1117', 'mainBkg': '#161B22', 'nodeBorder': '#4A5E32', 'clusterBkg': '#161B22', 'clusterBorder': '#4A5E32', 'titleColor': '#E6C98F', 'edgeLabelBackground': '#161B22'}}}%%
flowchart TB
    subgraph Client["πŸ–₯️ Next.js Frontend"]
        UI["πŸ’¬ Chat UI"]
        PV["⚑ Preview Panel"]
        ED["πŸ“ Code Editor"]
    end

    subgraph API["πŸ”Œ API Routes"]
        CH["πŸ’¬ /api/chat"]
        GN["πŸ€– /api/generate"]
    end

    subgraph AI["🧠 AI Layer"]
        VER["πŸ“¦ Vercel AI SDK"]
        CL["πŸ€– Claude API
Anthropic"] end subgraph State["πŸ’Ύ State Management"] VFS[("πŸ“ Virtual FS")] HIST[("πŸ’¬ Chat History")] end subgraph Preview["πŸ–οΈ Sandpack"] SB["πŸ“¦ Sandbox Runtime"] HMR["πŸ”₯ Hot Module Reload"] end UI <--> CH UI --> GN CH --> VER GN --> VER VER <--> CL VER --> VFS CH --> HIST VFS --> SB SB --> HMR HMR --> PV VFS --> ED