A festive Web3 Farcaster Mini App built on Base that lets users add a blue Christmas cap to their profile picture, create it as an on-chain PFP, and earn points!
- π Upload & Transform: Upload your PFP and automatically add a festive blue Christmas cap
- π IPFS Storage: Securely store your capped PFP on IPFS via Pinata
- βοΈ On-Chain creating: Create your Christmas PFP on Base blockchain for 0.1 USDC
- π― Points System: Earn 2 points for every PFP created
- π User Dashboard: View your stats, points, and created PFPs
- π Farcaster Auth: Seamless authentication using Farcaster accounts
- π° Multi-Wallet Support: Compatible with EVM and Solana wallets
- π± Mobile Responsive: Works perfectly on all devices
- Frontend: Next.js 15, React 19, TypeScript
- Styling: Tailwind CSS with custom festive theme
- Blockchain: Base (Ethereum L2)
- Wallet Connection: Wagmi v2, Reown AppKit
- Authentication: Farcaster Quick Auth, NextAuth.js
- Storage: IPFS via Pinata
- Smart Contract: Solidity 0.8.20 with OpenZeppelin
- Image Processing: Canvas API for overlay rendering
- Node.js 18+ and pnpm
- Farcaster account
- Neynar API key
- Pinata account (for IPFS)
- Base wallet with USDC (for creating)
-
Clone the repository
git clone https://github.com/16navigabraham/based-christmas.git cd based-christmas -
Install dependencies
pnpm install
-
Set up environment variables
Copy
.env.exampleto.env.local:cp .env.example .env.local
Fill in your credentials:
# Neynar API Configuration NEYNAR_API_KEY=your_neynar_api_key_here NEXT_PUBLIC_NEYNAR_CLIENT_ID=your_client_id_here # Reown (WalletConnect) Configuration NEXT_PUBLIC_REOWN_PROJECT_ID=your_reown_project_id_here # Pinata (IPFS) Configuration NEXT_PUBLIC_PINATA_JWT=your_pinata_jwt_here NEXT_PUBLIC_PINATA_GATEWAY_URL=your_gateway_url_here # Base Configuration (Mainnet) NEXT_PUBLIC_BASE_RPC_URL=https://mainnet.base.org NEXT_PUBLIC_CHRISTMAS_CAP_CONTRACT=0xYourContractAddress # Redis (Upstash) for KV Storage UPSTASH_REDIS_REST_URL=your_upstash_url UPSTASH_REDIS_REST_TOKEN=your_upstash_token
-
Run the development server
pnpm dev
Open http://localhost:3000 in your browser.
- Go to Neynar Dashboard
- Create a new app
- Copy your API key and Client ID
- Visit Reown Cloud
- Create a new project
- Copy your Project ID
- Sign up at Pinata
- Go to API Keys section
- Create a new API key with pinning permissions
- Copy the JWT token
- Set up a gateway and copy the gateway URL
- Create account at Upstash
- Create a new Redis database
- Copy the REST URL and token
The ChristmasCapPFP contract is deployed on Base mainnet:
- Price: 0.1 USDC per create
- Points: 2 points awarded per create
- Storage: Stores capped image IPFS URL
- Events: Emits
PFPCreatedandPointsAwardedevents - Owner Functions:
withdraw()to collect USDC
Update NEXT_PUBLIC_CHRISTMAS_CAP_CONTRACT in .env.local with your deployed contract address.
- Upload: User uploads their profile picture
- Preview: App generates preview with blue Christmas cap overlay
- Connect Wallet: User connects their wallet (EVM or Solana)
- IPFS Upload: Capped image is uploaded to IPFS via Pinata
- Approve USDC: User approves 0.1 USDC to the contract
- Create: Contract creates the PFP and awards 2 points
- Success: User can download and share their festive PFP!
based-christmas/
βββ contract/ # Smart contract source
β βββ PFP.SOL # ChristmasCapPFP contract
βββ src/
β βββ app/ # Next.js app routes
β β βββ api/ # API endpoints
β β βββ share/ # Share page for FIDs
β βββ components/ # React components
β β βββ christmas/ # Christmas-specific components
β β β βββ UserDashboard.tsx
β β β βββ ...
β β βββ ui/ # UI components
β β βββ christmas/
β β βββ ImageUpload.tsx
β β βββ CapPreview.tsx
β β βββ MintFlow.tsx
β βββ hooks/ # Custom React hooks
β βββ lib/ # Utilities and helpers
β β βββ contracts.ts # Contract ABI & config
β β βββ imageProcessing.ts
β β βββ ipfs.ts
β β βββ ...
β βββ auth.ts # NextAuth configuration
βββ public/
β βββ assets/
β βββ christmas-cap.svg
βββ scripts/ # Build and deployment scripts
Handles drag-and-drop or click-to-upload functionality for user PFPs.
Renders the uploaded image with the blue Christmas cap overlay using Canvas API.
Manages the complete creating process:
- IPFS upload
- USDC approval
- Contract interaction
- Success state with download option
Displays user statistics:
- Total points earned
- Number of PFPs created
- Latest created PFP preview
pnpm dev # Start development server
pnpm build # Build for production
pnpm start # Start production server
pnpm lint # Run ESLint
pnpm cleanup # Clean up build files
pnpm deploy:vercel # Deploy to Vercel- Use Base Sepolia testnet for testing
- Get test USDC from faucets
- Update contract address in
.env.local - Test the complete flow before mainnet deployment
- Push your code to GitHub
- Import project in Vercel
- Add all environment variables from
.env.local - Deploy!
Or use the CLI:
pnpm deploy:vercelAfter deploying your smart contract to Base:
- Copy the contract address
- Update
NEXT_PUBLIC_CHRISTMAS_CAP_CONTRACTin Vercel environment variables - Redeploy the app
| Variable | Description | Required |
|---|---|---|
NEYNAR_API_KEY |
Neynar API key for Farcaster | Yes |
NEXT_PUBLIC_NEYNAR_CLIENT_ID |
Neynar client ID | Yes |
NEXT_PUBLIC_REOWN_PROJECT_ID |
Reown/WalletConnect project ID | Yes |
NEXT_PUBLIC_PINATA_JWT |
Pinata JWT for IPFS uploads | Yes |
NEXT_PUBLIC_PINATA_GATEWAY_URL |
Pinata gateway URL | Yes |
NEXT_PUBLIC_BASE_RPC_URL |
Base RPC endpoint | Yes |
NEXT_PUBLIC_CHRISTMAS_CAP_CONTRACT |
Deployed contract address | Yes |
UPSTASH_REDIS_REST_URL |
Upstash Redis URL | Yes |
UPSTASH_REDIS_REST_TOKEN |
Upstash Redis token | Yes |
The app uses a festive blue and white Christmas theme:
- Primary: Blue (#3b82f6)
- Accent: Light blue
- Background: White with subtle gradients
- Cards: Glassmorphism effect
- Buttons: Rounded with hover effects
"Payment failed" error
- Ensure you have sufficient USDC in your wallet
- Check USDC approval was successful
- Verify contract address is correct
IPFS upload fails
- Check Pinata JWT is valid
- Ensure Pinata account has sufficient storage
- Verify image size is under limits
Wallet won't connect
- Clear browser cache
- Try different wallet provider
- Check network is set to Base
Transaction pending forever
- Check Base network status
- Increase gas price if needed
- Verify RPC endpoint is responding
MIT License - see LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Create an issue for bug reports
- Join our Farcaster channel for discussions
- Check existing issues before creating new ones
- Built for the Farcaster ecosystem
- Powered by Base blockchain
- Using Pinata for decentralized storage
- Styled with Tailwind CSS
Made with β€οΈ for the festive season π
Happy Holidays! π π