Frames v2 Starter Kit
January 14, 2025 ยท View on GitHub
A full-featured starter kit for building Farcaster Frames v2 applications with Next.js. This project provides a robust foundation with authentication, notifications, and essential tooling pre-configured.
Features
- ๐ Authentication - Built-in Farcaster authentication using Frame SDK
- ๐จ Notifications - Ready-to-use Frame notifications system
- ๐ State Management - TanStack Query for efficient server state management
- ๐จ Styling - Tailwind CSS for rapid UI development
- ๐ Analytics - PostHog integration for tracking user interactions
- ๐ Error Tracking - Sentry integration for monitoring errors
- ๐ Type Safety - Full TypeScript support
- ๐ API Routes - Pre-configured API endpoints for user management
- ๐พ Database - Redis integration for data persistence
- โก Background Jobs - QStash integration for handling async tasks
Prerequisites
- Node.js 18+
- Redis database (Upstash recommended)
- Neynar API key
- PostHog account (optional)
- Sentry account (optional)
Getting Started
- Clone the repository:
git clone https://github.com/builders-garden/frames-v2-starter
cd frames-v2-starter
- Install dependencies:
npm install
# or
yarn install
# or
pnpm install
- Create a
.envfile based on.env.sample:
NEXT_PUBLIC_URL=http://localhost:3000
JWT_SECRET=your-secret-key
NEYNAR_API_KEY=your-neynar-api-key
KV_API_URL=your-redis-url
KV_API_TOKEN=your-redis-token
QSTASH_TOKEN=your-qstash-token
QSTASH_CURRENT_SIGNING_KEY=your-qstash-signing-key
NEXT_PUBLIC_POSTHOG_KEY=your-posthog-key
NEXT_PUBLIC_POSTHOG_HOST=your-posthog-host
- Run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
- Open http://localhost:3000 with your browser to see the result.
Testing Your Frame
- Run yarn frames
- Generate domain account association for http://localhost:3000
- Paste it in your manifest (farcaster.json)
- Debug and Test interactions from the debugger
Project Structure
โโโ app/ # Next.js app router pages and API routes
โโโ components/ # React components
โโโ hooks/ # Custom React hooks
โโโ lib/ # Utility functions and configurations
โโโ public/ # Static assets
โโโ types/ # TypeScript type definitions
Key Components
components/Demo.tsx- Example component showing Frame authenticationhooks/use-sign-in.ts- Hook for handling Farcaster authenticationlib/notifications.ts- Frame notifications implementationlib/db/index.ts- Database operationsmiddleware.ts- API route authentication
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - feel free to use this starter kit for any project.
Support
If you have any questions or need help, please open an issue in the repository.