Engineering a scalable, real-time logistics platform to solve the $1 Trillion food waste problem.
The Staggering Reality: One-third of all food produced globally goes to waste, while millions face daily hunger.
The Root Cause (The Logistics Bottleneck): The core issue isn't a lack of food—it is a systemic logistics failure. Traditional food banks and recovery networks rely on static directories, scheduled pickups, and manual phone-tree coordination.
When a restaurant or bakery has highly perishable surplus food at 10:00 PM, traditional logistics are simply too slow. By the time a pickup can be manually scheduled for the next day, the food has spoiled and is thrown away.
Waste-No-More isn't just a static directory; it is a hyper-local, real-time logistics engine.
By treating food recovery as an on-demand routing problem (similar to ride-sharing algorithms), the platform instantly connects surplus food with the nearest available volunteers. It eliminates the communication bottleneck, allowing perfectly good food to be recovered in minutes, not days.
To solve this logistics bottleneck, I designed and engineered a full-stack system focused strictly on speed, geospatial awareness, and real-time concurrency.
- The Challenge: Finding the closest volunteers to a newly posted donation without running expensive distance calculations against every user in the database.
- The Engineering Solution: I utilized MongoDB's
2dspherespatial indexing. When a donor posts food, the backend executes a highly optimized$nearquery. This filters and returns only active volunteers within a dynamic geographic radius, reducing query time complexity from O(N) to logarithmic complexity.
- The Challenge: Preventing "double-booking" (race conditions) where two volunteers attempt to claim the exact same food donation at the same millisecond.
- The Engineering Solution: I implemented an event-driven architecture using Socket.io. When a donation is claimed, the database locks the transaction. Instantly, the WebSocket server broadcasts a state-update event to all connected clients, seamlessly removing that donation marker from everyone else's live map without requiring a page refresh.
- The Implementation: A robust JWT-based stateless authentication system that securely routes users into distinct flows:
- Donors: Fast-path inventory posting and analytics.
- Volunteers: Geospatial task discovery and routing.
- Receivers: Inventory request and management.
graph TD
Client[Next.js Client] <-->|REST API & WebSockets| API[Express API Gateway]
subgraph Backend Micro-Services
API -->|Auth & Verification| JWT[JWT Middleware]
API <-->|Spatial Queries| DB[(MongoDB Atlas)]
API <-->|Real-time Events| Socket[(Socket.IO Server)]
end
subgraph Data Layer
DB --> Users
DB --> Donations
DB --> Claims
end
- Frontend: Next.js 16 (App Router), React 19, Tailwind CSS v4, Framer Motion, React Query, Leaflet Maps. (Chosen for SEO, SSR performance, and premium UI capabilities).
- Backend: Node.js, Express 5. (Chosen for its non-blocking I/O model, efficiently handling thousands of concurrent WebSocket connections).
- Database: MongoDB & Mongoose. (Chosen specifically for its robust Geospatial indexing capabilities).
🔗 View Live Production Deployment (Replace with actual link if different)
| Donor Dashboard | Volunteer Live Map |
|---|---|
- Node.js (v18+ recommended)
- MongoDB (Local or Atlas connection string)
cd backend
npm install
cp .env.example .env # Add your MongoDB URI here
npm run devcd frontend
npm install
cp .env.local.example .env.local
npm run devTo test the RBAC and real-time features immediately:
| Role | Password | |
|---|---|---|
| Donor | donor@demo.com |
password123 |
| Volunteer | volunteer@demo.com |
password123 |
| Receiver | receiver@demo.com |
password123 |
(Ensure you run the database seed script: npm run seed in the backend directory)
Rohit Singh Passionate about designing robust, distributed systems to solve real-world problems and drive sustainable, global impact.