A modern Web3 application template featuring Next.js, Reown, Ethers.js, and Chakra UI.
- 🚀 Next.js - React framework for production
- 🔗 Reown - Web3 authentication & wallet connections
- ⚡ Ethers.js (v6) - Ethereum library
- 💅 Chakra UI - Component library
- 🔧 Example Smart Contract
- Multi-wallet support
- Email & social logins (Google, Farcaster, GitHub)
- Multiple network support (Sepolia, Optimism, zkSync, Base, etc.)
- Dark/Light theme
- Built-in faucet API
- TypeScript
- Testing setup with Jest
- ESLint + Prettier config
node -v # v20.9.0 or later
pnpm -v # v8.7.5 or later
- Clone the repository:
git clone https://github.com/your-username/genji.git
cd genji
- Install dependencies:
pnpm install
- Set up environment:
cp .env.example .env
- Configure
.env
:
# Get yours at https://cloud.walletconnect.com
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID='your_project_id'
# RPC endpoint
NEXT_PUBLIC_RPC_ENDPOINT_URL='https://sepolia.gateway.tenderly.co'
# Only needed if using the faucet API
NEXT_PUBLIC_SIGNER_PRIVATE_KEY='your_private_key'
- Start development server:
pnpm dev
Visit http://localhost:3000
🚀
src/
├── components/ # UI components
│ ├── Header.tsx # Main navigation
│ ├── layout/ # Layout components
│ └── ...
├── context/
│ └── web3modal.tsx # Web3 configuration
├── hooks/ # Custom React hooks
├── pages/ # Next.js pages
│ ├── api/ # API routes
│ │ └── faucet.ts
│ └── index.tsx
└── utils/ # Helpers & constants
├── config.ts
└── erc20.ts
import { useAppKitAccount, useAppKitProvider } from '@reown/appkit/react'
export default function YourComponent() {
const { address, isConnected } = useAppKitAccount()
const { walletProvider } = useAppKitProvider('eip155')
if (!isConnected) {
return <w3m-button /> // Reown connect button
}
return <div>Connected: {address}</div>
}
// Initialize contract
const ethersProvider = new BrowserProvider(walletProvider as Eip1193Provider)
const signer = await ethersProvider.getSigner()
const contract = new Contract(ERC20_CONTRACT_ADDRESS, ERC20_CONTRACT_ABI, signer)
// Call contract method
const tx = await contract.mint(parseEther('1000'))
const receipt = await tx.wait()
import { Button, useToast } from '@chakra-ui/react'
export default function YourComponent() {
const toast = useToast()
const handleClick = () => {
toast({
title: 'Success!',
status: 'success',
duration: 9000,
isClosable: true,
})
}
return (
<Button onClick={handleClick} colorScheme="blue">
Click me
</Button>
)
}
Run tests:
pnpm test # Run all tests
pnpm test:watch # Watch mode
The template supports multiple networks. Configure in src/context/web3modal.tsx
:
const networks = [
sepolia, // Default network
optimism,
zksync,
base,
arbitrum,
gnosis,
polygon,
polygonZkEvm,
mantle,
celo,
avalanche,
degen,
]
- iOS: Safari 10+ (iOS 10+)
- Android: Chrome 51+ (Android 5.0+)
- Desktop: Modern browsers
Modify in src/utils/config.ts
:
export const THEME_COLOR_SCHEME = 'blue'
export const THEME_INITIAL_COLOR = 'system'
- Update contract details in
src/utils/erc20.ts
- Implement your interaction logic
pnpm dev # Start development server
pnpm build # Production build
pnpm start # Start production server
pnpm lint # Run ESLint
pnpm format # Format code with Prettier
Need help? Reach out: