audit-infra
Infrastructure-first security audit โ secrets, supply chain, CI/CD, LLM/skill security, OWASP, STRIDE. Complements /audit-solana (program-level)
Build web client application (Next.js, React, Vite)
> /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.
/build-appContext preview
What this command does when you run it.
Build web client application (Next.js, React, Vite)
description: "Build web client application (Next.js, React, Vite)"
You are building a web client application. Follow these steps:
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
fiecho "๐ฆ 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 installecho "๐ง 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"
fiecho "๐ 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"
fiecho "๐ 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
fiecho "๐จ 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
;;
esacecho ""
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" ;;
esacecho ""
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"
;;
esacecho ""
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"
echoProduction-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.
Repo: solanabr/solana-ai-kit
Infrastructure-first security audit โ secrets, supply chain, CI/CD, LLM/skill security, OWASP, STRIDE. Complements /audit-solana (program-level)
Benchmark CU usage and compare against baseline for regression detection