Comprehensive documentation for the useElven SDK integrated within our Next.js Dapp Template.
The Next.js Dapp Template is a complete solution for building decentralized applications on the MultiversX blockchain. Built with Next.js, Shadcn UI, and Tailwind CSS, it leverages the useElven SDK for seamless blockchain interactions.
It supports the new Next.js App Router architecture and includes built-in tools for user authentication, wallet connections, transaction processing, and more.
The useElven SDK provides a set of React hooks and utilities designed to facilitate interactions with the MultiversX blockchain. It includes support for:
LoginModalButton
, Authenticated
, ProtectedPageWrapper
)For more detailed information, check out the official useElven SDK documentation.
This template integrates the useElven SDK seamlessly with Next.js, taking advantage of modern React patterns and the App Router for improved performance and developer experience.
The starter kit includes examples of various components and hooks to initiate wallet connections, handle user authentication, and interact with smart contracts, making it easy to build and scale your dapp.
You can run the project locally using one of the following methods:
Option 1: Using buildo-begins CLI
npx buildo-begins@latest init
Choose Next.js dapp template from the list.
Option 2: Manual Setup
cd nextjs-dapp-template
npm install
.cp .env.example .env.local
.npm run dev
.npm run build
and start with npm start
.The project uses a set of environment variables defined in an .env
file to manage configuration for different environments. Variables prefixed with NEXT_PUBLIC_
are exposed to the frontend.
Copy the .env.example
file to .env.local
and modify the values as needed. Key variables include:
NEXT_PUBLIC_MULTIVERSX_CHAIN
: Set this to devnet
, testnet
, or mainnet
NEXT_PUBLIC_WC_PROJECT_ID
: Your WalletConnect 2 Project IDNEXT_PUBLIC_DAPP_HOST
: The main URL of your dappNEXT_PUBLIC_TRANSFER_ADDRESS
: The address used for demo EGLD transfersNEXT_PUBLIC_MINT_SMART_CONTRACT_ADDRESS
: Smart contract address for NFT mintingNEXT_PUBLIC_MINT_FUNCTION_NAME
and NEXT_PUBLIC_QUERY_FUNCTION_NAME
: Function names for minting operations and token queriesNEXT_PUBLIC_MINT_PAYMENT_PER_TOKEN
and NEXT_PUBLIC_EGLD_TRANSFER_AMOUNT
: Define token prices and transfer amounts# .env.local example
NEXT_PUBLIC_MULTIVERSX_CHAIN=devnet
NEXT_PUBLIC_WC_PROJECT_ID=your_walletconnect_project_id
NEXT_PUBLIC_DAPP_HOST=http://localhost:3000
NEXT_PUBLIC_TRANSFER_ADDRESS=your_demo_transfer_address
NEXT_PUBLIC_MINT_SMART_CONTRACT_ADDRESS=your_mint_contract_address
NEXT_PUBLIC_MINT_FUNCTION_NAME=mint
NEXT_PUBLIC_QUERY_FUNCTION_NAME=getTotalTokensLeft
NEXT_PUBLIC_MINT_PAYMENT_PER_TOKEN=0.01
NEXT_PUBLIC_EGLD_TRANSFER_AMOUNT=0.001
Ensure these values are properly configured for your deployed environment to securely manage both public and private settings.