celo-poll/PUBLISH_FARCASTER.md
2025-12-08 16:31:30 +03:00

358 lines
6.6 KiB
Markdown

# ๐Ÿš€ Publish PollCelo on Farcaster
## โœ… How to Launch as a Mini App
---
## ๐Ÿ“‹ Prerequisites
1. **Deployed App** - Your app must be live on a public URL
2. **Farcaster Account** - You need a Farcaster account
3. **Frame Metadata** - Add Frame tags to your app
---
## ๐ŸŽฏ Step 1: Add Frame Metadata
### Update app/layout.tsx
```typescript
export const metadata: Metadata = {
title: 'PollCelo',
description: 'Daily prediction market on Farcaster',
metadataBase: new URL(process.env.NEXT_PUBLIC_APP_URL!),
openGraph: {
title: 'PollCelo - Daily Prediction Market',
description: 'Vote with cUSD, win daily rewards',
images: ['/og-image.png'],
},
other: {
'fc:frame': 'vNext',
'fc:frame:image': `${process.env.NEXT_PUBLIC_APP_URL}/og-image.png`,
'fc:frame:button:1': 'Vote Now',
'fc:frame:button:1:action': 'link',
'fc:frame:button:1:target': process.env.NEXT_PUBLIC_APP_URL!,
},
}
```
---
## ๐Ÿ–ผ๏ธ Step 2: Create Images
### Icon (512x512)
Create `public/icon.png`:
- Square image
- 512x512 pixels
- PollCelo logo
- Transparent background
### Splash Screen (1200x630)
Create `public/splash.png`:
- 1200x630 pixels
- PollCelo branding
- Solid background (#35D07F)
### OG Image (1200x630)
Create `public/og-image.png`:
- 1200x630 pixels
- Shows today's poll
- Eye-catching design
---
## ๐Ÿ“ฑ Step 3: Create Farcaster Manifest
### app/.well-known/farcaster.json/route.ts
```typescript
import { NextResponse } from 'next/server'
export async function GET() {
return NextResponse.json({
accountAssociation: {
header: "eyJmaWQiOjEyMzQ1..." // Your signature
},
frame: {
version: "1",
name: "PollCelo",
iconUrl: `${process.env.NEXT_PUBLIC_APP_URL}/icon.png`,
splashImageUrl: `${process.env.NEXT_PUBLIC_APP_URL}/splash.png`,
splashBackgroundColor: "#35D07F",
homeUrl: process.env.NEXT_PUBLIC_APP_URL,
}
})
}
```
---
## ๐Ÿ” Step 4: Generate Account Association
### Install Farcaster Auth Kit
```bash
npm install @farcaster/auth-kit
```
### Generate Signature
```typescript
import { createAppClient, viemConnector } from '@farcaster/auth-kit'
const appClient = createAppClient({
ethereum: viemConnector(),
})
// Sign with your custody address
const signature = await appClient.createAccountAssociation({
fid: YOUR_FID,
custody: YOUR_CUSTODY_ADDRESS,
})
console.log(signature) // Use this in manifest
```
---
## ๐Ÿš€ Step 5: Deploy
### 1. Deploy to Vercel
```bash
vercel --prod
```
### 2. Verify Manifest
```bash
curl https://your-app.vercel.app/.well-known/farcaster.json
```
Should return:
```json
{
"accountAssociation": {...},
"frame": {...}
}
```
### 3. Test Frame Metadata
```bash
curl -I https://your-app.vercel.app
```
Should include:
```
fc:frame: vNext
fc:frame:image: https://...
```
---
## ๐Ÿ“ข Step 6: Share on Warpcast
### Option A: Cast with Link
1. Open Warpcast
2. Create new cast
3. Paste your URL: `https://your-app.vercel.app`
4. Warpcast will show Frame preview
5. Cast it!
### Option B: Submit to Frame Directory
1. Go to [Warpcast Frames](https://warpcast.com/~/developers/frames)
2. Click "Submit Frame"
3. Enter your URL
4. Fill out details
5. Submit for review
---
## ๐ŸŽฏ Step 7: Optimize for Discovery
### Add to Cast
```
๐ŸŽฏ PollCelo is live!
Vote on today's poll with cUSD
Win daily rewards ๐Ÿ’ฐ
Try it now ๐Ÿ‘‡
https://your-app.vercel.app
```
### Use Hashtags
```
#Farcaster #Celo #Predictions #DeFi #MiniApp
```
### Tag Relevant Accounts
```
@celo @farcaster
```
---
## ๐Ÿ“Š Frame Validator
### Test Your Frame
1. Go to [Frame Validator](https://warpcast.com/~/developers/frames)
2. Enter your URL
3. Check for errors
4. Fix any issues
5. Re-test
### Common Issues
- โŒ Missing `fc:frame` tag
- โŒ Invalid image URL
- โŒ Missing manifest
- โŒ CORS errors
---
## ๐ŸŽจ Frame Preview
### What Users See
1. **In Feed** - OG image with "Vote Now" button
2. **Click Button** - Opens your app in Warpcast
3. **In App** - Full PollCelo experience
4. **Vote** - Uses their Farcaster account
---
## ๐Ÿ”ง Advanced: Dynamic Frames
### Show Different Polls
```typescript
// app/poll/[id]/page.tsx
export async function generateMetadata({ params }: { params: { id: string } }) {
const poll = await getPoll(params.id)
return {
other: {
'fc:frame': 'vNext',
'fc:frame:image': `${process.env.NEXT_PUBLIC_APP_URL}/api/og?pollId=${params.id}`,
'fc:frame:button:1': `Vote: ${poll.question}`,
'fc:frame:button:1:action': 'link',
'fc:frame:button:1:target': `${process.env.NEXT_PUBLIC_APP_URL}/poll/${params.id}`,
}
}
}
```
---
## ๐Ÿ“ˆ Track Performance
### Analytics to Monitor
- Frame impressions
- Button clicks
- App opens
- Votes cast
- Share rate
### Add to Vercel Analytics
```typescript
import { Analytics } from '@vercel/analytics/react'
export default function RootLayout({ children }) {
return (
<html>
<body>
{children}
<Analytics />
</body>
</html>
)
}
```
---
## โœ… Launch Checklist
### Pre-Launch
- [ ] App deployed to production
- [ ] Frame metadata added
- [ ] Images created (icon, splash, OG)
- [ ] Manifest endpoint working
- [ ] Frame validator passes
- [ ] Tested in Warpcast
### Launch Day
- [ ] Cast announcement
- [ ] Share in channels
- [ ] Tag relevant accounts
- [ ] Submit to Frame directory
- [ ] Monitor analytics
### Post-Launch
- [ ] Respond to feedback
- [ ] Fix any issues
- [ ] Share user testimonials
- [ ] Create more casts
- [ ] Iterate based on data
---
## ๐ŸŽฏ Growth Tips
### 1. Daily Casts
Share today's poll every day:
```
๐Ÿ—ณ๏ธ Today's Poll: Will BTC hit $120K?
Vote now and win cUSD! ๐Ÿ’ฐ
https://your-app.vercel.app
```
### 2. Share Results
Post yesterday's results:
```
๐Ÿ“Š Yesterday's Results:
โœ… 67% predicted correctly
๐Ÿ’ฐ Winners earned 0.15 cUSD each
Today's poll is live ๐Ÿ‘‡
```
### 3. User Testimonials
Recast user wins:
```
๐ŸŽ‰ @alice just won 0.25 cUSD!
Your turn to predict and win ๐Ÿ‘‡
```
### 4. Collaborate
Partner with other Frames:
```
๐Ÿค PollCelo x OtherFrame
Special poll today!
Vote and win double rewards ๐Ÿ’ฐ
```
---
## ๐Ÿ”— Resources
- [Farcaster Frames Docs](https://docs.farcaster.xyz/developers/frames)
- [Frame Validator](https://warpcast.com/~/developers/frames)
- [Frame Examples](https://github.com/farcasterxyz/frames)
- [Warpcast Developer Portal](https://warpcast.com/~/developers)
---
## ๐ŸŽ‰ Summary
**To Publish PollCelo:**
1. โœ… Add Frame metadata
2. โœ… Create images
3. โœ… Add manifest endpoint
4. โœ… Deploy to production
5. โœ… Cast your URL on Warpcast
6. โœ… Submit to Frame directory
**Time to Launch:** 30 minutes
**Cost:** $0
**Reach:** All Farcaster users
**Ready to go viral! ๐Ÿš€**