Frontend Integration
Time to build a user-friendly interface! Let's create a React app that makes your NEAR Drop system accessible to everyone.
Quick Setup
npx create-next-app@latest near-drop-frontend
cd near-drop-frontend
# Install NEAR dependencies
npm install near-api-js @near-wallet-selector/core @near-wallet-selector/my-near-wallet
npm install @near-wallet-selector/modal-ui qrcode react-qr-code
Create .env.local:
NEXT_PUBLIC_NETWORK_ID=testnet
NEXT_PUBLIC_CONTRACT_ID=your-drop-contract.testnet
NEXT_PUBLIC_RPC_URL=https://rpc.testnet.near.org
NEAR Connection Service
Create src/utils/near.js:
Loading...
Key Generation Utility
Create src/utils/crypto.js:
Loading...
Drop Creation Component
Create src/components/CreateDrop.js:
Loading...
Drop Results Component
Create src/components/DropResults.js:
Loading...
Claiming Component
Create src/components/ClaimDrop.js:
Loading...
Main App Layout
Create src/pages/index.js:
Loading...
QR Code Generation
Add QR code generation for easy sharing:
Loading...
Mobile-First Design
Ensure your CSS is mobile-responsive:
Loading...
Deploy Your Frontend
# Build for production
npm run build
# Deploy to Vercel
npm i -g vercel
vercel --prod
# Or deploy to Netlify
# Just connect your GitHub repo and it'll auto-deploy
Add environment variables in your deployment platform:
NEXT_PUBLIC_NETWORK_ID=testnetNEXT_PUBLIC_CONTRACT_ID=your-contract.testnetNEXT_PUBLIC_RPC_URL=https://rpc.testnet.near.org
Advanced Features
Batch Key Generation
For large drops, add batch processing:
Loading...
Drop Analytics
Track drop performance:
Loading...
What You've Built
Awesome! You now have a complete web application with:
✅ Wallet integration for NEAR accounts
✅ Drop creation interface with cost calculation
✅ Key generation and distribution tools
✅ QR code support for easy sharing
✅ Claiming interface for both new and existing users
✅ Mobile-responsive design that works everywhere
✅ Batch processing for large drops
✅ Analytics dashboard for tracking performance
Your users can now create and claim token drops with just a few clicks - no technical knowledge required!
Testing Your Frontend
-
Local Development:
npm run dev -
Connect Wallet: Test wallet connection with testnet
-
Create Small Drop: Try creating a 1-key NEAR drop
-
Test Claiming: Use the generated private key to claim
-
Mobile Testing: Verify responsive design on mobile devices
Production Considerations
Security:
- Never log private keys in production
- Validate all user inputs
- Use HTTPS for all requests
Performance:
- Implement proper loading states
- Cache contract calls where possible
- Optimize images and assets
User Experience:
- Add helpful error messages
- Provide clear instructions
- Support keyboard navigation
Next Steps
Your NEAR Drop system is complete! Consider adding:
- Social sharing for claim links
- Email notifications for drop creators
- Advanced analytics with charts
- Multi-language support
- Custom themes and branding
The frontend makes your powerful token distribution system accessible to everyone. Non-technical users can now create airdrops as easily as sending an email!