Skip to content

GIT-Pushers/nft-marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

32 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎨 NFT Marketplace - Complete Web3 Platform

A full-stack NFT marketplace and rental platform built with Next.js, Solidity, and IPFS integration. Users can mint, buy, sell, and rent NFTs with advanced features like royalties, platform fees, and decentralized metadata storage.

NFT Marketplace Next.js Solidity TypeScript

🌟 Features

🎯 Core Functionality

  • 🎨 NFT Minting: Create NFTs with metadata stored on IPFS
  • πŸ›’ Buy/Sell: Traditional NFT marketplace functionality
  • 🏠 NFT Rental: Unique rental system with time-based access
  • πŸ’° Royalty System: Creator royalties on secondary sales
  • πŸ“Š Platform Fees: Configurable marketplace fees
  • 🌐 IPFS Integration: Decentralized metadata and image storage

πŸ”§ Technical Features

  • ⚑ Modern Stack: Next.js 15 with App Router and React 19
  • 🎨 Beautiful UI: TailwindCSS with custom Sanchez font
  • 🌈 3D Graphics: Three.js and GSAP animations
  • πŸ”— Web3 Integration: Thirdweb SDK for blockchain interactions
  • πŸ“± Responsive Design: Mobile-first with bottom navigation
  • πŸŒ™ Dark Mode: Theme switching support
  • πŸ”’ Secure: OpenZeppelin contracts for security

πŸ—οΈ Project Structure

nft-marketplace/
β”œβ”€β”€ marketplace-contracts/          # Smart contracts
β”‚   β”œβ”€β”€ contracts/
β”‚   β”‚   └── MyContract.sol         # NFT Marketplace contract
β”‚   β”œβ”€β”€ hardhat.config.js          # Hardhat configuration
β”‚   └── scripts/
β”‚       └── verify/
β”‚           └── my-contract.js     # Contract verification
β”‚
└── nft-website/                   # Frontend application
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ app/                   # Next.js App Router
    β”‚   β”‚   β”œβ”€β”€ create/            # NFT creation page
    β”‚   β”‚   β”œβ”€β”€ home/              # Main app pages
    β”‚   β”‚   β”‚   β”œβ”€β”€ buy/           # Buy NFTs
    β”‚   β”‚   β”‚   β”œβ”€β”€ rent/          # Rent NFTs
    β”‚   β”‚   β”‚   β”œβ”€β”€ wallet/        # User wallet
    β”‚   β”‚   β”‚   └── create/        # Mint NFTs
    β”‚   β”‚   β”œβ”€β”€ layout.tsx         # Root layout
    β”‚   β”‚   └── page.tsx           # Landing page
    β”‚   β”œβ”€β”€ components/            # Reusable components
    β”‚   β”‚   β”œβ”€β”€ ui/                # UI components
    β”‚   β”‚   β”œβ”€β”€ infinite-hero.tsx  # 3D hero section
    β”‚   β”‚   └── bottomNavBar.tsx   # Navigation
    β”‚   β”œβ”€β”€ lib/
    β”‚   β”‚   └── pinata.ts          # IPFS utilities
    β”‚   └── constants.ts           # Contract addresses
    └── package.json

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm or pnpm
  • Wallet (MetaMask recommended)
  • Pinata account for IPFS

1. Clone Repository

git clone https://github.com/Vishal-770/nft-marketplace.git
cd nft-marketplace

2. Setup Smart Contracts

cd marketplace-contracts
npm install

# Deploy contract (using Thirdweb)
npm run deploy

3. Setup Frontend

cd ../nft-website
npm install

# Create environment file
cp .env.local.example .env.local

4. Configure Environment Variables

# nft-website/.env.local
NEXT_PUBLIC_THIRD_WEB_CLIENT_ID=your_thirdweb_client_id
NEXT_PUBLIC_THIRD_WEB_KEY=your_thirdweb_secret_key
NEXT_PUBLIC_PINATA_JWT=your_pinata_jwt_token
NEXT_PUBLIC_PINATA_GATEWAY=gateway.pinata.cloud

5. Update Contract Address

// src/constants.ts
export const contractAddress = "YOUR_DEPLOYED_CONTRACT_ADDRESS";

6. Run Development Server

npm run dev

Visit http://localhost:3000 to see the application.

πŸ“± Application Features

🎨 NFT Creation (/create)

  • Image Upload: Drag-and-drop file upload with preview
  • Metadata Form: Name, description, and attributes
  • IPFS Storage: Automatic upload to Pinata
  • Dynamic Traits: Add up to 5 custom attributes
  • Real-time Validation: Form validation with error handling

🏠 Main App (/home)

  • Buy Page: Browse and purchase NFTs
  • Rent Page: Rent NFTs for specified durations
  • Create Page: Mint new NFTs on blockchain
  • Wallet Page: View owned and rented NFTs

🎭 UI/UX Features

  • 3D Hero Section: WebGL shaders and animations
  • Dark/Light Mode: System-aware theming
  • Mobile Navigation: Bottom tab bar for mobile users
  • Loading States: Smooth loading indicators
  • Toast Notifications: Success/error feedback

πŸ”— Smart Contract Details

Contract: NFTMarketplace

Address: 0xf8947e481D2477349d157700b971d490766ce5B7
Network: Sepolia Testnet
Standard: ERC721 + ERC2981 (Royalties)

Key Functions

Minting

function mintNFT(string memory _hash, uint256 royaltyPercent) external
  • Creates new NFT with IPFS metadata hash
  • Sets creator royalties (max 10%)

Marketplace Operations

function listNFTForSale(uint256 tokenId, uint256 priceInWei) external
function listNFTForRent(uint256 tokenId, uint256 pricePerDayInWei, uint256 minDurationInHours, uint256 maxDurationInHours) external
function buyNFT(uint256 tokenId) external payable
function rentNFT(uint256 tokenId, uint256 durationInHours) external payable

Rental System

  • Ownership Retention: Original owner keeps NFT during rental
  • Time-based Access: Renter gets access for specified duration
  • Automatic Expiry: Rental ends automatically
  • Transfer Protection: Prevents transfers during rental period

Fee Structure

  • Platform Fee: 2.5% (configurable by owner)
  • Creator Royalties: 0-10% (set by creator)
  • Gas Optimization: Efficient batch operations

πŸ› οΈ Technology Stack

Frontend

  • Framework: Next.js 15.5.3 with App Router
  • Language: TypeScript 5.0
  • Styling: TailwindCSS 4.0
  • UI Components: Radix UI primitives
  • 3D Graphics: Three.js + React Three Fiber
  • Animations: GSAP with SplitText
  • Forms: React Hook Form
  • Web3: Thirdweb SDK 5.106.0
  • IPFS: Pinata SDK 2.5.0

Smart Contracts

  • Language: Solidity 0.8.20
  • Framework: Hardhat
  • Standards: ERC721, ERC2981, Ownable
  • Security: OpenZeppelin contracts
  • Deployment: Thirdweb deployment tools
  • Network: zkSync Sepolia Testnet

Development Tools

  • Package Manager: npm/pnpm
  • Linting: ESLint
  • Bundler: Turbopack (Next.js)
  • Version Control: Git

πŸ” Security Features

Smart Contract Security

  • OpenZeppelin: Battle-tested contract implementations
  • Reentrancy Protection: Built-in guards
  • Access Control: Owner-only administrative functions
  • Transfer Locks: Prevents transfers during rental
  • Overflow Protection: SafeMath equivalent in Solidity 0.8+

Frontend Security

  • Environment Variables: Secure API key management
  • Input Validation: Client and server-side validation
  • File Type Validation: Image upload restrictions
  • Size Limits: 10MB max file size for uploads

πŸ“Š Business Model

Revenue Streams

  1. Platform Fees: 2.5% on all sales and rentals
  2. Premium Features: Enhanced listing options
  3. Creator Tools: Advanced analytics and promotion

Fee Distribution

Sale Price: 100 ETH
β”œβ”€β”€ Creator Royalty: 5 ETH (5%)
β”œβ”€β”€ Platform Fee: 2.5 ETH (2.5%)
└── Seller Receives: 92.5 ETH (92.5%)

🎯 Roadmap

Phase 1: βœ… Core Platform

  • Smart contract development
  • Basic marketplace functionality
  • NFT rental system
  • IPFS integration
  • Frontend development

Phase 2: πŸ”„ In Progress

  • Advanced search and filtering
  • Collection management
  • Bulk operations
  • Analytics dashboard
  • Mobile app

Phase 3: πŸ“‹ Planned

  • Cross-chain support
  • DAO governance
  • Creator verification
  • Advanced rental features
  • Marketplace API

🀝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

Development Setup

# Fork the repository
git clone https://github.com/YOUR_USERNAME/nft-marketplace.git

# Create feature branch
git checkout -b feature/amazing-feature

# Make changes and commit
git commit -m "Add amazing feature"

# Push to branch
git push origin feature/amazing-feature

# Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ“ž Support

Documentation

Community

Issues

Found a bug? Have a feature request? Please create an issue.


πŸ† Acknowledgments

  • OpenZeppelin: For secure smart contract templates
  • Thirdweb: For Web3 development tools
  • Pinata: For IPFS infrastructure
  • Vercel: For deployment platform
  • Next.js Team: For the amazing framework

Made with ❀️ by Vishal

Building the future of digital asset ownership and accessibility.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •