A simple Farcaster mini app that demonstrates minting an NFT. This project is designed as a teaching example for building mini apps on Farcaster.
This app demonstrates the 5 core concepts of Farcaster mini apps:
Built with familiar technologies: React, TypeScript, Vite, and CSS. No special framework required! See src/main.tsx for the standard React setup.
The Farcaster Mini App SDK (@farcaster/miniapp-sdk) provides access to native features:
sdk.actions.ready()- Signal the app is loaded (seesrc/App.tsx)sdk.actions.addMiniApp()- Prompt user to add the mini appsdk.actions.viewProfile()- Open a user's profilesdk.actions.composeCast()- Open composer with pre-filled content
Using wagmi with the farcasterMiniApp connector, mini apps automatically connect to the user's Ethereum wallet—no wallet selection UI needed! See src/wagmi.ts for the configuration and src/components/app/collectButton.tsx for usage.
Mini apps are surfaced in the social feed through HTML meta tags. This project uses a Vite plugin (vite.config.ts) to automatically generate the fc:miniapp meta tag from your configuration at build time. See the comments in index.html for details.
Mini apps publish a JSON manifest file at public/.well-known/farcaster.json that provides metadata and enables client indexing. This includes app name, icon, URLs, and domain verification.
- React - UI framework
- TypeScript - Type safety
- Vite - Build tool and dev server
- wagmi - Ethereum interactions
- Tailwind CSS - Styling
- Farcaster Mini App SDK - Native capabilities
- Node.js 22.11.0+ (LTS recommended)
- pnpm
- Clone this repository
- Install dependencies:
pnpm install- Start the development server:
pnpm dev- Open your browser to the URL shown in the terminal
To customize this mini app for your own NFT collection:
NFT Metadata:
name- Your collection namedescription- Collection descriptionimageUrl- NFT image URLcreator- Creator details (name, FID, profile image)priceEth- Mint price in ETH
Contract Configuration:
address- Your NFT contract addressabi- Contract ABI- Update function name and arguments if different from the example
Embed Configuration:
imageUrl- Image shown in cast embedsbutton.title- Button textbutton.action.name- Mini app namebutton.action.url- Your deployed URL (TODO: Update for your Replit deployment!)
TODO before deploying:
- Update all URLs to match your deployed Replit URL
- Regenerate the
accountAssociationsignature for your domain using Farcaster dev tools
If your NFT contract uses a different mint function:
- Update the
functionNamein thewriteContractAsynccall - Update the
argsarray to match your contract's parameters - Update the ABI in
src/config.ts
pnpm buildThe build output will be in the dist directory. You can preview it with:
pnpm previewThis project is designed to work on Replit:
- Fork this repository on Replit
- Update all URLs in
src/config.tsto match your Replit deployment URL - Update the manifest file
public/.well-known/farcaster.jsonwith your deployment URL - Generate a new
accountAssociationsignature using Farcaster dev tools - Run
pnpm buildto build the production version - Deploy using Replit's deployment features
Important: Development tunnels (like Replit preview URLs) may have limitations. For full functionality including search indexing and the addMiniApp() action, deploy to your production Replit URL.
The fc:miniapp meta tag is not manually added to index.html. Instead:
- Configuration is defined in
src/config.ts(theembedConfigobject) - A Vite plugin (
fcMiniAppMeta()invite.config.ts) reads this config - At build time, the plugin injects the meta tag into the HTML
<head> - This keeps the embed config in sync with your app configuration
Check the comments in index.html to see where the tag gets injected!
- Connect: User clicks "Connect" → wagmi connects to their Farcaster wallet
- Sign: User clicks "Collect" → transaction is prepared and sent to their wallet
- Confirm: User approves in their wallet → transaction is sent to the blockchain
- Wait: App waits for transaction confirmation
- Success: Success sheet appears → user can share their mint
See src/components/app/collectButton.tsx for the complete implementation.
src/
├── components/
│ ├── app/ # App-specific components
│ │ ├── artworkCard.tsx # NFT display with creator info
│ │ ├── collectButton.tsx # Mint button with wallet connection
│ │ ├── mintSuccessSheet.tsx # Success modal
│ │ └── mintErrorSheet.tsx # Error modal
│ ├── ui/ # Reusable UI primitives
│ └── core/ # Icons and utilities
├── lib/ # Utility functions
├── App.tsx # Main app component (SDK initialization)
├── main.tsx # Entry point (React + providers)
├── wagmi.ts # Ethereum wallet configuration
├── config.ts # All app configuration
└── index.css # Global styles
public/
└── .well-known/
└── farcaster.json # Mini app manifest
pnpm dev- Start development serverpnpm build- Build for productionpnpm preview- Preview production buildpnpm lint- Lint code with Biome
MIT