Run both frontend and backend with a single command:
npm install
npm startThis will start:
- Backend Server on
http://localhost:3001 - Frontend App on
http://localhost:8080
├── src/ # Frontend React app
│ ├── pages/ # Home, Staking, Exchange pages
│ │ ├── Index.tsx # Main store page
│ │ ├── Staking.tsx # Staking interface
│ │ ├── Exchange.tsx # Token swap interface
│ │ └── Auth.tsx # Authentication page
│ ├── components/ # Reusable UI components
│ │ ├── Header.tsx # Navigation header
│ │ ├── Footer.tsx # Footer component
│ │ └── ui/ # shadcn/ui components
│ ├── layout/ # Layout wrappers
│ │ └── MainLayout.tsx # Main page layout
│ ├── abi/ # Smart contract ABIs
│ │ ├── StakingContract.json
│ │ └── NFTContract.json
│ ├── hooks/ # Custom React hooks
│ │ ├── useWallet.ts # Wallet connection
│ │ ├── useAuth.ts # Authentication
│ │ └── useCart.ts # Shopping cart
│ ├── token/ # Token configurations
│ │ └── tokenList.ts # Supported tokens
│ └── services/ # API services
│ └── api.ts # Backend API client
│
├── server/ # Backend Express server
│ ├── modules/ # Feature modules
│ │ ├── user/ # User management
│ │ ├── nft/ # NFT operations
│ │ ├── auction/ # Auction system
│ │ └── auth/ # Authentication
│ ├── routes/ # API routes
│ │ └── api/ # API endpoints
│ ├── helper/ # Utility functions
│ │ ├── validation.js # Input validation
│ │ └── authMiddleware.js # JWT auth
│ └── server.js # Server entry point
│
└── public/ # Static assets
├── favicon.ico
└── robots.txt
npm start- Run both frontend and backend concurrentlynpm run dev- Run frontend only (development mode)npm run server- Run backend onlynpm run build- Build for productionnpm run lint- Run ESLint
- ✅ Wallet connection (MetaMask)
- ✅ User authentication with wallet signature
- ✅ Staking interface
- ✅ Token exchange/swap
- ✅ Shopping cart
- ✅ Responsive design with Tailwind CSS
- ✅ Modern UI with shadcn/ui components
- ✅ RESTful API with Express
- ✅ JWT authentication
- ✅ Wallet signature verification
- ✅ User management
- ✅ NFT operations
- ✅ Auction system
- ✅ CORS enabled
POST /api/auth/register- Register new userPOST /api/auth/login- Login userPOST /api/auth/verify-wallet- Verify wallet signature
GET /api/users/:id- Get user by IDGET /api/users/profile/:address- Get user by wallet addressPUT /api/users/:id- Update user
GET /api/nfts- Get all NFTsGET /api/nfts/:id- Get NFT by IDPOST /api/nfts- Create NFT (auth required)PUT /api/nfts/:id- Update NFT (auth required)
GET /api/auctions- Get all auctionsGET /api/auctions/:id- Get auction by IDPOST /api/auctions- Create auction (auth required)POST /api/auctions/:id/bid- Place bid (auth required)
Copy .env.example to .env and configure:
# Backend
PORT=3001
JWT_SECRET=your-secret-key
# Frontend
VITE_API_URL=http://localhost:3001/api
VITE_CHAIN_ID=1
VITE_STAKING_CONTRACT_ADDRESS=0x...
VITE_NFT_CONTRACT_ADDRESS=0x...- React 18
- TypeScript
- Vite
- Tailwind CSS
- shadcn/ui
- Ethers.js v6
- React Router
- TanStack Query
- Node.js
- Express
- JWT
- Ethers.js
- CORS
- Clone the repository
- Install dependencies:
npm install
- Configure environment variables
- Start the application:
npm start
npm run buildDeploy the dist folder to your hosting service.
Deploy the server folder to your Node.js hosting service.
- Change
JWT_SECRETin production - Use environment variables for sensitive data
- Implement rate limiting for production
- Add database instead of in-memory storage
- Enable HTTPS in production
- Connect to a real database (MongoDB, PostgreSQL)
- Deploy smart contracts
- Add more token pairs for exchange
- Implement real-time updates with WebSockets
- Add transaction history
- Implement admin panel
