A Next.js frontend for the StyleHub smart contract deployed on Base mainnet.
- 🛍️ Shop - Browse and purchase fashion items
- 📦 Orders - Track your orders and cancel if needed
- 🏪 Seller Dashboard - List and manage products (for authorized sellers)
- ⚙️ Admin Panel - Manage sellers, orders, fees, and withdrawals (owner only)
- Next.js 14 - React framework
- shadcn/ui - UI components
- wagmi v2 - Ethereum interactions
- viem - TypeScript Ethereum library
- TailwindCSS - Styling
npm installCopy the example environment file and fill in your values:
cp .env.example .env.localUpdate .env.local:
NEXT_PUBLIC_CONTRACT_ADDRESS- Your deployed StyleHub contract addressNEXT_PUBLIC_WALLETCONNECT_PROJECT_ID- Get one at WalletConnect Cloud
Update the contract address in src/lib/contract.ts:
export const STYLEHUB_ADDRESS = "0xYOUR_CONTRACT_ADDRESS" as `0x${string}`npm run devOpen http://localhost:3000 in your browser.
/- Home page with product listings/product/[id]- Product detail and purchase page/orders- View and manage your orders/seller- Seller dashboard (authorized sellers only)/admin- Admin panel (contract owner only)
The frontend integrates with the StyleHub contract through custom hooks in src/hooks/useContract.ts:
useProductCount()- Get total productsuseProduct(id)- Get product detailsuseOrderCount()- Get total ordersuseOrder(id)- Get order detailsuseCustomerOrders(address)- Get customer's ordersuseIsAuthorizedSeller(address)- Check seller authorizationuseContractOwner()- Get contract ownerusePlatformFee()- Get platform fee percentageuseContractBalance()- Get contract ETH balance
useListProduct()- List a new productuseModifyProduct()- Update product detailsuseCreateOrder()- Place an orderuseCancelOrder()- Cancel an orderuseUpdateOrderStatus()- Update order status (owner)useAuthorizeSeller()- Authorize a seller (owner)useRevokeSeller()- Revoke seller (owner)useSetPlatformFee()- Set platform fee (owner)useWithdrawFunds()- Withdraw contract balance (owner)
npm run buildnpx vercelMIT