7.9 KiB
๐ PollCelo Deployment Guide
Complete guide to deploy PollCelo to production in under 30 minutes.
Prerequisites Checklist
- GitHub account
- Vercel account (free tier works)
- Upstash Redis account (optional, free tier)
- Celo wallet with address for receiving fees
- Domain name (optional)
Step 1: Prepare Your Repository
1.1 Push to GitHub
cd daily-poll-mini-app
git init
git add .
git commit -m "Initial commit: PollCelo app"
git branch -M main
git remote add origin https://github.com/yourusername/pollcelo.git
git push -u origin main
Step 2: Set Up Upstash Redis (Optional but Recommended)
2.1 Create Redis Database
- Go to Upstash
- Sign up / Log in
- Click "Create Database"
- Choose:
- Name: pollcelo-prod
- Type: Regional
- Region: Choose closest to your users (e.g., us-east-1 for US)
- TLS: Enabled
- Click "Create"
2.2 Get Credentials
- Click on your database
- Scroll to "REST API" section
- Copy:
UPSTASH_REDIS_REST_URLUPSTASH_REDIS_REST_TOKEN
- Save these for Vercel setup
Step 3: Deploy to Vercel
3.1 Import Project
- Go to Vercel Dashboard
- Click "Add New..." โ "Project"
- Import your GitHub repository
- Select the
pollcelorepository
3.2 Configure Build Settings
Vercel should auto-detect Next.js. Verify:
- Framework Preset: Next.js
- Build Command:
npm run build - Output Directory:
.next - Install Command:
npm install - Root Directory:
./(or path to daily-poll-mini-app)
3.3 Add Environment Variables
Click "Environment Variables" and add:
# Upstash Redis (optional)
UPSTASH_REDIS_REST_URL=https://your-redis.upstash.io
UPSTASH_REDIS_REST_TOKEN=your_token_here
# Celo Network
NEXT_PUBLIC_CELO_RPC_URL=https://forno.celo.org
NEXT_PUBLIC_CUSD_ADDRESS=0x765DE816845861e75A25fCA122bb6898B8B1282a
# Your Wallet (IMPORTANT!)
PROTOCOL_WALLET_ADDRESS=0xYourCeloWalletAddressHere
# App URL (leave blank for now, update after deploy)
NEXT_PUBLIC_APP_URL=
3.4 Deploy
- Click "Deploy"
- Wait 2-3 minutes for build to complete
- Copy your Vercel URL (e.g.,
https://pollcelo.vercel.app)
3.5 Update App URL
- Go to Settings โ Environment Variables
- Edit
NEXT_PUBLIC_APP_URL - Set to your Vercel URL:
https://pollcelo.vercel.app - Click "Save"
- Redeploy: Deployments โ Click โขโขโข โ Redeploy
Step 4: Configure Custom Domain (Optional)
4.1 Add Domain to Vercel
- Go to Settings โ Domains
- Enter your domain (e.g.,
pollcelo.com) - Click "Add"
4.2 Update DNS
Vercel will show you DNS records to add:
For root domain (pollcelo.com):
- Type:
A - Name:
@ - Value:
76.76.21.21
For www subdomain:
- Type:
CNAME - Name:
www - Value:
cname.vercel-dns.com
4.3 Wait for DNS Propagation
- Usually takes 5-60 minutes
- Vercel will auto-provision SSL certificate
4.4 Update Environment Variable
- Go to Settings โ Environment Variables
- Update
NEXT_PUBLIC_APP_URLto your custom domain - Redeploy
Step 5: Test in Warpcast
5.1 Install Warpcast Mobile App
- iOS: App Store
- Android: Play Store
5.2 Enable Developer Mode
- Open Warpcast
- Go to Settings โ Advanced
- Enable "Developer Mode"
5.3 Test Your MiniApp
- Create a cast with your Vercel URL
- Tap the Frame preview
- It should open as a MiniApp
- Test voting with MiniPay
Step 6: Submit to Warpcast Directory (Optional)
6.1 Prepare Assets
Create these files in your repo:
public/
โโโ icon-192.png # 192x192 app icon
โโโ icon-512.png # 512x512 app icon
โโโ og-image.png # 1200x630 OG image
6.2 Submit to Directory
- Go to Warpcast Directory
- Click "Submit App"
- Fill in details:
- Name: PollCelo
- Description: Daily polls with cUSD rewards
- Category: Social, Finance
- URL: Your production URL
- Submit for review
Step 7: Monitor & Maintain
7.1 Vercel Analytics
- Enable in Vercel dashboard
- Track:
- Page views
- Unique visitors
- Performance metrics
7.2 Upstash Monitoring
- Check Redis dashboard
- Monitor:
- Request count
- Storage usage
- Errors
7.3 Wallet Monitoring
Check your protocol wallet regularly:
- Track incoming votes (cUSD received)
- Distribute winnings to users
- Withdraw protocol fees
Step 8: Set Up Auto-Distribution (Advanced)
Option A: Manual Daily Script
Create scripts/distribute.ts:
import { getPoll, calculateWinnings } from '@/lib/polls'
async function distributeDailyWinnings() {
// 1. Get yesterday's poll
// 2. Calculate all winners
// 3. Send cUSD proportionally
// 4. Log transactions
}
distributeDailyWinnings()
Run via cron:
0 0 * * * cd /path/to/app && npm run distribute
Option B: Deploy Smart Contract
See contracts/PollDistributor.sol for automated distribution.
Troubleshooting
Build Fails on Vercel
Error: "Module not found"
- Check all imports use absolute paths (
@/...) - Verify
tsconfig.jsonhas correctpaths
Error: "Environment variable missing"
- Add all required env vars in Vercel dashboard
- Make sure
NEXT_PUBLIC_prefix for client-side vars
Frame Not Working in Warpcast
Frame doesn't show
- Check OG meta tags in
/poll/[id]/layout.tsx - Verify OG image URL is publicly accessible
- Use Warpcast Debugger
MiniApp won't open
- Verify
fc:frametags are correct - Check SDK initialization in
providers.tsx - Enable Developer Mode in Warpcast
Voting Fails
Transaction rejected
- Check user has enough cUSD + CELO for gas
- Verify
PROTOCOL_WALLET_ADDRESSis correct - Test on Celo testnet first (Alfajores)
Vote not recorded
- Check Redis connection
- Look at Vercel function logs
- Verify
submitVote()is called correctly
Post-Launch Checklist
- Deploy to Vercel โ
- Add custom domain
- Test voting flow end-to-end
- Share first poll on Warpcast
- Monitor Vercel analytics
- Set up daily distribution
- Submit to Warpcast directory
- Announce on social media
- Collect user feedback
- Plan Week 2 features
Performance Optimization
Enable Edge Functions
In app/api/*/route.ts:
export const runtime = 'edge'
Enable Image Optimization
In next.config.ts:
images: {
formats: ['image/avif', 'image/webp'],
deviceSizes: [640, 750, 828, 1080, 1200],
}
Enable Caching
Add to API routes:
export const revalidate = 60 // Cache for 60 seconds
Scaling Considerations
When to upgrade:
- >1,000 daily users: Upgrade Upstash plan
- >10,000 daily users: Add Vercel Pro for better analytics
- >100,000 daily users: Deploy smart contract for auto-distribution
- >1M daily users: Consider dedicated infrastructure
Security Checklist
- Never commit
.env.localto git - Use environment variables for all secrets
- Validate all user inputs
- Rate limit API routes
- Monitor for suspicious transactions
- Keep dependencies updated
- Use HTTPS only
- Enable Vercel DDoS protection
Cost Estimate
Free tier (0-1,000 users/day):
- Vercel: Free
- Upstash Redis: Free (10K requests/day)
- Celo gas: ~$0.001 per transaction
- Total: ~$0-5/month
Growth tier (1,000-10,000 users/day):
- Vercel Pro: $20/month
- Upstash: $10/month (100K requests/day)
- Celo gas: ~$10/month
- Total: ~$40/month
Success! ๐
Your PollCelo app is now live and ready to get viral on Farcaster!
Next steps:
- Share your first poll
- Engage with early users
- Iterate based on feedback
- Scale infrastructure as you grow
Let's get thousands of users voting with cUSD! ๐