Vibe Shooter is a fully vibe-coded Next.js web game powered by the AI-optimized thirdweb API which handles authentication, wallet management, gasless transactions, and more.
View the full thirdweb documentation on the thirdweb portal.
- Add the thirdweb API
llms.txtto your repo or prompt context and start prompting. - Build features by prompting against your codebase +
llms.txt. The thirdweb API covers user authentication, wallet management, gasless transactions, and more out of the box. - Reference endpoints and capabilities in the thirdweb API reference.
- User Authentication: Email OTP login creates a wallet automatically
- Persistent Sessions: Your account is remembered - no need to re-enter details on reload
- Clicking Game: Click on randomly spawning targets within a 10-second timer
- Token Rewards: Earn 0.01 tokens for each target hit
- Real-time Transactions: See transaction status updates in real-time
- Balance Tracking: View your current token balance with auto-refresh
- Account Switching: Log out and log in with a different email anytime
- Responsive Design: Built with Tailwind CSS and shadcn components
- Frontend: Next.js 14 with App Router, TypeScript, Tailwind CSS
- UI Components: shadcn/ui components
- Blockchain Integration: thirdweb API
- Styling: Tailwind CSS with custom game animations
-
Install Dependencies
pnpm install
-
Environment Configuration
- Copy
env.templateto.env.local:
cp env.template .env.local
- Fill in your environment variables in
.env.local:
THIRDWEB_SECRET_KEY=your_thirdweb_secret_key_here TREASURY_WALLET_ADDRESS=0x... THIRDWEB_API_BASE_URL=https://api.thirdweb.com
- Copy
-
Required Setup
- Get your thirdweb secret key from the thirdweb dashboard
- Deploy or have access to an ERC-20 token contract
- Your treasury wallet should be a server wallet. You can create one on your thirdweb dashboard. Ensure it has sufficient token balance.
-
Run the Development Server
pnpm dev
-
Open the Game
- Navigate to
http://localhost:3000 - Enter your email and verify the 6-digit code to create your wallet and start playing
- Navigate to
| Variable | Description |
|---|---|
THIRDWEB_SECRET_KEY |
Your thirdweb secret key for backend authentication |
TREASURY_WALLET_ADDRESS |
Wallet address that holds and distributes tokens |
THIRDWEB_API_BASE_URL |
thirdweb API base URL |
- Login: Enter a username to create your wallet (remembered for future visits)
- Start Game: Click "Start Game" to begin a 10-second round
- Hit Targets: Click on red targets that appear randomly
- Earn Tokens: Each target hit earns 0.01 tokens
- Track Progress: View your balance and transaction history
- Play Again: Start new rounds to earn more tokens
- Switch Account: Use "Switch Account" to log in with a different username
POST /api/auth/send-code- Send email OTPPOST /api/auth/verify-code- Verify OTP and create sessionPOST /api/auth/logout- Clear session cookiesGET /api/balance?address=0x...- Get a wallet's token balanceGET /api/treasury-balance- Get treasury wallet token balancePOST /api/reward- Send tokens from treasury to player (on hit)POST /api/penalty- Send tokens from player to treasury (on miss)POST /api/withdraw- Withdraw a player's full balance to a recipientGET /api/transaction/[id]- Get transaction statusGET /api/transactions- List recent transactionsGET /api/leaderboard- Show top score holders
All thirdweb API logic is contained in src/lib/thirdweb.ts. This file uses the thirdweb API to perform wallet operations, contract reads/writes, token transfers, transaction queries, and leaderboard data.
Edit the constants in src/components/game/game-arena.tsx:
const GAME_DURATION = 10000; // 10 seconds
const TARGET_SPAWN_INTERVAL = 2000; // 2 seconds
const TARGET_LIFETIME = 3000; // 3 secondsReward and penalty amounts are specified in token units within their respective API routes and then converted to base units. Token address, decimals, and chain ID are configured in src/lib/constants.ts.
- Wallet Creation Fails: Check your thirdweb secret key
- No Tokens Received: Ensure treasury wallet has sufficient balance
- Transaction Failures: Verify token contract address and chain ID
- Balance Not Updating: Check API connectivity and refresh manually
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Apache 2.0. This project is for educational purposes.
