A complete decentralized NFT marketplace built with modern architecture, Web3 integration, and software engineering best practices. The application allows users to connect their wallets, view NFTs from a collection, and perform secure buy and sell operations on the Ethereum testnet.
Demonstrate in practice the construction of a complete decentralized application (dApp) with:
- Web3 Development and blockchain integration
- Wallet Integration (WalletConnect, Wagmi, RainbowKit)
- RESTful APIs with Go for high performance
- Tokenization and transfer of digital assets (NFTs)
- Modular and scalable architecture
- π Connect wallet via Metamask or WalletConnect
- π List NFTs available in the marketplace
- π Display details and metadata of each NFT
- π° Buy NFTs with blockchain transactions
- π List NFTs for sale (listing via contract)
- π Simplified transaction history
- ποΈ Go API to serve NFT metadata (ERC721 standard)
- π― NFT Staking
- π¨ Dynamic minting via frontend
- π IPFS integration for images
- β Reputation system for sellers
- π Analytics dashboard on-chain
Frontend (React + Wagmi) <--> Backend (Go REST API) <--> Blockchain (Ethereum testnet)
- Frontend: React with RainbowKit, Wagmi and Viem for wallet connection, listing and NFT purchases
- Backend: Go with Fiber serving RESTful endpoints for NFT metadata and transaction recording
- Smart Contract: Solidity (ERC721) for NFT issuance, listing and sale, compiled and deployed via Hardhat
- Blockchain: Goerli or Sepolia Testnet, accessed via Alchemy or Infura RPC
- Storage: JSONs served via local API (can be extended to IPFS)
Layer | Stack / Tools | Version |
---|---|---|
Frontend | React, Vite, Wagmi, RainbowKit, Tailwind CSS | React 18+ |
Backend | Go, Fiber, REST API | Go 1.20+ |
Smart Contracts | Solidity, Hardhat, OpenZeppelin | Solidity ^0.8.0 |
Blockchain | Ethereum (Goerli / Sepolia) | - |
Infrastructure | Railway / Render (API), Vercel (Web) | - |
Wallet Support | Metamask, WalletConnect | - |
nft-marketplace/
βββ backend/ # Go API
β βββ main.go # Application entry point
β βββ routes/ # Route definitions
β β βββ nft.go # NFT routes
β β βββ transaction.go # Transaction routes
β βββ handlers/ # Business logic
β β βββ nft_handler.go
β βββ models/ # Data models
β β βββ nft.go
β β βββ transaction.go
β βββ middleware/ # Middlewares (CORS, etc.)
β βββ config/ # Configurations
β βββ go.mod # Go dependencies
β βββ Dockerfile # Containerization
β βββ railway.json # Railway deployment
βββ frontend/ # React App
β βββ src/
β β βββ components/ # React components
β β β βββ Header.tsx
β β β βββ NFTCard.tsx
β β βββ pages/ # Application pages
β β β βββ Home.tsx
β β β βββ Marketplace.tsx
β β β βββ NFTDetail.tsx
β β β βββ MyNFTs.tsx
β β βββ hooks/ # Custom hooks
β β βββ utils/ # Utilities
β β βββ App.tsx # Main component
β β βββ main.tsx # Entry point
β βββ package.json # Node.js dependencies
β βββ vite.config.ts # Vite configuration
β βββ tailwind.config.js # Tailwind configuration
β βββ tsconfig.json # TypeScript configuration
βββ contracts/ # Smart Contracts
β βββ NFTToken.sol # ERC721 contract
β βββ NFTMarketplace.sol # Main contract
β βββ hardhat.config.js # Hardhat configuration
β βββ scripts/ # Deployment scripts
β β βββ deploy.js
β βββ test/ # Contract tests
β βββ package.json # Hardhat dependencies
βββ docs/ # Documentation
β βββ API.md # API documentation
β βββ DEPLOYMENT.md # Deployment guide
βββ docker-compose.yml # Container orchestration
βββ Makefile # Automation commands
βββ setup.sh # Setup script
βββ README.md # This file
- Node.js 18+ and Yarn/NPM installed
- Go 1.20+ with modules enabled
- Git for version control
- Metamask with testnet (Goerli/Sepolia) configured
- Alchemy or Infura (RPC endpoint)
- Vercel (frontend deployment)
- Railway or Render (backend deployment)
- GitHub (repository and CI/CD)
- Testnet faucet (free ETH for testing)
- Hardhat for contract deployment
- Etherscan for contract verification
git clone <repository-url>
cd nft-marketplace
# Automatic setup (Linux/Mac)
./setup.sh
# Or manual setup
make setup
cd backend
cp env.example .env
PORT=8080
ENVIRONMENT=development
CORS_ORIGIN=http://localhost:3000
cd frontend
cp env.example .env
VITE_API_URL=http://localhost:8080
VITE_CONTRACT_ADDRESS=your_deployed_contract_address
VITE_CHAIN_ID=11155111 # Sepolia
cd contracts
cp env.example .env
PRIVATE_KEY=your_private_key
ALCHEMY_API_KEY=your_alchemy_key
ETHERSCAN_API_KEY=your_etherscan_key
cd contracts
npm install
npx hardhat compile
npx hardhat run scripts/deploy.js --network sepolia
cd backend
go mod tidy
go run main.go
cd frontend
npm install
npm run dev
- Frontend: http://localhost:3000 (or 3001 if 3000 is occupied)
- Backend API: http://localhost:8080
- API Health Check: http://localhost:8080/health
GET /api/v1/nfts
- List all NFTsGET /api/v1/nfts/:id
- Get specific NFTGET /api/v1/nfts/:id/metadata
- Get ERC721 metadataPOST /api/v1/nfts
- Create new NFTPUT /api/v1/nfts/:id
- Update NFTDELETE /api/v1/nfts/:id
- Delete NFT
GET /api/v1/nfts/marketplace/listings
- Listed NFTsPOST /api/v1/nfts/:id/list
- List NFTPOST /api/v1/nfts/:id/buy
- Buy NFTDELETE /api/v1/nfts/:id/cancel-listing
- Cancel listing
GET /api/v1/transactions
- List transactionsGET /api/v1/transactions/:id
- Get specific transactionGET /api/v1/transactions/user/:address
- User transactionsGET /api/v1/transactions/nft/:tokenId
- NFT transactions
# Start all services
make dev
# Frontend only
make frontend
# Backend only
make backend
# Tests
make test
# Build
make build
# Deploy smart contracts
make deploy-contracts
# Deploy backend
make deploy-backend
# Deploy frontend
make deploy-frontend
- Reentrancy protection in contracts
- Input validation and security checks
- Pausability for emergencies
- Ownership controls for administrative functions
- Input sanitization in all APIs
- Rate limiting to prevent spam
- CORS properly configured
- Wallet validation before sensitive operations
- Connected wallet validation before interactions
- Error boundaries for error handling
- Loading states for better UX
- HTTPS required in production
cd contracts
npx hardhat test
npx hardhat coverage
cd backend
go test ./...
go test -v -cover ./...
cd frontend
npm test
npm run test:coverage
cd frontend
npm run build
# Deploy to Vercel via GitHub integration
cd backend
# Configure environment variables
# Deploy via Railway or Render dashboard
cd contracts
npx hardhat run scripts/deploy.js --network mainnet
npx hardhat verify --network mainnet CONTRACT_ADDRESS
- Modular project with clear separation between layers
- Go backend code ideal for high performance
- Ethereum standards usage (ERC721) and compatible metadata
- Real integration with testnet via popular wallets
- Extensible architecture for production
- Redis cache for NFT metadata
- Lazy loading of images in frontend
- Query optimization in backend
- CDN for static assets
- Fork the project
- Create a branch for your feature (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
- Go: Use
gofmt
andgolint
- React: Use ESLint and Prettier
- Solidity: Use Solhint
- Commits: Use conventional commits
This project is under the MIT license. See the LICENSE file for more details.
If you encounter any problems or have questions:
- Check the documentation in docs/
- Open an issue on GitHub
- Consult the guide QUICK-START.md
- Use the Makefile for common commands
- OpenZeppelin for secure contracts
- Wagmi for Web3 integration
- RainbowKit for wallet UI
- Fiber for Go framework
- Tailwind CSS for styling
- Vite for modern build tool
- Basic smart contracts
- Simple Go API
- Basic React frontend
- Web3 integration
- Royalty system
- IPFS integration
- Analytics dashboard
- E2E tests
- Layer 2 support
- Multi-chain
- Mobile app
- DAO governance
π― Ready to start? Follow the setup instructions above and start exploring the world of NFTs! For specific implementation questions, consult the development guide.