This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Essential Commands:
bun install- Install dependencies (project requires Bun runtime)bun dev- Start development server on port 3443bun build- Production buildbun lint- Run ESLintbun format- Format code with Prettierbun typecheck- TypeScript type checkingbun check- Run all checks (lint + format + typecheck + build)bun fix- Auto-fix linting and formatting issues
Environment Setup:
- Copy
.env.exampleto.envbefore starting - Requires Node.js LTS (20.x) and latest Bun runtime
This is a sophisticated Ethereum social networking app built on multiple blockchain layers:
Core Smart Contracts (EFP Protocol):
EFPListRegistry- NFT-based ownership of follow listsEFPListRecords- Stores follow/unfollow operationsEFPAccountMetadata- User profile metadataEFPListMinter- Creates new follow lists
Multi-Chain Architecture:
- Base (primary chain, low fees)
- Optimism (L2 scaling)
- Ethereum Mainnet (core protocol)
- Contract addresses vary per chain (see
src/lib/constants/contracts.ts)
Web3 Stack:
- Wagmi v2 + Viem v2 for Ethereum interactions
- RainbowKit for wallet connections
- Ethereum Identity Kit for ENS/identity management
- Thirdweb for additional web3 functionality
TanStack Query (React Query):
- Primary data fetching and caching layer
- Infinite queries for paginated followers/following lists
- Optimistic updates for blockchain transactions
- Persistent caching with localStorage integration
React Contexts:
EFPProfileProvider- Core user state, profiles, lists, followsSoundsProvider- Audio feedback systemRecommendedProfilesProvider- Discovery and recommendations
Dynamic User Routing:
[user]parameter accepts ENS names, addresses, or list IDs- Automatic resolution and metadata generation
- SSR with proper social sharing metadata
List Operations System:
- Batch transactions for follow/unfollow operations
- Multi-chain operation support
- Permission-based UI (Owner/Manager/User roles)
- Optimistic UI updates with rollback capability
Internationalization:
- 70+ language variants including creative ones (pirate, shakespearean, corporate)
- React-i18next integration in
src/app/i18n.ts - Locale files in
public/locales/
Feature-Based Organization:
- Components grouped by domain functionality
- Each major component has
components/,hooks/, andindex.tsx - Shared utilities in
src/lib/andsrc/utils/
Key Component Patterns:
profile-list/- Core follow/unfollow managementuser-profile-card/- Profile display with achievementstop-eight/- Featured follows functionalityleaderboard/- Rankings and discoverynavigation/- Header with wallet integration
Data Fetching Patterns:
- API layer organized by domain in
src/api/ - Infinite scroll patterns for large lists
- Real-time updates via custom event system
- Graceful error handling and loading states
Type Safety:
- Strict TypeScript configuration
- Full ABI type generation for smart contracts
- Viem's type-safe contract interactions
- Runtime validation with Valibot
Performance Optimizations:
- React 19 concurrent features enabled
- Dynamic imports for code splitting
- Batch RPC calls with fallback providers
- Connection state management for web3
Security Features:
- Comprehensive CSP headers in Next.js config
- Sentry integration for error tracking
- No sensitive data in client-side code
- Proper permission validation
When Working with Blockchain Features:
- Always use the EFP Profile context for user-related state
- Route blockchain operations through the transaction context
- Test on multiple chains (Base primary, then Optimism/Mainnet)
- Consider gas costs and transaction batching
- Handle network failures gracefully
When Adding New Features:
- Follow existing infinite scroll patterns for lists
- Use TanStack Query for all data fetching
- Maintain multi-chain compatibility
- Add proper TypeScript types
- Consider internationalization for user-facing text
- Test wallet connection edge cases
Code Patterns to Follow:
- Use
ethereum-identity-kitfor ENS resolution - Implement optimistic updates for better UX
- Follow existing error handling patterns
- Use the established loading state components
- Maintain accessibility standards
The codebase emphasizes type safety, performance, and user experience while handling the complexity of multi-chain blockchain interactions and real-time social networking features.