A full-stack web app for citizen-driven waste management, built for Smart India Hackathon 2025 (Problem Statement 25060 — Real Life Solutions for Waste Management).
| Feature | Description |
|---|---|
| 🔐 Auth | JWT login/register with citizen & authority roles |
| 📊 Dashboard | Live waste stats, training progress, quick actions |
| 🚛 Live Tracking | Animated truck tracking + nearby facility locator |
| 🎮 Training & Quiz | 5-module training + quiz with real Minecoin rewards |
| 📸 Report Issue | Photo upload + GPS geo-tagging + status tracking |
| 🛒 Marketplace | Redeem Minecoins for eco-friendly products |
| 🏆 Leaderboard | Live podium from real DB points |
| 📱 Responsive | Full mobile support with bottom nav |
SwachhSetu/
├── backend/
│ ├── middleware/auth.js # JWT middleware
│ ├── models/
│ │ ├── User.js # User schema (bcrypt passwords)
│ │ └── Report.js # Report schema with geo + photo
│ ├── routes/
│ │ ├── auth.js # /api/auth/register, login, me
│ │ ├── reports.js # /api/reports (CRUD + photo upload)
│ │ ├── quiz.js # /api/quiz/questions + answer
│ │ ├── market.js # /api/market/products + redeem
│ │ ├── tracking.js # /api/tracking/trucks, facilities, leaderboard
│ │ └── user.js # /api/user/profile
│ ├── uploads/ # Uploaded photos stored here
│ ├── seed.js # Demo data seeder
│ ├── server.js # Express entry point
│ ├── .env.example # Copy to .env and fill in
│ └── package.json
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ │ ├── Layout.jsx # Sidebar + topbar + bottom nav
│ │ │ └── Layout.css
│ │ ├── context/
│ │ │ └── AuthContext.jsx # Global auth state
│ │ ├── hooks/
│ │ │ └── useToast.js # Toast notification hook
│ │ ├── pages/
│ │ │ ├── Login.jsx / Register.jsx
│ │ │ ├── Dashboard.jsx
│ │ │ ├── Tracking.jsx
│ │ │ ├── Training.jsx
│ │ │ ├── ReportPage.jsx
│ │ │ ├── Marketplace.jsx
│ │ │ └── Leaderboard.jsx
│ │ ├── api.js # Axios instance with auth interceptors
│ │ ├── App.jsx # React Router setup
│ │ ├── main.jsx
│ │ └── index.css # Global design tokens + utilities
│ ├── vercel.json # SPA routing for Vercel
│ ├── vite.config.js # Vite + proxy config
│ └── package.json
├── render.yaml # One-click Render deploy config
├── package.json # Root scripts (runs both together)
└── .gitignore
- Node.js v18+
- MongoDB (local install or free MongoDB Atlas cluster)
- Git
git clone https://github.com/YOUR_USERNAME/SwachhSetu.git
cd SwachhSetunpm run install:allcp backend/.env.example backend/.envOpen backend/.env and set:
PORT=5000
MONGO_URI=mongodb://localhost:27017/SwachhSetu
JWT_SECRET=pick_any_long_random_string_here
NODE_ENV=development
Using MongoDB Atlas? Replace
MONGO_URIwith your Atlas connection string.
cd backend
node seed.js
cd ..This creates demo accounts and sample reports.
npm run dev- Frontend → http://localhost:5173
- Backend API → http://localhost:5000/api
| Role | Password | |
|---|---|---|
| Citizen | citizen@demo.com | demo1234 |
| Authority | authority@demo.com | demo1234 |
# From the SwachhSetu/ root folder
git init
git add .
git commit -m "feat: SwachhSetu full-stack app"
# Create a new repo on github.com, then:
git remote add origin https://github.com/YOUR_USERNAME/SwachhSetu.git
git branch -M main
git push -u origin main- Go to render.com → New → Web Service
- Connect your GitHub repo
- Configure:
Setting Value Root Directory backendBuild Command npm installStart Command node server.js - Add Environment Variables in Render dashboard:
MONGO_URI→ your MongoDB Atlas URIJWT_SECRET→ any long random stringNODE_ENV→production
- Click Deploy — your API will be live at
https://SwachhSetu-backend.onrender.com
Free MongoDB Atlas: cloud.mongodb.com → Create cluster → Get connection string
- Go to vercel.com → New Project
- Import your GitHub repo
- Configure:
Setting Value Root Directory frontendBuild Command npm run buildOutput Directory dist - Add Environment Variable:
VITE_API_URL→https://SwachhSetu-backend.onrender.com
- Click Deploy — your app will be live at
https://SwachhSetu.vercel.app
# Temporarily set your MONGO_URI to Atlas in backend/.env, then:
node backend/seed.js| Method | Endpoint | Auth | Description |
|---|---|---|---|
| POST | /api/auth/register |
❌ | Register new user |
| POST | /api/auth/login |
❌ | Login, returns JWT |
| GET | /api/auth/me |
✅ | Get current user |
| GET | /api/reports |
✅ | Get reports (own or all for authority) |
| POST | /api/reports |
✅ | Submit report (multipart/form-data) |
| PATCH | /api/reports/:id/status |
✅ | Update report status (authority) |
| GET | /api/quiz/questions |
✅ | Get quiz questions |
| POST | /api/quiz/answer |
✅ | Submit answer, earn coins |
| GET | /api/market/products |
✅ | Get marketplace products |
| POST | /api/market/redeem |
✅ | Redeem product with Minecoins |
| GET | /api/tracking/trucks |
✅ | Get active truck data |
| GET | /api/tracking/facilities |
✅ | Get nearby facilities |
| GET | /api/tracking/leaderboard |
✅ | Get top users by points |
| GET | /api/user/profile |
✅ | Get user profile |
| PATCH | /api/user/profile |
✅ | Update user profile |
| Layer | Technology |
|---|---|
| Frontend | React 18, React Router 6, Vite |
| Styling | Plain CSS with CSS custom properties |
| Backend | Node.js, Express.js |
| Database | MongoDB with Mongoose |
| Auth | JWT + bcryptjs |
| File Upload | Multer |
| Deploy (FE) | Vercel |
| Deploy (BE) | Render |
| DB (Prod) | MongoDB Atlas |
SwachhSetu — SIH 2025, Problem Statement 25060
Theme: Clean & Green Technology | Category: Software