Production-ready, multi-platform mini app template built by Builders Garden. Supports Farcaster, Worldcoin, MiniPay, and browser environments with multi-method authentication (SIWF, SIWE, Worldcoin MiniKit), dual-platform notifications, webhook handling, OG image generation, and a minimal example UI.
- Next.js 16 (App Router, Turbopack, typed routes) + React 19 + TypeScript 5.9
- Tailwind CSS 4 + shadcn/ui (base-maia style)
- Biome 2 + Ultracite for linting/formatting
- Better Auth with SIWF, SIWE, and Worldcoin MiniKit plugins
- Neynar API client for Farcaster
- @worldcoin/minikit-js for Worldcoin Mini App support
- Drizzle ORM + PostgreSQL (Turso/libSQL compatible)
- Wagmi 3 + Viem 2 for Web3 wallet interactions
- Farcaster Mini App SDK/Core/Node
- @tanstack/react-query for server state
- LiFi SDK for multi-chain wallet balances and token prices
- 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 Warpcast debugging Use your preferred tunneling tool and follow this guide: https://dtech.vision/farcaster/miniapps/theultimatefarcasterminiappdebuggingguide/#warpcast-debugger
-
Generate your Farcaster manifest values
- Read: https://miniapps.farcaster.xyz/docs/guides/publishing
- Use Warpcast Manifest Tool: https://warpcast.com/~/developers/mini-apps/manifest
- Paste your tunnel domain and copy the manifest header/payload/signature into
.env
Server-side (required):
DATABASE_URL: PostgreSQL/Turso connection stringBETTER_AUTH_SECRET: Session encryption secret (generate:openssl rand -base64 32)NEYNAR_API_KEY: Neynar API keyNOTIFICATION_SECRET: Secret to authorize POST/api/notify(generate:openssl rand -base64 32)WORLD_NOTIFICATION_API_KEY: Worldcoin Developer API notification key
Client-side:
NEXT_PUBLIC_APP_ENV:development|staging|production(defaultproduction)NEXT_PUBLIC_URL: Public base URL (e.g.https://your-app.vercel.appor tunnel URL)NEXT_PUBLIC_WORLD_APP_ID: Worldcoin app ID (from https://developer.worldcoin.org/)NEXT_PUBLIC_FARCASTER_APP_ID: Farcaster app IDNEXT_PUBLIC_FARCASTER_HEADER: From Warpcast Manifest ToolNEXT_PUBLIC_FARCASTER_PAYLOAD: From Warpcast Manifest ToolNEXT_PUBLIC_FARCASTER_SIGNATURE: From Warpcast Manifest ToolNEXT_PUBLIC_BASE_APP_ID: Base chain app IDNEXT_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
pnpm pre-build # Lint + typecheck
# Drizzle / Database
pnpm db:generate # Generate migrations
pnpm db:migrate # Apply migrations
pnpm db:push # Push schema
pnpm db:pull # Pull schema from DB
pnpm db:studio # Drizzle StudioThree auth methods auto-selected based on environment:
- Farcaster SIWF — Quick Auth via
@farcaster/miniapp-sdk→better-auth-siwfplugin → Neynar user resolution - Worldcoin MiniKit — Wallet auth via
@worldcoin/minikit-js→better-auth-minikitplugin - Browser SIWE — Wagmi wallet connection →
better-auth-siweplugin (fallback for browsers)
- Server config in
src/lib/auth/index.ts - Client in
src/lib/auth/auth.client.ts - Auth context in
src/contexts/auth-context.tsxauto-detects environment and selects the appropriate flow - Trusted origin and cookie settings derived from
NEXT_PUBLIC_URL
- Detects Farcaster Mini App, Worldcoin Mini App, or standard browser
- Context in
src/contexts/environment-context.tsx - All other contexts (auth, app) adapt behavior based on detected environment
- 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- Farcaster manifest at
/.well-known/farcaster.json
- Endpoint:
GET /api/og/profile/[userId]with optional?ar=3x2for Farcaster aspect ratio - Components in
src/components/og-image/*
- Farcaster — Token-based via Farcaster SDK, stored per user
- Worldcoin — Wallet-based via Worldcoin Developer API
- 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 } - Sends to both Farcaster and Worldcoin users in batches
- Requires header
- Home and profile flows using
src/components/pages/* - Profile routes:
src/app/profile/page.tsx(own profile),src/app/profile/[userId]/page.tsx(user profile) - Website landing page for browser users:
src/components/pages/website/
GET/POST /api/auth/[...all]: Better Auth routes (SIWF, SIWE, MiniKit)POST /api/webhook/farcaster: Farcaster event handler (miniapp added/removed, notifications enabled/disabled)POST /api/notify: Broadcast notifications to Farcaster and Worldcoin usersGET /api/og/profile/[userId]: Dynamic OG imagesGET /.well-known/farcaster.json: Farcaster manifest
- Drizzle ORM with PostgreSQL dialect (Turso/libSQL compatible)
- Schema in
src/database/db.schema.ts- Core tables:
user,session,account,verification(Better Auth) - App tables:
farcaster,walletAddress
- Core tables:
- Queries in
src/database/queries/* - Common commands:
pnpm db:generate
pnpm db:migrate
pnpm db:studio- Recommended: Vercel
- Set all required env vars in the hosting provider
- Run
pnpm db:migratebefore first deployment - Ensure
NEXT_PUBLIC_URLmatches the deployed public URL (affects cookies, auth, and frame security)
- This repository is intended for internal use as a generalized multi-platform Mini App template.
- Update copy, branding, and components under
src/componentsto fit your app.
- Farcaster Mini Apps: https://miniapps.farcaster.xyz/
- Worldcoin Developer Portal: https://developer.worldcoin.org/
- Next.js: https://nextjs.org/docs
- Tailwind CSS: https://tailwindcss.com/docs
- Neynar: https://neynar.com
- Biome: https://biomejs.dev/
- Better Auth: https://www.better-auth.com/