thirdweb: Create a Gated Website Using NFTs and IPFS
Learn how to create a gated website using NFTs and IPFS.
Last updated
Learn how to create a gated website using NFTs and IPFS.
Last updated
thirdweb is an easy-to-use platform to build Web3 applications with code or no-code. thirdweb makes creating and deploying apps such as NFT collections or NFT marketplaces easy. thirdweb can be used with objects stored on IPFS, so objects stored in a Filebase IPFS bucket can be seamlessly uploaded for use with a thirdweb app.
Read below to learn how to create a gated website using NFTs and IPFS.
Then select 'Deploy Now'.
For this tutorial, we’ll be using the Mumbai testnet, so we are using a Mumbai wallet.
To do this, navigate to console.filebase.com. If you don’t have an account already, sign up, then log in.
Select ‘Create Bucket’ in the top right corner to create a new bucket for your NFTs.
Bucket names must be unique across all Filebase users, be between 3 and 63 characters long, and can contain only lowercase characters, numbers, and dashes.
These files need to be named in sequential order, such as 0.png, 1.png, 2.png, etc.
https://ipfs.filebase.io/ipfs/IPFS_CID
Take note of this URL.
Select the ‘Code’ tab. This code showcases different code snippets to use to mint your NFTs using scripts, with your contract address and crypto wallet address inputted automatically for easy copy and paste. This tutorial will showcase the JavaScript code examples, but you can use any of the languages showcased in this Code tab. You can follow along with the code examples showcased in this tutorial, or copy and paste the snippets provided in this tab.
npm install @thirdweb-dev/sdk
CONTRACT
with your contract address, WALLET_ADDRESS
with your crypto wallet address, each IPFS_CID
with your IPFS folder CID you took note of earlier and replacing the name and description of each NFT with your desired information.node mint.js
This will determine who is able to claim this NFT.
Open a command-line window, then create a project with this template with the following command:
npx create-tw-app --example nft-gated-website
cd nft-gated-website
npm install
npm run dev
src/App.js
file.Replace the following value with the contract address you took note of earlier.
127.0.0.1
, and will look like this:You can change the text, style, and any other aspect of this webpage by editing the src/App.js file.
You can also change this text in the src/App.js
file to reflect your NFT drop.
Using this example, you can expand on and create a landing page that NFT holders are redirected to after minting their membership NFT, creating a gated website exclusive to your NFT holders!