Skip to content
Development
Command

/build-app

Build web client application (Next.js, React, Vite)

From plugin
solana-ai-kit
10130 skills15 agents30 commands7 MCP
Install
> /plugin marketplace add solanabr/solana-ai-kit
> /plugin install solana-ai-kit@stbr

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/build-app

Context preview

What this command does when you run it.

Build web client application (Next.js, React, Vite)

Command definition

build-app.md
description: "Build web client application (Next.js, React, Vite)"

You are building a web client application. Follow these steps:

Related Skills

  • [frontend-framework-kit.md](../skills/ext/solana-dev/skill/references/frontend-framework-kit.md) - React/Next.js patterns

Step 1: Detect Framework

echo "๐Ÿ” Detecting web framework..."

# Check for Next.js
if grep -q "\"next\"" package.json 2>/dev/null; then
    echo "โšก Next.js project detected"
    FRAMEWORK="nextjs"
# Check for Vite
elif [ -f "vite.config.ts" ] || [ -f "vite.config.js" ]; then
    echo "โšก Vite project detected"
    FRAMEWORK="vite"
# Check for Create React App
elif grep -q "react-scripts" package.json 2>/dev/null; then
    echo "โš›๏ธ  Create React App detected"
    FRAMEWORK="cra"
# Generic React/Node
elif [ -f "package.json" ]; then
    echo "๐Ÿ“ฆ Node.js project detected"
    FRAMEWORK="node"
else
    echo "โŒ No package.json found"
    exit 1
fi

Step 2: Install Dependencies

echo "๐Ÿ“ฆ Installing dependencies..."

# Check for lock files to determine package manager
if [ -f "pnpm-lock.yaml" ]; then
    PKG_MANAGER="pnpm"
elif [ -f "yarn.lock" ]; then
    PKG_MANAGER="yarn"
elif [ -f "bun.lockb" ]; then
    PKG_MANAGER="bun"
else
    PKG_MANAGER="npm"
fi

echo "Using package manager: $PKG_MANAGER"

# Install
$PKG_MANAGER install

Step 3: Environment Configuration

echo "๐Ÿ”ง Checking environment configuration..."

# Check for required env files
if [ -f ".env.example" ] && [ ! -f ".env.local" ]; then
    echo "โš ๏ธ  Missing .env.local - copying from .env.example"
    cp .env.example .env.local
    echo "๐Ÿ“ Please update .env.local with your values"
fi

# Verify Solana program ID is set
if grep -q "PROGRAM_ID\|NEXT_PUBLIC_PROGRAM_ID" .env.local 2>/dev/null; then
    echo "โœ… Program ID configured"
else
    echo "โš ๏ธ  Warning: No PROGRAM_ID found in environment"
    echo "   Add: NEXT_PUBLIC_PROGRAM_ID=<your-program-id>"
fi

# Verify RPC endpoint
if grep -q "RPC_URL\|NEXT_PUBLIC_RPC" .env.local 2>/dev/null; then
    echo "โœ… RPC endpoint configured"
else
    echo "โ„น๏ธ  Using default RPC endpoint"
fi

Step 4: Type Check (TypeScript)

echo "๐Ÿ“ Running type check..."

if [ -f "tsconfig.json" ]; then
    $PKG_MANAGER run typecheck 2>/dev/null || npx tsc --noEmit
    
    if [ $? -eq 0 ]; then
        echo "โœ… Type check passed"
    else
        echo "โŒ Type errors found - fix before building"
        exit 1
    fi
else
    echo "โ„น๏ธ  No TypeScript config found, skipping type check"
fi

Step 5: Lint Check

echo "๐Ÿ” Running linter..."

if grep -q "eslint" package.json 2>/dev/null; then
    $PKG_MANAGER run lint 2>/dev/null || npx eslint . --ext .ts,.tsx,.js,.jsx
    
    if [ $? -eq 0 ]; then
        echo "โœ… Lint check passed"
    else
        echo "โš ๏ธ  Lint warnings found (non-blocking)"
    fi
fi

Step 6: Build Application

echo "๐Ÿ”จ Building application..."

case $FRAMEWORK in
    "nextjs")
        echo "Building Next.js app..."
        $PKG_MANAGER run build
        
        # Check build output
        if [ -d ".next" ]; then
            echo "โœ… Next.js build successful"
            echo ""
            echo "๐Ÿ“Š Build output:"
            du -sh .next
        fi
        ;;
        
    "vite")
        echo "Building Vite app..."
        $PKG_MANAGER run build
        
        if [ -d "dist" ]; then
            echo "โœ… Vite build successful"
            echo ""
            echo "๐Ÿ“Š Build output:"
            du -sh dist
            ls -lh dist
        fi
        ;;
        
    "cra")
        echo "Building Create React App..."
        $PKG_MANAGER run build
        
        if [ -d "build" ]; then
            echo "โœ… CRA build successful"
            echo ""
            echo "๐Ÿ“Š Build output:"
            du -sh build
        fi
        ;;
        
    *)
        echo "Building with default script..."
        $PKG_MANAGER run build
        ;;
esac

Step 7: Verify Build

echo ""
echo "๐Ÿ” Verifying build..."

# Check for common issues
verify_build() {
    local build_dir=$1
    
    # Check for source maps in production (security concern)
    if find "$build_dir" -name "*.map" | head -1 | grep -q .; then
        echo "โš ๏ธ  Warning: Source maps found in build"
        echo "   Consider disabling for production"
    fi
    
    # Check bundle sizes
    echo ""
    echo "๐Ÿ“ฆ Bundle analysis:"
    if [ "$FRAMEWORK" = "nextjs" ]; then
        # Next.js has built-in bundle analysis
        cat .next/build-manifest.json 2>/dev/null | head -20 || true
    else
        # Generic bundle size check
        find "$build_dir" -name "*.js" -exec ls -lh {} \; | head -10
    fi
}

case $FRAMEWORK in
    "nextjs") verify_build ".next" ;;
    "vite") verify_build "dist" ;;
    "cra") verify_build "build" ;;
esac

Step 8: Test Build Locally (Optional)

echo ""
echo "๐Ÿš€ Testing build locally..."

case $FRAMEWORK in
    "nextjs")
        echo "Starting Next.js production server..."
        echo "Run: $PKG_MANAGER run start"
        echo "Then visit: http://localhost:3000"
        ;;
        
    "vite")
        echo "Previewing Vite build..."
        echo "Run: $PKG_MANAGER run preview"
        echo "Then visit: http://localhost:4173"
        ;;
        
    "cra")
        echo "Serving CRA build..."
        echo "Run: npx serve -s build"
        echo "Then visit: http://localhost:3000"
        ;;
esac

Build Summary

echo ""
echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”"
echo "โœ… BUILD COMPLETE"
echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”"
echo ""
echo "Framework: $FRAMEWORK"
echo "Package Manager: $PKG_MANAGER"
echo ""
echo "๐Ÿ“ Output location:"
case $FRAMEWORK in
    "nextjs") echo "   .next/" ;;
    "vite") echo "   dist/" ;;
    "cra") echo "   build/" ;;
esac
echo ""
echo "๐Ÿ’ก Next steps:"
echo "   - Test locally: $PKG_MANAGER run start (or preview)"
echo "   - Deploy: Connect to Vercel, Netlify, or your hosting"
echo
Read more
Ships withsolana-ai-kit

Production-ready Claude Code configuration for full-stack Solana development. Combines best practices from multiple sources into an agent-optimized, token-efficient config you can install and adapt to your specific project.

Get the whole plugin

Other commands on solana-ai-kit.