A modern, full-stack NFT Minting Dapp built with Next.js and Hardhat for the Base Network.
This project allows users to mint NFTs with custom metadata and images, storing assets on IPFS via Pinata.
- Features
- Project Structure
- Getting Started
- Smart Contract
- Client (Next.js Dapp)
- Customization
- Contributing
- License
- ERC721 NFT contract with metadata and image support
- Mint NFTs with custom attributes and images
- IPFS integration via Pinata for decentralized storage
- Wallet connection and ETH balance check
- Modern UI with Tailwind CSS and shadcn/ui
- Ready for deployment on Base Sepolia or Base Mainnet
client/ # Next.js frontend Dapp
src/
app/
components/
config/
utils/
public/
...
contract/ # Hardhat smart contract project
contracts/
BaseNFT.sol
scripts/
deploy.js
test/
...
- Node.js (v18+ recommended)
- npm or yarn
- Hardhat
- Pinata account for IPFS storage
- Alchemy or Infura for Base RPC endpoints
git clone https://github.com/codewithabbass/mintnftdapp.gitcd mintnftdapp-
Install dependencies:
cd contract npm install -
Configure Environment:
-
Edit
hardhat.config.jsand replace the placeholder RPC URL and private key with your own. -
If you want to change the NFT collection's name or symbol, open
contracts/BaseNFT.soland update the constructor arguments. -
For example, in the contract:
constructor() ERC721("BaseNFTCollection", "BNC") {}
-
Replace
"BaseNFTCollection"and"BNC"with your desired collection name and symbol.
-
-
Compile the contract:
npx hardhat compile
-
Deploy to Base Sepolia:
npx hardhat run scripts/deploy.js --network baseSepolia
- The deployed contract address will be printed in the console.
-
Flatten the contract:
npx hardhat flatten contracts/BaseNFT.sol > flattenedBaseNFT.sol -
Verify on BaseScan:
npx hardhat verify --network baseSepolia YOUR_CONTRACT_ADDRESS
-
Install dependencies:
cd client npm install -
Configure Environment Variables:
Update
next.config.tsfile in theclientdirectory:NEXT_PUBLIC_PROJECT_ID=your_reown_project_id NEXT_PINATA_JWT=your_pinata_jwt NEXT_PINATA_GATEWAY_URL=https://gateway.pinata.cloud/ipfs NEXT_PINATA_BASE_URL=https://gateway.pinata.cloud/ipfs- Replace the values with your actual API keys and endpoints.
- Check for comments in the codebase for other places to update contract addresses or API keys.
-
Start the development server:
npm run dev
Open http://localhost:3000 in your browser.
-
Contract Address:
Update the contract address and ABI inclient/src/utils/constant.tsafter deployment. -
Network Configuration:
Update supported networks inclient/src/config/wagmiConfig.tsandclient/src/config/Wagmi.tsxas needed. -
Pinata Integration:
The Pinata upload logic is insrc/utils/IPFS.ts.
Make sure your JWT and gateway URLs are correct. -
UI/UX:
The main minting interface is insrc/components/MintinInterface.tsxandsrc/components/MintForm.tsx.
- Fork the repository
- Create your feature branch (
git checkout -b feature/YourFeature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin feature/YourFeature) - Open a pull request
This project is licensed under the MIT License.