Example App: NFT Platform
Build a full-stack NFT platform on Nexus with Next.js, Firebase, and OpenSea compatibility
Nexus NFT Platform
This comprehensive example demonstrates how to build a production-ready NFT platform on the Nexus blockchain:
- Live Demo: https://nexus-nft-example.vercel.app/
- GitHub: https://github.com/nexus-xyz/nexus-nft-example
Overview
This project showcases a modern, full-stack NFT platform built with Next.js 13+ (App Router), TypeScript, Hardhat, and ethers.js v6. It demonstrates:
- ERC-721 compliant NFT smart contract with metadata management
- Next.js frontend with App Router architecture
- Firebase Storage integration for NFT image hosting
- OpenSea-compatible metadata API
- Wallet integration with MetaMask
- Vercel deployment pipeline
The application allows users to:
- Create and deploy custom NFT collections
- Upload and manage collection artwork
- Mint NFTs to any address
- View and transfer owned NFTs
- Update collection metadata (when not frozen)
Smart Contract Architecture
The project uses an advanced ERC-721 implementation with enhanced metadata management:
Key features:
- ERC-4906 Support: Implements the ERC-4906 interface for metadata update notifications, which OpenSea and other marketplaces use to refresh NFT metadata
- Metadata Freezing: Allows collection owners to permanently freeze metadata, ensuring immutability
- Batch Minting: Efficient minting of multiple NFTs in a single transaction
- Gas Optimization: Carefully optimized for minimal gas consumption
Project Structure
The project follows a modern full-stack architecture:
Setting Up Firebase Storage
The platform uses Firebase Storage for hosting NFT images. Here’s how to set it up:
1. Create a Firebase Project
- Go to the Firebase Console
- Click “Add project” and follow the setup wizard
- Enable Firebase Storage in your project
2. Configure Security Rules
Set up proper security rules for your Firebase Storage:
3. Add Firebase Configuration
Create a .env.local
file in the frontend directory:
4. Initialize Firebase in Your Application
OpenSea-Compatible Metadata API
The platform includes an API that generates OpenSea-compatible metadata:
This API follows OpenSea’s metadata standards, including:
- Proper naming and description
- Image URL (either from Firebase or a generated SVG)
- External URL for viewing the NFT
- Attributes as traits
Frontend Integration with ethers.js v6
The frontend uses ethers.js v6 to interact with the smart contract:
Deploying to Vercel
The project is optimized for deployment on Vercel:
1. Connect Your GitHub Repository
- Push your project to GitHub
- Log in to Vercel
- Click “New Project” and select your repository
2. Configure Environment Variables
Add all required environment variables in the Vercel project settings:
- Firebase configuration
- API URLs
- Contract addresses (if pre-deployed)
3. Configure Build Settings
Set the following build configuration:
- Framework Preset: Next.js
- Root Directory:
frontend
- Build Command:
npm run build
- Output Directory:
.next
4. Deploy
Click “Deploy” and Vercel will automatically build and deploy your application.
5. Set Up Custom Domain (Optional)
For a professional look, configure a custom domain in the Vercel project settings.
Extending the Platform
This template can be extended in several ways:
1. Advanced Marketplace Features
Add buying, selling, and auction functionality:
- Implement ERC-2981 for royalties
- Create listing and offer contracts
- Build a marketplace interface
2. Enhanced Metadata and Rendering
Improve the NFT display and metadata:
- Add on-chain metadata storage options
- Implement 3D model support
- Create interactive NFTs with HTML rendering
3. Multi-chain Support
Extend to support multiple blockchains:
- Add network switching logic
- Implement cross-chain bridging
- Create unified collection management
4. Social Features
Add community elements:
- NFT comments and reactions
- Collection following
- Creator profiles and verification
5. Analytics Dashboard
Build analytics for creators:
- Minting and transfer statistics
- Holder demographics
- Secondary market performance
Security Considerations
When deploying your own version, consider these security aspects:
-
Smart Contract Security:
- Use OpenZeppelin contracts for standard implementations
- Implement access control for administrative functions
- Consider a contract audit for production deployments
- Test thoroughly on testnet before mainnet deployment
-
Frontend Security:
- Protect API keys with environment variables
- Implement proper authentication for admin functions
- Validate all user inputs
- Use HTTPS for all connections
-
Firebase Security:
- Configure strict security rules
- Limit file sizes and types
- Set up proper authentication
- Enable Firebase Security features
Conclusion
This NFT platform demonstrates a production-ready approach to building on Nexus. By combining modern web technologies with blockchain capabilities, you can create powerful NFT applications that leverage Nexus’s performance and security.
The modular architecture allows for easy customization and extension, making it an ideal starting point for your own NFT projects.
Was this page helpful?