Guide for integrating MiniKit into an existing Next.js project with installation, provider setup, and environment configuration
Next.js Project Structure
app/
directory structure (App Router).Deployment
Farcaster Account
Coinbase Developer Platform Account
Install required dependencies
@coinbase/onchainkit
appears in your package.json
.Add the MiniKitProvider to your app
MiniKitProvider
to initialise SDK context for your application.File: providers/MiniKitProvider.tsx
app/layout.tsx
:Initialize MiniKit in your main page
useMiniKit
hook to access the frame context and trigger readiness.File: app/page.tsx
setFrameReady()
function removes the splash screen and shows your application. Only call this when your app is fully loaded and ready for user interaction.Configure environment variables
public/
folder and ensure they’re accessible via HTTPS.Generate the manifest
.env
fileFARCASTER_HEADER
, FARCASTER_PAYLOAD
, and FARCASTER_SIGNATURE
values.Create .well-known/farcaster.json route
app/.well-known/farcaster.json/route.ts
:https://yourdomain.com/.well-known/farcaster.json
to ensure it returns valid JSON.Define Farcaster frame metadata
app/layout.tsx
Test and deploy your Mini App
public/
folder.well-known/farcaster.json
endpoint returns valid JSONuseMiniKit
Gives YouuseMiniKit()
hook provides access to everything your Mini App needs to understand the Farcaster session:
setFrameReady()
and is ready to be shownTest thoroughly
Monitor and iterate
Explore advanced features