Architecture
ProductClank Arena is built on a modern, scalable architecture combining blockchain technology with traditional web infrastructure.
Technology Stack
Frontend
- Framework: Next.js 15 with App Router
- Styling: Tailwind CSS with custom components
- UI Components: Radix UI primitives
- State Management: React Query for server state, Jotai for client state
- Animations: Motion (Framer Motion)
Backend
- Runtime: Next.js API Routes
- Database: Supabase (PostgreSQL)
- Authentication: Farcaster Frame SDK + Privy
- File Storage: Supabase Storage
Blockchain
- Network: Base (Ethereum L2)
- Smart Contracts: Solidity (0.8.20+)
- Web3 Libraries: wagmi, viem, ethers
- Token Standard: ERC-20 (USDC)
System Architecture
Application Layers
┌─────────────────────────────────────┐
│ Frontend (Next.js) │
│ - Web App │
│ - Farcaster Frames │
│ - Mobile-Optimized UI │
└──────────────┬──────────────────────┘
│
┌──────────────▼──────────────────────┐
│ API Layer (Next.js API) │
│ - REST Endpoints │
│ - Server Actions │
│ - Authentication │
└──────────────┬──────────────────────┘
│
┌──────────┴──────────┐
│ │
┌───▼──────┐ ┌───────▼──────┐
│ Database │ │ Blockchain │
│ Supabase │ │ Base │
│ │ │ │
│ PostgreSQL│ │ Smart Contracts│
└──────────┘ └───────────────┘Route Structure
src/app/
├── (frame)/ # Farcaster Frame interface
├── (web)/ # Traditional web interface
├── (miniapp)/ # Embedded mini app interface
├── api/ # API routes
│ ├── auction/ # Auction endpoints
│ ├── bids/ # Bidding endpoints
│ ├── campaigns/ # Campaign endpoints
│ └── products/ # Product endpoints
└── docs/ # Documentation siteKey Components
Product Management
- Product submission and editing
- Media upload and storage
- Search and filtering
- Voting ("believe") system
Campaign System
- Campaign creation and management
- Action item tracking
- Reward distribution
- Participation verification
Auction System
- On-chain auction contract
- Bid placement and tracking
- Automatic settlement
- Winner selection
Leaderboard System
- Real-time point calculation
- Daily snapshots
- Weighted allocation
- CSV export functionality
Data Flow
Product Submission Flow
- User submits product via frontend
- API validates and processes data
- Media uploaded to Supabase Storage
- Product record created in database
- Product appears in feed
Auction Bidding Flow
- User initiates bid via frontend
- Frontend checks USDC allowance
- User approves spending (if needed)
- Bid transaction sent to blockchain
- Contract validates and processes bid
- Database updated with bid record
- Previous bidder refunded (if applicable)
Security Features
- Authentication: Farcaster + Privy wallet connection
- Authorization: Role-based access control
- Rate Limiting: API rate limits to prevent abuse
- Input Validation: Server-side validation of all inputs
- Smart Contract Security: Reentrancy guards, pausable, ownable
Performance Optimizations
- React Query for efficient data fetching
- Image optimization via Next.js Image
- Database indexing for fast queries
- Batch operations for bulk updates
- Caching strategies for frequently accessed data
