A modern React app that showcases onchain profiles and links. The Home page features a polished hero and schedule timeline built entirely with Tailwind CSS utilities.
0x45DAa0695CC153275619d1B5a17e0d5811B2c710
-
Wallet Connection via Reown AppKit (WalletConnect)
- Multi-wallet support (MetaMask, WalletConnect, Coinbase Wallet, Trust Wallet, etc.)
- Mobile wallet support via QR code scanning
- Seamless connection experience with beautiful UI
- Automatic wallet detection and connection state management
-
Elegant hero section with CTAs and subtle glassmorphism
-
Timeline/schedule card stack with soft shadows and rotations
-
Client-side routing for usernames (e.g.
/vitalik) -
Fully styled using Tailwind CSS v4 (no custom CSS needed)
-
Discover page - Browse all registered users and explore profiles
-
Dashboard for managing your onchain profile
-
Admin Dashboard - Track user interactions, analytics, and platform metrics
-
Transaction notifications with react-hot-toast (shows transaction hash and explorer links)
-
Auto-redirect to dashboard if user already has a profile
- React 19 + Vite 7
- React Router
- Tailwind CSS v4 (via
@tailwindcss/vite) - Web3 Integration: wagmi + viem + Reown AppKit (WalletConnect)
Runtime:
react,react-domreact-router-domtailwindcss@tailwindcss/vite- Web3 stack:
wagmi,viem,@reown/appkit,@reown/appkit-adapter-wagmi - State/data:
@tanstack/react-query - Notifications:
react-hot-toast - Charts:
apexcharts,react-apexcharts
Dev/Tooling:
vite,@vitejs/plugin-reacteslint,@eslint/js,eslint-plugin-react-hooks,eslint-plugin-react-refresh,globals
- Install dependencies:
npm install- Start the dev server:
npm run dev- Build for production:
npm run build- Preview the production build:
npm run previewTailwind v4 is enabled via the Vite plugin and a single import:
vite.config.jsadds the pluginsrc/index.csscontains@import "tailwindcss";
Use Tailwind utility classes directly in JSX (see src/pages/Home.jsx).
This application uses Reown AppKit (formerly WalletConnect) for seamless wallet connection and Web3 interactions. Reown AppKit provides a unified interface for connecting to multiple wallet providers including MetaMask, WalletConnect, Coinbase Wallet, and many more.
- Multi-Wallet Support: Users can connect with any wallet provider through a single interface
- WalletConnect Protocol: Enables mobile wallet connections via QR code scanning
- Beautiful UI: Pre-built, customizable wallet connection modal
- Cross-Chain Support: Easily switch between different blockchain networks
- Secure: Implements WalletConnect's secure protocol for wallet connections
The app is wrapped with AppKitProvider in src/Provider.jsx:
import { createAppKit } from '@reown/appkit/react'
import { WagmiAdapter } from '@reown/appkit-adapter-wagmi'
import { base, baseSepolia } from '@reown/appkit/networks'
// Create Wagmi Adapter with network configuration
const wagmiAdapter = new WagmiAdapter({
networks: [base], // Base Mainnet
projectId: import.meta.env.VITE_APPKIT_PROJECT_ID,
ssr: true,
})
// Initialize Reown AppKit
createAppKit({
adapters: [wagmiAdapter],
networks: [base],
projectId: import.meta.env.VITE_APPKIT_PROJECT_ID,
metadata: {
name: "Onchain Linktree",
description: "Decentralized Link Hub",
url: "https://onchain-linktree.com",
icons: ["/logo.png"],
},
features: {
analytics: true,
},
})
// Wrap app with providers
export function AppKitProvider({ children }) {
return (
<WagmiProvider config={wagmiAdapter.wagmiConfig}>
<QueryClientProvider client={queryClient}>
{children}
</QueryClientProvider>
</WagmiProvider>
)
}import { useAppKit } from '@reown/appkit/react'
function MyComponent() {
const { open } = useAppKit()
return (
<button onClick={() => open()}>
Connect Wallet
</button>
)
}import { useAppKitAccount } from '@reown/appkit/react'
function MyComponent() {
const { isConnected, address } = useAppKitAccount()
if (!isConnected) {
return <div>Please connect your wallet</div>
}
return <div>Connected: {address}</div>
}import { useDisconnect } from '@reown/appkit/react'
function MyComponent() {
const { disconnect } = useDisconnect()
return (
<button onClick={disconnect}>
Disconnect
</button>
)
}- User clicks "Connect Wallet" button
- Reown AppKit modal opens showing available wallet options
- User selects their preferred wallet (MetaMask, WalletConnect, etc.)
- For mobile wallets, QR code is displayed for scanning
- User approves connection in their wallet
- App receives connection status and wallet address via
useAppKitAccount() - User can now interact with smart contracts on-chain
# Required for contract calls
VITE_USER_DATA_CONTRACT_ADDRESS=0xYourContractAddress
# Required for Reown AppKit wallet modal and WalletConnect
# Get your project ID from: https://cloud.reown.com
VITE_APPKIT_PROJECT_ID=your_project_idTo get your Reown AppKit Project ID:
- Visit Reown Cloud
- Create a new project or use an existing one
- Copy your Project ID
- Add it to your
.envfile
Contract ABI is centralized in:
src/lib/abi/userDataContract.js(export:userDataAbi)
Helper hooks for reads are in:
src/lib/hooks/useUserContract.js(exports:useMyUserDetails,useMyDataArray,useAllUsers,useUserDetails,useUserDataArray)
- File:
src/pages/Login.jsx - Wallet Connection: Uses
useAppKit()hook to open Reown AppKit modal for wallet connection - Flow:
- User enters a username
- If wallet not connected, Reown AppKit modal opens automatically via
open()function - User connects wallet through WalletConnect or other supported providers
- Once connected,
useAppKitAccount()provides connection status - App calls
registerUser(username)usingwagmiuseWriteContractwithuserDataAbi - Transaction is signed in the user's wallet
- On transaction confirmation, navigate to
/:username
- Auto-redirect: If user already has a profile, they're automatically redirected to dashboard
Example usage in a component:
import { useMyUserDetails, useMyDataArray } from "../lib/hooks/useUserContract";
const { data: details } = useMyUserDetails();
const { data: dataArray } = useMyDataArray();import { useWriteContract } from "wagmi";
import { userDataAbi } from "../lib/abi/userDataContract";
const { writeContract } = useWriteContract();
writeContract({
abi: userDataAbi,
address: import.meta.env.VITE_USER_DATA_CONTRACT_ADDRESS,
functionName: "addUserData",
args: ["twitter", "https://twitter.com/you"],
});src/
main.jsx # App bootstrap with AppKitProvider
App.jsx # Routes configuration
Provider.jsx # Reown AppKit provider setup & wagmi configuration
pages/
Home.jsx # Landing page with hero section
UserProfile.jsx # Username route (public profile) - uses useAppKitAccount
Login.jsx # Register username on-chain - uses useAppKit() for wallet connection
Dashboard.jsx # Profile management dashboard
Discover.jsx # Browse all registered users
AdminDashboard.jsx # Analytics and user tracking dashboard
lib/
abi/
userDataContract.js # Contract ABI
hooks/
useUserContract.js # Read helpers (uses wagmi hooks)
utils/
explorer.js # Blockchain explorer URLs
analytics.js # Analytics tracking utility
index.css # Tailwind import
- Provider.jsx: Initializes Reown AppKit with wagmi adapter and network configuration
- Login.jsx: Uses
useAppKit()to open wallet connection modal - UserProfile.jsx: Uses
useAppKitAccount()to check if user owns the profile - All pages: Can access wallet connection state via
useAppKitAccount()hook
- Discover Page (
/discover): Browse all registered users on the platform - Shows all profiles registered on-chain
- Click any profile card to view their public profile
- Uses
getAllUsers()contract function to fetch all registered addresses - Each card displays username and truncated wallet address
- Dashboard (
/dashboard): Manage your onchain profile - View profile overview with stats
- Add/edit links with expandable form
- Quick stats: total links, join date, network
- Link to view your public profile
- Admin Dashboard (
/admin): Comprehensive analytics and user interaction tracking - Real-time metrics: Total users, profile views, link clicks, registrations
- Interactive ApexCharts visualizations:
- Hourly activity area chart (last 24 hours)
- Daily trends line chart (last 7 days)
- Event distribution pie chart
- User growth over time area chart
- Most active users horizontal bar chart (top 10)
- Top clicked links leaderboard
- Recent activity feed (last 24 hours)
- User engagement metrics including click-through rate
- Auto-refreshing data every 5 seconds
- Analytics tracking for:
- Profile views
- Link clicks
- User registrations
- Link additions
-
@reown/appkit: Modern wallet connection SDK providing unified wallet interface (formerly WalletConnect)
- Supports 100+ wallet providers including MetaMask, WalletConnect, Coinbase Wallet, Trust Wallet, etc.
- Mobile wallet support via QR code scanning
- Beautiful, customizable connection modal
- Built-in network switching
-
@reown/appkit-adapter-wagmi: Wagmi adapter for seamless Reown AppKit integration
- Bridges Reown AppKit with wagmi hooks
- Enables wallet connection state management
- Provides hooks:
useAppKit(),useAppKitAccount(),useDisconnect()
-
wagmi: React hooks for Ethereum interactions
useWriteContract: Write transactions to smart contractsuseReadContract: Read data from smart contractsuseWaitForTransactionReceipt: Track transaction statususeChainId: Get current network chain ID
-
viem: TypeScript interface and utilities for Ethereum
- Type-safe contract interactions
- Transaction building and signing
- ABI encoding/decoding
-
@tanstack/react-query: Data fetching and state management for React
- Caching and background updates
- Automatic refetching
- Optimistic updates
-
react-router-dom: Client-side routing
- Dynamic routes (
/:username) - Navigation between pages
- Dynamic routes (
-
tailwindcss: Utility-first CSS framework
- Rapid UI development
- Responsive design utilities
-
react-hot-toast: Beautiful toast notifications
- Transaction status updates
- Success/error notifications
-
apexcharts + react-apexcharts: Interactive chart library for data visualization
- Analytics dashboards
- Real-time data visualization
Additional networks can be easily added by importing them from @reown/appkit/networks. The app currently supports:
- Base Sepolia (Testnet)
- Base Mainnet
- Ethereum Mainnet (fallback)
To add more networks, update src/Provider.jsx:
import { baseSepolia, base } from '@reown/appkit/networks'
// Add networks to the configurationMIT