This guide will help you set up and run the CodedForum Web3 Learn-to-Earn community platform.
- Node.js (v16 or higher)
- npm or yarn
- MetaMask browser extension
- Git
git clone https://github.com/codedforum/CodedForum-community.git
cd CodedForum-communitynpm installcd client
npm install
cd ..cd contracts
npm install
cd ..Or install all at once:
npm run install-allCreate a .env file in the root directory:
cp .env.example .envEdit .env with your configuration:
PORT=5000
MONGODB_URI=mongodb://localhost:27017/codedforum
IPFS_HOST=ipfs.infura.io
IPFS_PORT=5001
IPFS_PROTOCOL=https
JWT_SECRET=your_jwt_secret_here
CONTRACT_ADDRESS=your_contract_address_here
NETWORK_RPC_URL=https://ethereum-sepolia.publicnode.comnpm run dev-allTerminal 1 - Backend:
npm run devTerminal 2 - Frontend:
npm run clientThe application will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
cd contracts
npm run compileFirst, add your private key to .env:
PRIVATE_KEY=your_private_key_hereThen deploy:
npm run deploy:sepoliaSave the deployed contract address and update .env:
CONTRACT_ADDRESS=deployed_contract_addressnpm run deploy-
Web3 Wallet Integration
- MetaMask connection
- User authentication via wallet
- Wallet address display
-
Forum Functionality
- Create posts with categories
- Comment on posts
- Upvote/downvote system
- Real-time discussion threads
-
Learn-to-Earn System
- Earn reputation for posts (5 points)
- Earn tokens for comments (1 token + 2 reputation)
- Earn tokens for upvotes (0.5 tokens + 1 reputation)
- Leaderboard tracking
-
Smart Contracts
- ERC20 token (CodedForum Token - CFT)
- Reward distribution mechanism
- On-chain reputation tracking
-
IPFS Integration
- Decentralized content storage
- Permanent post archival
-
User Profiles
- View reputation and tokens earned
- Track activity
- Claim rewards
CodedForum-community/
├── client/ # React frontend
│ ├── public/
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── utils/ # Utility functions
│ │ ├── App.js
│ │ └── index.js
│ └── package.json
├── server/ # Express backend
│ ├── index.js # Main server file
│ └── utils/ # Server utilities
├── contracts/ # Smart contracts
│ ├── CodedForumToken.sol
│ ├── hardhat.config.js
│ └── scripts/
│ └── deploy.js
├── package.json
├── .env.example
└── README.md
POST /api/users/register- Register new userGET /api/users/:walletAddress- Get user profile
GET /api/posts- Get all postsPOST /api/posts- Create new postGET /api/posts/:id- Get single postPOST /api/posts/:id/comments- Add commentPOST /api/posts/:id/vote- Vote on post
GET /api/rewards/leaderboard- Get top usersPOST /api/rewards/claim- Claim rewards
GET /api/categories- Get all categories
- Ensure MetaMask is installed
- Switch to correct network (Sepolia testnet for development)
- Refresh the page and try reconnecting
- Check if backend is running on port 5000
- Verify
.envconfiguration - Check console for errors
- Verify contract is deployed
- Check
CONTRACT_ADDRESSin.env - Ensure you're on the correct network
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
For issues and questions:
- Open an issue on GitHub
- Check existing documentation
- Review the troubleshooting section
MIT License - see LICENSE file for details