An onchain idle RPG mini-game built as a Base Mini App. Check in daily, complete quests, craft relics, upgrade your hero, and climb the leaderboard.
- Daily Check-In: Onchain transaction minting a "Daily Sigil" with streak bonuses
- Energy System: Offchain regen (+1 per 10 min), server-verified
- Quests: 3 rotating daily quests (tap, time-based, social share)
- Crafting: Spend materials to forge items; rare items recorded onchain
- Upgrades: Spend Season Points onchain to boost drop rates, energy cap, quest slots
- Leaderboard: Season points from onchain events + server-verified quest completions
- Soulbound Badges: Streak milestone badges (7, 30, 100 days)
- Frontend: Next.js 14 (App Router), TypeScript, TailwindCSS
- Web3: wagmi v2 + viem v2, Base mainnet + Base Sepolia
- Backend: Next.js Route Handlers, Prisma + SQLite
- Smart Contracts: Solidity + Foundry, OpenZeppelin-compatible
- Auth: SIWE-style message signing with iron-session
Copy .env.example to .env.local and fill in:
DATABASE_URL="file:./dev.db"
NEXT_PUBLIC_CHAIN="base-sepolia" # "base" or "base-sepolia"
NEXT_PUBLIC_CONTRACT_ADDRESS="0x..." # Deploy contract first
SESSION_SECRET="your-secret-32-chars-min" # openssl rand -hex 32
NEXT_PUBLIC_APP_URL="http://localhost:3000"# 1. Install dependencies
npm install
# 2. Set up database
npx prisma generate
npx prisma db push
# 3. (Optional) Seed demo data
npm run db:seed
# 4. Start dev server
npm run devOpen http://localhost:3000.
Requires Foundry:
cd contracts
# Install dependencies (forge-std)
forge install foundry-rs/forge-std --no-commit
# Run tests
forge test -vvv
# Deploy to Base Sepolia
DEPLOYER_PRIVATE_KEY=0x... forge script script/Deploy.s.sol \
--rpc-url https://sepolia.base.org \
--broadcast --verify
# Deploy to Base Mainnet
DEPLOYER_PRIVATE_KEY=0x... forge script script/Deploy.s.sol \
--rpc-url https://mainnet.base.org \
--broadcast --verifyAfter deploying, update NEXT_PUBLIC_CONTRACT_ADDRESS in .env.local.
# Install Vercel CLI
npm i -g vercel
# Deploy
vercel
# Set environment variables in Vercel dashboard:
# - DATABASE_URL (use Vercel Postgres or keep file-based for demo)
# - SESSION_SECRET
# - NEXT_PUBLIC_CHAIN
# - NEXT_PUBLIC_CONTRACT_ADDRESS
# - NEXT_PUBLIC_APP_URLThe file public/.well-known/farcaster.json contains the required manifest.
- Go to base.dev and follow the Mini App registration flow
- Use the Farcaster CLI or SDK to generate the
accountAssociation:# Using farcaster-cli (if available) farcaster sign-app-key --domain your-app.vercel.app - Paste the
header,payload, andsignaturevalues intopublic/.well-known/farcaster.json - Update all URLs in the manifest to your actual deployed URL
- Redeploy to Vercel
-
/.well-known/farcaster.jsonis accessible at your domain -
accountAssociationfields are filled with real values -
homeUrlmatches your deployed URL -
iconUrlandimageUrlpoint to valid images - App loads in a frame context
- Wallet connection works within the frame
# Server logic tests (Vitest)
npm test
# Smart contract tests (Foundry)
cd contracts && forge test -vvvdaily-relics/
├── contracts/ # Solidity + Foundry
│ ├── src/DailyRelics.sol
│ ├── test/DailyRelics.t.sol
│ └── script/Deploy.s.sol
├── prisma/
│ ├── schema.prisma
│ └── seed.ts
├── public/.well-known/
│ └── farcaster.json
├── src/
│ ├── app/ # Next.js App Router pages
│ │ ├── api/ # Route handlers
│ │ ├── quests/
│ │ ├── crafting/
│ │ ├── inventory/
│ │ ├── leaderboard/
│ │ └── settings/
│ ├── components/ # React components
│ ├── hooks/ # Custom hooks
│ ├── lib/ # Utilities & config
│ └── __tests__/ # Vitest tests
└── README.md
- Connect wallet → Sign in (SIWE-style)
- Daily check-in (onchain tx) → earn Season Points + streak bonus
- Energy regenerates passively → spend on quests
- Complete quests → earn crafting materials
- Craft items → rare crafts recorded onchain
- Upgrade (onchain tx) → boost drop rates / energy / quest rewards
- Climb the leaderboard by accumulating points
checkIn()— once per UTC day, emitsCheckedIneventupgrade(type)— spend points, emitsUpgradedeventrecordRareCraft(user)— milestone tracking, emitsRareItemCrafted- Streak badges auto-minted at 7/30/100 day milestones