A modern, full-stack NFT marketplace built with Next.js 15, React 19, TypeScript, Tailwind CSS, and Hardhat. Buy, sell, and discover unique digital assets on Ethereum. This project demonstrates best practices in decentralized app (dApp) development, smart contract engineering, and modern frontend design.
- ⚡ Next.js 15 App Router: Fast, scalable, and SEO-friendly React app.
- 🎨 Tailwind CSS: Custom, responsive, and dark-mode enabled UI.
- 🖼️ NFT Minting & Listing: Create, list, and resell NFTs with image upload and metadata.
- 🛒 Marketplace: Browse, buy, and sell NFTs with real-time updates.
- 👤 Creator Dashboard: View your created and listed NFTs.
- 🔒 Smart Contracts: Secure, upgradeable contracts using Hardhat and OpenZeppelin.
- 🧪 Testing: Comprehensive smart contract tests with Hardhat and Chai.
- 🌗 Theming: Light/dark mode with persistent user preference.
- 🔗 Wallet Integration: (Pluggable, see code for extension points).
- Frontend: Next.js 15, React 19, TypeScript, Tailwind CSS, next-themes
- Smart Contracts: Solidity, Hardhat, OpenZeppelin
- Testing: Hardhat, Chai, Mocha
- UI Components: Custom React components, Headless UI, Next.js Image
- Other: ESLint (flat config), PostCSS, Hardhat Ignition
- Node.js (v18+ recommended)
- npm (v9+)
- Hardhat
- (Optional) Metamask or compatible Ethereum wallet
git clone https://github.com/OmarMWarraich/next15-nft-marketplace.git
cd next15-nft-marketplace
npm installnpx hardhat nodenpx hardhat ignition deploy ./ignition/modules/NFTMarketplace.tsnpm run devVisit http://localhost:3000 to view the app.
npx hardhat testapp/ # Next.js app directory (pages, layouts, routes)
components/ # Reusable React components (UI, Navbar, Footer, NFTCard, etc.)
contracts/ # Solidity smart contracts (NFTMarketplace.sol)
context/ # React context and constants
lib/ # Utility functions
public/assets/ # Static images and assets
test/ # Hardhat/Chai test files
config/ # App and contract config
contracts/NFTMarketplace.sol: Main NFT marketplace smart contract.app/create-nft/page.tsx: NFT creation UI.app/created-nfts/page.tsx: Creator dashboard for listed NFTs.app/nft-details/page.tsx: NFT details and purchase/resell.test/Lock.ts: Example Hardhat test.tailwind.config.ts: Custom Tailwind theme.hardhat.config.ts: Hardhat project config.
This project uses thirdweb for secure, web3-native authentication and wallet connection.
-
Install the thirdweb package:
npm install thirdweb
-
Add the following environment variables to
.env.local:NEXT_PUBLIC_THIRDWEB_AUTH_DOMAIN=localhost NEXT_PUBLIC_THIRDWEB_CLIENT_ID=your-client-id-here THIRDWEB_SECRET_KEY=your-secret-key-here AUTH_PRIVATE_KEY=your-auth-private-key-here
- Get your client ID and secret key from thirdweb dashboard.
- The private key can be any valid Ethereum private key (no funds required).
-
The app is wrapped in
ThirdwebProvider(lib/ThirdwebProvider.tsx) inapp/layout.tsx. -
The wallet connect/auth UI is provided by
ConnectButtonincomponents/ThirdwebConnect.tsx, used in the Navbar. -
Server actions for authentication are implemented in
actions/login.tsand wired to the ConnectButton'sauthprop.
- Users can connect their wallet and sign in using the Connect button in the Navbar.
- Authentication/session logic is handled via server actions (
getLoginPayload,doLogin,isLoggedIn,doLogout). - You can extend these actions to integrate with your backend/session store as needed.
- Theming: Edit
tailwind.config.tsandThemeProviderinapp/layout.tsx. - Smart Contracts: Extend
NFTMarketplace.solfor royalties, auctions, etc. - Wallet Integration: Extend or customize thirdweb authentication in
components/ThirdwebConnect.tsxandactions/login.ts.
- Fork the repo
- Create a feature branch (
git checkout -b feature/your-feature) - Commit your changes
- Push to your branch
- Open a Pull Request
If you have questions or want to contribute, please open an issue or PR!