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