A comprehensive blockchain-powered platform that brings transparency, accountability, and gamification to sustainability efforts. Companies log eco-friendly actions, earn tokenized carbon credits (ERC-20), unlock NFT badges (ERC-721), and participate in a vibrant ecosystem with marketplace, staking, and governance features.
0.8.28 - Smart contract language^3.0.6 - Ethereum development environmentv6.15.0 - Ethereum library for blockchain interaction18+ - JavaScript runtime5.8.0 - Type-safe JavaScript4.21.2 - Web framework6.1.0 - Type-safe database clientjsonwebtoken 9.0.2 - Authentication tokens6.0.0 - Password hashing8.0.0 - Security headers2.8.5 - Cross-origin resource sharing3.17.0 - Application logging19.2.0 - UI library5.9.3 - Type-safe development7.2.4 - Fast build tool & dev server7.9.6 - Client-side routing4.1.17 - Utility-first CSS framework0.554.0 - Modern icon library3.4.1 - Chart and data visualization11.18.2 - Animation library6.15.0 - Web3 integration4.19.2 - TypeScript execution for Node.js9.39.1 - Code linting2.1.8 - Fast unit testinggit clone <repository-url>
cd EcoCred
cd blockchain
npm install
# Start local Hardhat node
npm run node
# In another terminal, deploy contracts
npm run deploy
# Get deployed contract addresses
npm run get-addresses
cd ../backend
npm install
# Database is already configured with Neon PostgreSQL
# Initialize database
npm run db:generate
npm run db:push
# Start backend server
npm run dev
Backend will run on http://localhost:3001
cd ../frontend-react
npm install
# Contract addresses are auto-detected!
# No manual configuration needed
# Start development server
npm run dev
Frontend will run on http://localhost:5173
Use our automated setup script:
# Install all dependencies
bash scripts/setup.sh
# Start all services (follow the printed instructions)
bash scripts/start-dev.sh
The platform features distinct interfaces for different user roles:
See ROLE_BASED_UI.md for detailed documentation.
Backend (backend/.env)
DATABASE_URL=postgresql://...
JWT_SECRET=your-secret-key
BLOCKCHAIN_RPC_URL=http://localhost:8545
# Contract addresses are auto-detected - no need to set them manually!
Frontend - No .env files needed!
DEPLOYMENT_AUTO.md for detailsGET /api/auth/nonce/:walletAddress - Get signing noncePOST /api/auth/verify - Verify signature & get JWTGET /api/companies - List companiesPOST /api/companies - Register companyPUT /api/companies/:id - Update profileGET /api/companies/:id/actions - Action historyGET /api/actions - List all actionsPOST /api/actions - Submit actionPOST /api/actions/:id/verify - Verify actionGET /api/analytics/overview - Platform statsGET /api/analytics/trends - Historical dataGET /api/marketplace/listings - Browse listingsPOST /api/marketplace/listings - Create listingGET /api/staking/stakes/my - User's stakesPOST /api/staking/stakes - Create stakeGET /api/governance/votes - All votesPOST /api/governance/votes - Cast voteFull API documentation: See backend/README.md
Run all tests across the platform:
bash scripts/test-all.sh
This runs:
Smart Contracts:
cd blockchain
npm test # All tests
npm run test:coverage # With coverage
npm run test:token # Token tests only
npm run test:ledger # Ledger tests only
npm run test:integration # Integration tests
Backend:
cd backend
npm run test
npm run test:coverage
Frontend:
cd frontend-react
npm run build # Production build test
npm run lint # Code quality check
1. Deploy Smart Contracts
cd blockchain
npm run deploy:sepolia:v3 # Deploys all contracts
npm run export:addresses # Auto-exports addresses
2. Initialize Platform
# Grant verifier roles and set parameters
ACCESS_CONTROL_ADDRESS=0x... ECO_LEDGER_ADDRESS=0x... \
npx hardhat run scripts/initialize-platform.ts --network sepolia
3. Deploy Backend (Vercel example)
cd backend
vercel --prod
# Set environment variables in Vercel dashboard
4. Deploy Frontend (Vercel example)
cd frontend-react
vercel --prod
# Contract addresses auto-detected!
For complete production deployment instructions, see:
DEPLOYMENT_GUIDE.md - Step-by-step deployment guideSECURITY.md - Security checklist and best practicesโ ๏ธ Before mainnet deployment:
The PostgreSQL database includes:
See backend/src/database/schema.prisma for full schema.
New helper scripts for development and deployment:
# Automated setup - installs all dependencies
bash scripts/setup.sh
# Development environment guide
bash scripts/start-dev.sh
# Comprehensive test suite
bash scripts/test-all.sh
# Platform initialization (after deployment)
ACCESS_CONTROL_ADDRESS=0x... ECO_LEDGER_ADDRESS=0x... \
npx hardhat run blockchain/scripts/initialize-platform.ts
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License.
scripts/setup.sh for automated installationfrontend-react/README.md for React app documentationbackend/README.md for API documentation PROJECT_DOCUMENTATION.md and SMART_CONTRACTS_DOCUMENTATION.mdDEPLOYMENT_GUIDE.md for production deploymentSECURITY.md for security features and best practicesCONTRIBUTING.md for contribution guidelinesROLE_BASED_UI.md for dashboard documentationBuilt with โค๏ธ for a sustainable future.
Version: 2.1.0
Last Updated: December 2024