Live Demo: https://thesybilmarket.vercel.app/
A decentralized e-commerce application (dApp) built on the Polygon network. The project merges physical merchandise with digital ownership via NFTs (ERC-1155). It features a secure architecture separating client-side Web3 interactions from server-side sensitive data handling.
This project implements a Backend-for-Frontend (BFF) pattern using Next.js API Routes to ensure security and prevent "Environment Contamination".
- Framework: React / Next.js (Pages Router).
- Web3 Interaction: Uses
@thirdweb-dev/reactfor wallet connection, chain switching, and smart contract interaction (Minting/Burning). - Security: No private keys or service account credentials are exposed to the client bundle. The UI interacts only with the blockchain (public) and internal API endpoints.
- API Routes: Located in
pages/api/. These function as serverless lambda functions deployed on Vercel. - Data Persistence: Google Sheets API is used as a lightweight, real-time database to track orders and referrals.
- Authentication: Server-to-Server authentication using Google Service Account (JWT).
- Isolation: The
google-auth-libraryandgoogle-spreadsheetpackages are restricted to the server runtime, preventing Webpack build errors (node:events,fsmodules) and credential leaks.
- Frontend: Next.js 13, TypeScript, Tailwind CSS
- Blockchain: Polygon Mainnet, Thirdweb SDK, Ethers.js v5
- Database / Storage: Google Sheets API v4
- Deployment: Vercel (Node.js 20.x Runtime)
- Node.js v18+ (Recommended v20 LTS)
- npm or yarn
git clone [https://github.com/rxxddy/web3-trading-card-app.git](https://github.com/rxxddy/web3-trading-card-app.git)
cd web3-trading-card-app
Note: Using --legacy-peer-deps is required due to specific Web3 package versions.
npm install --legacy-peer-deps
Create a .env.local file in the root directory. Never commit this file.
# Google Sheets Configuration (Server-Side Only)
GOOGLE_SHEETS_EMAIL=[email protected]
GOOGLE_SHEETS_KEY="-----BEGIN PRIVATE KEY-----\n..."
# Public Config
NEXT_PUBLIC_TEMPLATE_CLIENT_ID=your_thirdweb_client_id
npm run dev
The app will be available at http://localhost:3000.
As of 2024/2025, Vercel has discontinued support for Node.js 18.x. This project is configured to run on Node.js 20.x (LTS).
Configuration steps:
- Ensure
package.jsonincludes the engines field:
"engines": { "node": ">=20.0.0" }
- In Vercel Dashboard:
Settings->General->Node.js Version-> Set to 20.x. - Build Command:
next build - Install Command:
npm install --legacy-peer-deps
To prevent build failures during deployment due to strict type checking in legacy libraries, the next.config.js is configured to ignore build errors:
typescript: {
ignoreBuildErrors: true,
},