A full-stack web application for monitoring and optimizing waste collection using real-time data, analytics, and intelligent routing.
This project demonstrates a complete end-to-end integration between a React frontend and a Node.js backend, powered by PostgreSQL and Prisma ORM.
It provides real-time insights into bin status, alerts, and optimized routes for efficient waste management.
- 🔐 Secure Authentication (JWT-based)
- 📊 Real-time Dashboard with KPIs
- 🗑️ Bin Monitoring & Status Tracking
- 🚨 Alert System for Overfilled Bins
- 🗺️ Map-based Visualization
- ⚡ Real-time Updates using WebSockets
- 🔄 Optimized Route Estimation
- 🧩 Clean State Management using Context API
- React.js
- Context API
- Axios / Fetch
- Tailwind CSS (or your styling)
- Node.js
- Express.js
- Prisma ORM
- PostgreSQL
- WebSockets (Socket.io)
SmartBin/
│
├── binFrontend/ # React Frontend
│ ├── src/
│ │ ├── components/
│ │ ├── pages/
│ │ ├── contexts/
│ │ ├── services/
│ │ └── adapters/
│
├── backend/ # Express Backend
│ ├── routes/
│ ├── controllers/
│ ├── services/
│ └── prisma/
│
└── README.md
- User logs in via frontend
- Credentials sent to backend API
- Backend validates and returns JWT token
- Token stored in frontend (localStorage)
- All protected API calls use Bearer token
-
Frontend triggers API calls using
useEffect -
Endpoints:
/bins/analytics
-
Responses are normalized using adapters
-
Data stored in global state (Context API)
-
Passed as props to UI components
-
WebSocket connection established after login
-
Events handled:
- Bin status updates
- Sensor alerts
-
UI updates instantly without refresh
UI rendered but data was not showing (all values = 0)
Mismatch between backend response format and frontend consumption after merge conflicts
Updated service layer to extract actual data:
return response.data;Result:
- Correct state updates
- Dashboard populated successfully
git clone https://github.com/your-username/your-repo.git
cd your-repoFrontend:
cd binFrontend
npm installBackend:
cd backend
npm installCreate .env in backend:
DATABASE_URL=your_postgres_url
JWT_SECRET=your_secret
PORT=5000
Backend:
npm run devFrontend:
npm run dev- Dashboard with live data
- Network requests showing successful API calls
- Real-time updates without refresh
Arpit Singh
This project demonstrates a scalable, production-ready architecture with secure authentication, efficient data flow, and real-time capabilities.