A decentralized digital marketplace for Construction & Demolition (C&D) waste management with Green Credit incentives.
Waste-Trace connects Civil Site Owners (Generators) with Recycling Plant Owners (Recyclers) to promote responsible C&D waste disposal, track recyclable materials, and reward sustainable practices through a Green Credit system.
- Features
- Tech Stack
- Project Structure
- Prerequisites
- Installation & Setup
- Running the Project
- Environment Variables
- API Reference
- Demo Accounts
- Green Credit Formula
| Feature | Description |
|---|---|
| Dual-Role Auth | Register/login as Generator or Recycler with JWT authentication |
| Green Credit Engine | Automatic credit calculation using GC = Q Γ P Γ R Γ L |
| Waste Tracking | 6-step status timeline (Pending β QC Completed) |
| QR Waste Passport | Unique QR code generated for every waste load |
| Quality Check (QC) | Live credit calculation with Purity / Recovery / Location breakdown |
| Green Wallet | View balance, transfer credits to others, sell for βΉ |
| Marketplace | Redeem credits for recycled materials |
| PDF Certificate | Downloadable recycling certificate per load |
| Leaderboard | Top builders ranked with podium + table |
| Analytics Dashboards | Area charts, bar charts, and pie charts (Recharts) |
| Segregation Badges | Grade A / B / C badges based on average purity score |
| Technology | Version | Purpose |
|---|---|---|
| React | 18.3 | UI library |
| Vite | 5.4 | Build tool & dev server |
| TailwindCSS | 3.4 | Utility-first CSS |
| React Router DOM | 6.27 | Client-side routing |
| Recharts | 2.13 | Charts & data visualization |
| React Icons | 5.3 | Icon library |
| Axios | 1.7 | HTTP client |
| Technology | Version | Purpose |
|---|---|---|
| Node.js | 18+ | Runtime |
| Express | 4.21 | Web framework |
| MongoDB | 6+ | Database |
| Mongoose | 8.7 | MongoDB ODM |
| JSON Web Token | 9.0 | Authentication |
| bcryptjs | 2.4 | Password hashing |
| PDFKit | 0.15 | PDF certificate generation |
| qrcode | 1.5 | QR waste passport generation |
| multer | 1.4 | File uploads |
Waste-Trace/
βββ client/ # Frontend (Vite + React)
β βββ src/
β β βββ components/
β β β βββ DashboardLayout.jsx # Responsive sidebar layout
β β βββ context/
β β β βββ AuthContext.jsx # JWT auth state management
β β βββ pages/
β β β βββ LandingPage.jsx # Public landing page
β β β βββ Login.jsx # Login form
β β β βββ Register.jsx # Registration with role selection
β β β βββ Leaderboard.jsx # Global leaderboard
β β β βββ generator/ # Generator-only pages
β β β β βββ GeneratorHome.jsx # Dashboard with stats & charts
β β β β βββ RequestPickup.jsx # Submit waste pickup requests
β β β β βββ Tracking.jsx # Track waste load status + QR
β β β β βββ Wallet.jsx # Green Wallet (balance/transfer/sell)
β β β β βββ Marketplace.jsx # Redeem credits for products
β β β βββ recycler/ # Recycler-only pages
β β β βββ PlantDashboard.jsx# Plant analytics & stats
β β β βββ IncomingLoads.jsx # Manage incoming waste loads
β β β βββ QualityCheck.jsx # QC inspection + credit calc
β β β βββ PlantSettings.jsx # Add/edit plant details
β β βββ utils/
β β β βββ api.js # Axios instance with JWT interceptor
β β βββ App.jsx # Root component with routing
β β βββ main.jsx # Entry point
β β βββ index.css # Tailwind + custom design system
β βββ index.html
β βββ tailwind.config.js
β βββ postcss.config.js
β βββ vite.config.js
β βββ package.json
β
βββ server/ # Backend (Express + MongoDB)
β βββ middleware/
β β βββ auth.js # JWT verification + role guards
β βββ models/
β β βββ User.js # Generator / Recycler user model
β β βββ Plant.js # Recycling plant model
β β βββ WasteRequest.js # Waste pickup request model
β β βββ WalletTransaction.js # Credit transaction ledger
β β βββ MarketplaceItem.js # Marketplace product model
β βββ routes/
β β βββ authRoutes.js # POST /register, /login, GET /profile
β β βββ wasteRoutes.js # CRUD + status updates + QR
β β βββ plantRoutes.js # CRUD + geolocation
β β βββ walletRoutes.js # Balance, transfer, sell, history
β β βββ marketplaceRoutes.js # List items, redeem with credits
β β βββ leaderboardRoutes.js # Top generators by credits
β β βββ certificateRoutes.js # PDF certificate download
β βββ utils/
β β βββ greenCredit.js # GC = Q Γ P Γ R Γ L calculation
β βββ server.js # Express app + MongoDB connection
β βββ seed.js # Demo data seeder
β βββ .env # Environment variables
β βββ package.json
β
βββ README.md # β You are here
Make sure the following are installed on your machine:
| Software | Minimum Version | Download Link |
|---|---|---|
| Node.js | v18.0+ | https://nodejs.org/ |
| npm | v9.0+ | (comes with Node.js) |
| MongoDB | v6.0+ | https://www.mongodb.com/try/download |
Tip: You can also use MongoDB Atlas (free tier) instead of installing MongoDB locally. Just update the
MONGO_URIin the.envfile.
To verify your installations, run:
node -v # Should print v18.x.x or higher
npm -v # Should print 9.x.x or higher
mongod --version # Should print v6.x or higher (if installed locally)git clone <your-repository-url>
cd Waste-Tracecd server
npm installcd ../client
npm installThe server .env file is located at server/.env. The default values are:
PORT=5000
MONGO_URI=mongodb://localhost:27017/waste-trace
JWT_SECRET=waste-trace-super-secret-key-2024
β οΈ Important: For production, changeJWT_SECRETto a strong random string and use a secure MongoDB connection URI.
| Variable | Description | Default |
|---|---|---|
PORT |
Port for the Express server | 5000 |
MONGO_URI |
MongoDB connection string | mongodb://localhost:27017/waste-trace |
JWT_SECRET |
Secret key for signing JWT tokens | waste-trace-super-secret-key-2024 |
cd server
npm run seedThis script populates the database with:
- 2 demo user accounts (1 Generator + 1 Recycler)
- Sample recycling plants
- Waste pickup requests in various statuses
- Wallet transactions & marketplace items
You need two terminals β one for the backend and one for the frontend.
cd server
npm run devYou should see:
β
MongoDB connected
π Waste-Trace server running on port 5000
cd client
npm run devYou should see:
VITE v5.x.x ready in xxx ms
β Local: http://localhost:3000/
Navigate to http://localhost:3000 to view the application.
Note: The Vite dev server automatically proxies all
/api/*requests to the Express backend on port 5000, so both servers work together seamlessly.
All API endpoints are prefixed with /api. Authentication is via Bearer <token> in the Authorization header.
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /register |
Register a new user | No |
| POST | /login |
Login & receive JWT | No |
| GET | /profile |
Get current user profile | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | / |
Create a waste pickup request | Generator |
| GET | / |
List requests (filtered by role) | Yes |
| GET | /:id |
Get single request details | Yes |
| PUT | /:id/status |
Update request status | Recycler |
| GET | /:id/qr |
Generate QR waste passport | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | / |
Register a new plant | Recycler |
| GET | / |
List recycler's plants | Recycler |
| PUT | /:id |
Update plant details | Recycler |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /balance |
Get current credit balance | Yes |
| GET | /history |
Get transaction history | Yes |
| POST | /transfer |
Transfer credits to a user | Yes |
| POST | /sell |
Sell credits for βΉ | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | / |
List available marketplace items | Yes |
| POST | /:id/redeem |
Redeem credits for an item | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | / |
Get top builders by credits | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /:id |
Download recycling certificate (PDF) | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /api/health |
Server health ping | No |
After running npm run seed, you can log in with these accounts:
| Role | Password | |
|---|---|---|
| Generator | priyanshi@wastetrace.com |
password123 |
| Recycler | greenbuild@wastetrace.com |
password123 |
The platform uses a multi-factor formula to calculate Green Credits for each waste load:
GC = Q Γ P Γ R Γ L
| Factor | Name | Description |
|---|---|---|
| Q | Quantity Multiplier | Based on weight (tonnes) of the waste load |
| P | Purity Factor | Segregation quality of the waste (0.0 β 1.0) |
| R | Recovery Factor | Material-specific recyclability rate |
| L | Location Factor | Proximity bonus between site and recycling plant |
The calculation engine is implemented in server/utils/greenCredit.js and executed during the Quality Check (QC) step by Recyclers.
To create an optimized production build of the frontend:
cd client
npm run buildThe output will be in the client/dist/ folder, ready to be served by any static file host or the Express backend.
To start the backend in production:
cd server
npm startThis project is developed as part of a sustainability initiative. All rights reserved.