A comprehensive Web3 quiz platform built with Next.js, Prisma, and Celo blockchain integration. Create interactive quizzes, earn rewards, and compete with the community.
- Interactive Quiz Creation: Build engaging quizzes with multiple choice questions
- Real-time Competition: Speed-based scoring with bonus points for quick answers
- Blockchain Rewards: Earn CELO tokens and other crypto rewards
- Multi-Network Support: Celo, Ethereum, Polygon, Arbitrum, Base
- Spam Control: Entry fees to maintain quiz quality
- Allowlist System: Private quizzes with wallet-based access control
- Quadratic Rewards: Fair distribution based on performance and participation
- Linear Rewards: Fixed rewards for top N winners
- Speed Bonus System: Faster answers earn more points
- Featured Quizzes: Promote quality content on homepage
- Socket Integration: Real-time updates and reconnection support
- Custom Tokens: Support for any ERC-20 token across multiple networks
- Frontend: Next.js 15, React 19, TypeScript, Tailwind CSS
- Backend: Next.js API Routes, Prisma ORM
- Database: PostgreSQL
- Blockchain: Celo, Ethereum, Polygon, Arbitrum, Base
- Real-time: Socket.IO
- UI: Lucide React Icons, Framer Motion
-
Clone the repository
git clone <repository-url> cd snarkels
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env.local
Update
.env.localwith your configuration:DATABASE_URL="postgresql://username:password@localhost:5432/snarkels" NEXTAUTH_URL="http://localhost:3000" NEXTAUTH_SECRET="your-secret-key-here"
-
Set up the database
# Generate Prisma client npm run db:generate # Push schema to database npm run db:push # Or run migrations npm run db:migrate
-
Start the development server
npm run dev
-
Open your browser Navigate to http://localhost:3000
The application uses a comprehensive Prisma schema with the following models:
- User: Wallet-based user management
- Quiz: Quiz configuration and settings
- Question: Quiz questions with options
- Submission: User quiz submissions and scores
- QuizReward: Reward configuration and distribution
- QuizAllowlist: Private quiz access control
- SocketSession: Real-time connection management
- FeaturedContent: Homepage featured quizzes
# Generate Prisma client
npm run db:generate
# Push schema changes
npm run db:push
# Run migrations
npm run db:migrate
# Open Prisma Studio
npm run db:studio- Navigate to
/create - Fill in quiz details (title, description, time limit)
- Configure spam control settings (optional)
- Set up reward distribution (Linear or Quadratic)
- Add questions with multiple choice options
- Publish your quiz
- Use a quiz code to join
- Connect your wallet
- Pay entry fee (if required)
- Answer questions quickly for bonus points
- View leaderboard and rewards
- Enable entry fees in various stablecoins
- Choose from multiple networks (Celo, Ethereum, Polygon, etc.)
- Set custom entry fee amounts
- Deter low-quality participants
- Linear: Fixed rewards for top N winners
- Quadratic: Performance-based distribution
- Support for any ERC-20 token
- Multi-network reward distribution
- Public quizzes (open to everyone)
- Private quizzes with allowlist
- 6-character unique quiz codes
- Wallet-based authentication
- Celo: Native CELO, cUSD, cEUR, cREAL
- Ethereum: ETH, USDC, USDT
- Polygon: MATIC, USDC, USDT
- Arbitrum: ETH, USDC
- Base: ETH, USDC
Token configurations are managed in lib/tokens-config.ts:
- Entry fee tokens (stablecoins)
- Reward tokens (native and popular tokens)
- Custom token support
- Network-specific filtering
- Connect your repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy automatically on push to main branch
- Set up PostgreSQL database (e.g., Supabase, Railway, Neon)
- Update
DATABASE_URLin environment variables - Run database migrations
DATABASE_URL="postgresql://..."
NEXTAUTH_URL="https://your-domain.com"
NEXTAUTH_SECRET="your-secret-key"- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
For support, please open an issue on GitHub or contact the development team.
Snarkels - The future of interactive Web3 quizzes! 🎯✨