This repository is a sample source code for NFT marketplace on NEAR. It's not ready and need improvements for production.
A PoC backbone for NFT Marketplaces on NEAR Protocol.
- NFT & Market smart contracts following NEP-171
- demo pay out royalties (FTs and NEAR)
- test and determine standards for markets (best practice?) to buy/sell NFTs (finish standard) with FTs (already standard)
- demo some basic auction types, secondary markets and
- frontend with MUI (Material Design - React UI components )
- first pass / internal audit
- integrate with Crust dStorage Solution
- integrate with DiaData - CoinMarketCap endpoint to convert NEAR to USD
- integrate with Google Analytic to count page views for each NFT item.
- use MongoDB to store extra profile data such as profile name, collection, banner, logo...
- implement simple collection feature: each near wallet account has a collection name.
- show collections & NFTs on home page
- show related NFTs item on NFT detailed page.
- switch between chains (NEAR, Aurora, XRP, Ethereum...)
- connect with bridged tokens e.g. buy and sell with wETH/nDAI (or whatever we call these)
- NextJS 11
- Mongo Atlas
- MUI
- Smart Contracts use Rust
- IPFS uses Crust
Beyond having npm and node (latest versions), you should have Rust installed. I recommend nightly because living on the edge is fun.
rustup target add wasm32-unknown-unknown
Also recommend installing near-cli globally
npm i -g near-cli
Everything else can be installed via:
yarn
cd server && yarn
There is only one config.js file found in src/config.js
, this is also used for running tests.
Using src/config.js
you can set up your different environments. Use REACT_APP_ENV
to switch environments e.g. in package.json
script deploy
.
You need create a NEAR wallet account for testing purpose.
Open neardev/dev-account.dev and change your dev account to build smart contracts. There are two accounts for NFT contract and Market contract. NFT contract is built on main account, Market contract is built on sub-account.
Read this document to create a sub-account
Open file next.config.js
change mongoDB url.
For tracking page views, this app uses Google Analytic Api. Following steps below:
- Create a Google Analytic Account
- Create a project in Google Console based on this guide Analytic Api
- Change .env.example to .env and input information:
GOOGGLE_ANALYTICS_TRACKING_ID
: Your tracking IDGOOGLE_ANALYTICS_VIEW_ID
: view idGOOGLE_CLIENT_EMAIL
: IAM user service accountGOOGLE_CLIENT_ID
: client idGOOGLE_PRIVATE_KEY
: private key
Build Smart Contract:
source neardev/dev-account.dev
npm run build-contract
Run Dev Mode for frontend
npm run dev
Run Production Mode for frontend
npm run build
npm run start
App can be started by PM2
pm2 start npm --name "Your app name" -- run start