Learn how to build mini apps on Base with MiniKit - from setup to deployment and advanced features
Create a new MiniKit project using the CLI
Enter your CDP Client API key when prompted
Skip Frames Account Manifest Setup
Navigate to your project directory and install dependencies
Using ngrok
https://your-tunnel.ngrok.io
)
Install Vercel CLI
Deploy with the command
Set environment variables in your Vercel project settings
vercel env add
to set these up via CLI:MiniKitProvider
is set up in your providers.tsx
file. It wraps your application to handle initialization, events, and automatically applies client safeAreaInsets to ensure your app doesn’t overlap parent application elements.
useMiniKit
hook is implemented in your main page component (app/page.tsx
). It handles initialization of the frame and provides access to the SDK context.
y
to proceed with the setup and your browser will open to the following page:
useAddFrame
hook is used to add your mini app to the user’s list of mini apps. It’s implemented in your main page component and displays a button in the top right allowing the user to add the mini app to their list.
When a user adds the mini app, it returns a url and token, which is used for sending the user notifications. For this walkthrough we’ll simply console.log those results to use them later when setting up notifications.
useOpenUrl
hook is used to open external URLs from within the frame. In the template, its used in the footer button which links to the MiniKit page.
snake.tsx
component, and we can easily add the usePrimaryButton
hook there since the MiniKit hooks are available throughout the app.
ml-4
style in the className
of the <button>
context
object provided by useMiniKit()
. If you don’t see the button to send the notification, its likely because mini app hasn’t been saved.