This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Run linting
npm run lint
# Preview production build
npm run preview- Frontend: React 18 + TypeScript + Vite
- Styling: Tailwind CSS with custom Venmo-inspired design system
- Database: Supabase (PostgreSQL) with Row Level Security
- Blockchain: thirdweb API v1 for Web3 operations
- Authentication: thirdweb email verification + JWT tokens
- Authentication: Email + 6-digit code via thirdweb API (
src/utils/thirdwebAPI.ts) - User Management: Supabase stores user profiles linked to wallet addresses
- Payment Flow: Three-step process (search → form → confirm) using thirdweb Payment API
- State Management: React Context (
src/context/AuthContext.tsx) with local storage persistence
src/App.tsx: Main app component managing payment flow state and tab navigationsrc/context/AuthContext.tsx: Authentication state management with localStorage persistencesrc/utils/thirdwebAPI.ts: Complete thirdweb API integration (auth, payments, balances, transactions)src/utils/supabase.ts: Database operations and real-time subscriptionssrc/utils/contracts.ts: Multi-chain token contract configuration and amount formatting
src/components/
├── auth/ # LoginForm, UsernameSetup
├── payments/ # BalanceDisplay, SendPayment, PaymentConfirm
├── users/ # UserSearch
├── transactions/ # TransactionHistory with real-time updates
└── ui/ # Layout with bottom navigation
Two main tables in Supabase:
users: email, username, wallet_address, display_nametransactions: payment records with thirdweb integration and status tracking
Run sql/supabase-schema.sql to set up the database with permissive RLS policies for development.
Copy env.example to .env and configure:
VITE_THIRDWEB_CLIENT_ID: thirdweb project client IDVITE_SUPABASE_URLandVITE_SUPABASE_ANON_KEY: Supabase project credentials- Chain and token contract addresses (defaults provided for Base, Ethereum, Polygon)
Default chain is Base (8453) with USDC as primary token. The app supports:
- Base: Native USDC (
0x833589fcd6edb6e08f4c7c32d4f71b54bda02913) - Ethereum: USDC and USDT
- Polygon: USDC and USDT (bridged versions)
Token contracts and chain configuration managed in src/utils/contracts.ts.
The app uses thirdweb's Payment API for secure stablecoin transfers:
- Create Payment:
POST /v1/paymentswith recipient, token, and amount - Complete Payment:
POST /v1/payments/{id}with sender wallet address - Handle Insufficient Funds: 402 responses include payment links for funding wallets
The codebase includes several React performance optimizations:
useCallbackanduseMemohooks to prevent infinite re-renders- Proper dependency arrays in
useEffecthooks - Memoized components for balance display and payment forms
- Infinite Re-render Loops: Usually caused by missing dependency arrays in useEffect/useCallback
- thirdweb API Errors: Ensure both
x-client-idandAuthorization: Bearer {JWT}headers are present - Supabase 406 Errors: RLS policies are permissive for development; check if anon user has proper grants
- Balance Display Errors: Use null checks and fallbacks in
formatTokenAmountutility
- Transaction history updates in real-time via Supabase subscriptions
- Balance refreshes after successful payments
- Transaction status polling for pending thirdweb transactions
The UI is built mobile-first with:
- Bottom navigation matching Venmo UX patterns
- Touch-friendly interfaces and button sizes
- Responsive layouts that scale to desktop
- Custom CSS classes following
venmo-cardpattern for consistent styling
After making changes, always run:
npm run lint # Check for linting issues
npm run build # Ensure production build succeeds- NEVER create files unless absolutely necessary for achieving your goal
- ALWAYS prefer editing existing files to creating new ones
- NEVER proactively create documentation files (*.md) or README files unless explicitly requested
- Authentication flow must be tested with real thirdweb credentials
- All environment variables must be properly configured before testing payments
- Use
sql/supabase-schema.sqlfor fresh database setup
The project includes AGENTS.md - a comprehensive specification for building this app from scratch using AI coding assistants. This file contains:
- Complete technical specifications for all features
- Implementation directives for AI agents
- Step-by-step development phases
- Integration guidelines for thirdweb and Supabase APIs