Why MiniKit?
Seamless Integration
Part of OnchainKit allowing for complete onchain app development with shared providers and configuration.
Social-Native
Built specifically for Farcaster’s frame-based architecture with native social features.
Wallet Abstraction
Simplified wallet connections and transaction flows with automatic provider detection.
Cross-Client
Works across Base App, Farcaster, and other clients with consistent behavior.
Architecture
MiniKit consists of three main components:<OnchainKitProvider miniKit={{ enabled: true }}>
React context provider that configures:
- Wagmi and react-query setup
- Chain and API key configuration
- Theme and appearance settings
- Farcaster connector integration
Hooks
React hooks for frame interactions:- Frame Management:
useMiniKit
,useAddFrame
,useClose
- Navigation:
useOpenUrl
,useViewProfile
,useViewCast
- Social:
useComposeCast
,useNotification
- Authentication:
useAuthenticate
- UI:
usePrimaryButton
CLI Tools
Command-line utilities for:- Project scaffolding with
npx create-onchain --mini
- Manifest generation with
npx create-onchain --manifest
- Development workflow automation
Getting Started
New Project
Create a new Mini App from scratch using the CLI scaffolding tool.
Existing App
Add MiniKit to your existing Next.js application.
Key Concepts
Frame Lifecycle
Mini Apps run within Farcaster frames and must signal readiness:- Initialize MiniKitProvider in your app root
- Signal readiness with
setFrameReady()
in your main component - Handle interactions through MiniKit hooks
Context vs Authentication
- Context data (
useMiniKit().context
) provides user info but can be spoofed - Authentication (
useAuthenticate()
) provides cryptographically verified user identity - Always use authentication for security-critical operations
Cross-Client Compatibility
MiniKit automatically detects the client environment and adapts:- Base App: Native wallet integration, enhanced features
- Farcaster: Standard Farcaster protocol compliance
- Other clients: Graceful fallbacks and compatibility modes