Quickstart
Learn how to build mini apps on Base with MiniKit - from setup to deployment and advanced features
This guide shows you how to get started with MiniKit, the easiest way to build mini apps on Base! It can also be used to update an existing standalone app to a mini app. We’ll start by setting up the template project with the CLI tool and then explore both built-in and additional features of MiniKit.
Prerequisites
Before you begin developing with MiniKit, you’ll need:
-
Farcaster Account: Create an account on Warpcast to test and deploy your Mini Apps.
-
Coinbase Developer Platform Account (Optional): Sign up for a Coinbase Developer Platform account if you need CDP API key for additional functionalities.
What is a Mini App?
A mini app is a lightweight web app that runs directly inside Farcaster Frames, without needing to open a browser or download anything. Built using familiar tools like Next.js and minikit, mini apps behave just like normal apps — but launch instantly from posts, making them feel native to the Farcaster experience.
Initial Setup
Create a new MiniKit project using the CLI
Enter your CDP Client API key when prompted
You can get a CDP API key by going to the CDP Portal and navigating API Keys → Client API Key.
Skip Frames Account Manifest Setup
You will be asked if you’d like to set up your manifest. You can skip the manifest setup step as we’ll handle that separately once we know our project’s URL.
Navigate to your project directory and install dependencies
These docs are LLM-friendly—reference llms.txt in your code editor to streamline builds and prompt smarter.
Testing Your Mini App
To test your Mini App in Warpcast, you’ll need a live URL.
We recommend using Vercel to deploy your MiniKit app, as it integrates seamlessly with the upstash/redis backend required for stateful frames, webhooks, and notifications.
Alternatively, you can use ngrok to tunnel your localhost to a live url.
Deploying to Vercel
Install Vercel CLI
Deploy with the command
Set environment variables in your Vercel project settings
You can use vercel env add
to set these up via CLI:
- NEXT_PUBLIC_CDP_CLIENT_API_KEY (from CDP Portal)
- NEXT_PUBLIC_URL (deployed app URL)
- NEXT_PUBLIC_IMAGE_URL (optional)
- NEXT_PUBLIC_SPLASH_IMAGE_URL (optional)
- NEXT_PUBLIC_SPLASH_BACKGROUND_COLORs
You can now test your mini app:
- Copy your deployed vercel URL
- Visit Warpcast Frames Developer Tools on web or mobile
- Paste URL into “Preview Frames”
- Tap Launch
Exploring Built-in Features
The template comes with several pre-implemented features. Let’s explore where they are and how they work.
MiniKitProvider
The 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.
The MiniKitProvider also sets up your wagmi and react-query providers automatically, eliminating that initial setup work.
useMiniKit
The 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.
Creating the Manifest
The Frame Manifest is required in order for users to save the frame to their account. This means its also required to send notifications to the user. We initially skipped this step when setting up the app. Now that we know our vercel url, we can configure our manifest.
To set up the manifest, run the following in your Terminal
Enter y
to proceed with the setup and your browser will open to the following page:
The wallet that you connect must be your Farcaster custody wallet. You can import this wallet to your preferred wallet using the recovery phrase. You can find your recovery phrase in the Warpcast app under Settings → Advanced → Farcaster recovery phrase.
Once connected, add the vercel url and sign the manifest. This will automatically update your .env variables locally, but we’ll need to update Vercel’s .env variables.
Create the following new .env variables in your vercel instance and paste the value you see in your local.env file:
Base64 encoded header from manifest generation
Base64 encoded payload from manifest generation
Signature from manifest generation
Now that the manifest is correctly set up, the Save Frame button in the template app should work. We’ll explore that below.
useAddFrame
The 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.
In production, you’ll want to save the url and token associated with each user in a persistent database so that you can send them notifications over time.
useOpenUrl
The 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.
Now that we’ve reviewed the MiniKit template and the functionality already implemented, lets add some additional MiniKit features.
Additional MiniKit Features
Now, let’s implement additional hooks provided by the MiniKit library. We’ll add these features one by one.
useClose
First, let’s add the ability to close the frame from within the interface:
If you reload the frame in the Warpcast dev tools preview, you’ll now see the close button in the top right.
usePrimaryButton
The Primary Button is a button that always exists at the bottom of the frame. Its good for managing global state which is relevant throughout your mini app.
For the template example, we’ll use the Primary Button to Pause and Restart the game. The game state is managed within the snake.tsx
component, and we can easily add the usePrimaryButton
hook there since the MiniKit hooks are available throughout the app.
You’ll notice that adding the Primary button takes up space at the bottom of the frame, which causes the “BUILT ON BASE WITH MINIKIT” button to move upwards and overlap with the controls.
We can quickly fix that by changing the text to “BUILT WITH MINIKIT” and removing the ml-4
style in the className
of the <button>
useViewProfile
Now, let’s add profile viewing capability. The useViewProfile hook allows you to define what profile to use by defining the user’s FID, which is great for social applications. If you don’t define an FID, it defaults to the client FID.
useNotification
One of the major benefits of mini apps is that you can send notifications to your users through their social app.
Recall the token and url we saved in the useAddFrame section? We’ll use those now to send a user a notification. In this guide, we’ll simply send a test notification unrelated to the game activity.
Notice that we first check if the user has added the frame to their list of mini apps before displaying the button. This is using the 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.
Conclusion
Congratulations, you’ve created your first mini app, set up the manifest, added key MiniKit hooks, and sent your users a notification! We’re excited to see what you build with MiniKit!