Impossibl game for worldcoin
- Next.js 16 (App Router) + React 19
- Tailwind CSS 4
- Better Auth with Sign-In with Farcaster (SIWF)
- Neynar API client
- Drizzle ORM + Turso (libSQL)
- Farcaster Mini App SDK/Core/Node
- Wagmi + Farcaster connector
- Node >= 20.18.0
- pnpm >= 10.0.0
- Install dependencies
pnpm install- Configure environment variables
cp .env.example .envFill in the values described in the Environment section below.
- Run the dev server
pnpm dev- Expose localhost via a tunnel for Miniapp debugging Use your preferred tunneling tool and follow this guide: https://dtech.vision/farcaster/miniapps/theultimatefarcasterminiappdebuggingguide/#warpcast-debugger
Server-side (required):
BETTER_AUTH_SECRET: Session encryption secretNEYNAR_API_KEY: Neynar API keyNOTIFICATION_SECRET: Secret to authorize POST/api/notifyTURSO_DATABASE_URL: Turso libSQL database URLTURSO_DATABASE_TOKEN: Turso auth token
Client-side:
NEXT_PUBLIC_APP_ENV:development|production(defaultproduction)NEXT_PUBLIC_URL: Public base URL (e.g.https://your-app.vercel.appor tunnel URL)NEXT_PUBLIC_FARCASTER_HEADER: From Warpcast Manifest ToolNEXT_PUBLIC_FARCASTER_PAYLOAD: From Warpcast Manifest ToolNEXT_PUBLIC_FARCASTER_SIGNATURE: From Warpcast Manifest ToolNEXT_PUBLIC_BASE_BUILDER_ADDRESS: Base chain builder address (app-specific)NEXT_PUBLIC_APPLICATION_NAME: App display nameNEXT_PUBLIC_APPLICATION_DESCRIPTION: App description
pnpm dev # Start dev server (Turbopack)
pnpm build # Lint then build
pnpm start # Start production server
pnpm lint # Biome checks
pnpm format # Biome format --write
pnpm typecheck # TypeScript noEmit
# Drizzle / Turso
pnpm db:generate # Generate migrations
pnpm db:migrate # Apply migrations
pnpm db:push # Push schema
pnpm db:studio # Drizzle Studio- Server config in
src/lib/auth.tswith MiniKit for user resolution via World App - Client in
src/lib/auth-client.ts(cookies, MiniKit client plugin) - Trusted origin and cookie settings are derived from
NEXT_PUBLIC_URL
- Middleware-like proxy in
src/proxy.tsprotects all/api/*endpoints by default - Public APIs bypassed:
/api/og/*,/api/webhook/farcaster,/api/notify,/api/auth/*
- Dynamic miniapp metadata embedded in
generateMetadataofsrc/app/profile/[userId]/page.tsx fc:miniapppoints to a deep link back into the app
- Endpoint:
GET /api/og/profile/[userId]with optional?ar=3x2for Farcaster aspect ratio - Components in
src/components/og-image/*
- Farcaster webhook:
POST /api/webhook/farcaster- Validates events via
@farcaster/miniapp-nodeand Neynar app key - Persists notification details per user; sends welcome/confirmation notifications
- Validates events via
- Broadcast notifications:
POST /api/notify- Requires header
x-notification-secret: ${NOTIFICATION_SECRET} - Body:
{ "title": string, "body": string, "targetUrl?": string }
- Requires header
- Home and profile flows using
src/components/pages/* - Profile route:
src/app/profile/[userId]/page.tsx
GET/POST /api/auth/[...all]: Better Auth routesPOST /api/webhook/farcaster: Farcaster event handler (miniapp added/removed, notifications enabled/disabled)POST /api/notify: Internal broadcast notificationsGET /api/og/profile/[userId]: Dynamic OG images
- Drizzle ORM with Turso (libSQL)
- Schema in
src/lib/database/db.schema.ts - Queries in
src/lib/database/queries/* - Common commands:
pnpm db:generate
pnpm db:migrate
pnpm db:studio- Recommended: Vercel
- Set all required env vars in the hosting provider
- Ensure
NEXT_PUBLIC_URLmatches the deployed public URL (affects cookies and auth)
- This repository is intended for internal use as a generalized Farcaster Mini App template.
- Update copy, branding, and components under
src/componentsto fit your app.
- World Mini Apps: https://docs.world.org/mini-apps
- Farcaster Mini Apps: https://miniapps.farcaster.xyz/
- Next.js: https://nextjs.org/docs
- Tailwind CSS: https://tailwindcss.com/docs
- Neynar: https://neynar.com