A viral gaming platform where sponsors can attach USDC prize pools to social posts, creating "Last Buyer Wins" competitions that drive engagement and viral growth.
- Game Discovery: Browse active and ended games with real-time updates from The Graph
- Real Post Data: Uses Zora SDK to fetch actual post titles and images from postCoin addresses
- Trading Interface: Professional trading-style UI for game participation
- Wallet Integration: Connect Web3 wallets to participate in games
- Game Creation: Sponsors can create new games with USDC prize pools
- Prize Claims: Winners can claim USDC prizes directly
- Framework: Next.js 14 with App Router
- Styling: Tailwind CSS v4
- UI Components: shadcn/ui
- Web3: wagmi for wallet connectivity
- Data: The Graph for blockchain events, Zora SDK for post metadata
- TypeScript: Full type safety
- Node.js 18+
- npm, yarn, or pnpm
- Zora API key (for post data)
- Clone the repository:
git clone https://github.com/your-username/viralpost-fun-redesign.git
cd viralpost-fun-redesign- Install dependencies:
npm install
# or
yarn install
# or
pnpm install-
Configure environment variables:
- Copy
env.exampleto.env.local - Add your Zora API key (get it from Zora Developer Settings)
- Copy
-
Run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev- Open http://localhost:3000 in your browser.
Create a .env.local file in the root directory:
# Zora API Configuration (required for post data)
NEXT_PUBLIC_ZORA_API_KEY=your_actual_api_key_here
# Optional: Override GraphQL endpoint
# NEXT_PUBLIC_GRAPHQL_ENDPOINT=https://api.studio.thegraph.com/query/88583/viralpost/0.0.1├── app/ # Next.js App Router pages
│ ├── create/ # Game creation page
│ ├── game/[id]/ # Game detail pages
│ ├── layout.tsx # Root layout
│ └── page.tsx # Home page
├── components/ # Reusable components
│ ├── ui/ # shadcn/ui components
│ ├── bullrun-card.tsx # Game card component
│ ├── header.tsx # Navigation header
│ └── wallet-provider.tsx # Web3 wallet setup
├── hooks/ # Custom React hooks
│ └── useGames.ts # Hook for fetching game data
├── lib/ # Utility functions and services
│ ├── graphql.ts # GraphQL client and queries
│ ├── zora-service.ts # Zora SDK integration (self-initializing)
│ └── utils.ts # Utility functions
└── abis/ # Smart contract ABIs
└── BullRun.json # BullRun contract ABI
- Endpoint:
https://api.studio.thegraph.com/query/88583/viralpost/0.0.1 - Events: Fetches
gameCreatedsevents to populate game cards - Real-time: Updates automatically as new games are created
- Purpose: Fetches real post titles and images from postCoin addresses
- Self-initializing: Automatically sets up when API key is available
- Fallback: Uses mock data if Zora data is unavailable
- API Key: Required for full functionality
- Home (
/): Browse active and ended games with real blockchain data - Game Detail (
/game/[id]): View game details and participate - Create Game (
/create): Create new games (sponsors only)
npm run build
npm startnpm run lint- GraphQL Query: Fetches
gameCreatedsevents from The Graph - Zora Integration: For each game, fetches post metadata using postCoin address
- Data Transformation: Combines blockchain data with post metadata
- UI Rendering: Displays real data in game cards with fallback mock data
- No games showing: Check GraphQL endpoint and network connectivity
- Missing post data: Verify Zora API key configuration
- Loading issues: Check browser console for error messages
The integration is designed to be simple and self-contained:
- No manual initialization needed - Zora service automatically sets up when the API key is available
- Graceful fallbacks - If any service fails, the app continues to work with mock data
- Real-time updates - Game data automatically refreshes from the blockchain
- Smart caching - Zora data is fetched on-demand for each game