Food Rescue Hub is a full-stack web application built to combat food waste by connecting surplus food providers (restaurants, groceries, farms) with charities and individuals. The platform provides real-time updates, secure role-based access, geolocation search, and impact analytics, making food redistribution efficient and scalable.
Watch the demo video to see how the Food Rescue Hub works!
- JWT authentication with Donor, Recipient, and Admin roles
- Role-based access control (e.g., donors canβt browse donations)
- CRUD operations for donations (type, quantity, location, image)
- Real-time updates via Socket.IO (instant UI sync)
- Grid View (pagination) + Map View (Google Maps integration)
- Search and filters
- Instant notifications for claims and confirmations via Socket.IO (web) + FCM (mobile)
Track platform performance with charts and stats:
- Total donations & claimed rate
- Food waste reduction
- Active users
- Donation trends by time, type, and location
- Top donors & status breakdown
- Average claim time & user growth insights
- Users can edit their personal data
- View personal impact statistics (e.g., total donations, COβ saved)
- Auto-Expiry: Cron jobs purge expired donations
1οΈβ£ Donors Post Surplus Food
- Enter details (type, quantity, location) + upload images via Cloudinary
- Data stored in MongoDB via Next.js API Routes
2οΈβ£ Recipients Browse & Claim
- Explore donations via Grid or Map View with advanced filters
- Submit a claim β triggers real-time notification to donor via Socket.IO
3οΈβ£ Donor Confirmation
- Donor approves or rejects the claim
- Status is updated in MongoDB and the UI reflects the change instantly
4οΈβ£ Recipient Completion
- Recipient completes the donation β status updated in MongoDB
- All completed donations contribute to the donor's impact stats
- Next.js (Server-Side Rendering)
- Tailwind CSS + Shadcn UI
- TypeScript
- Formik + Yup
- Next.js API Routes (REST logic)
- Node.js + Socket.IO (real-time server)
- Yup
- MongoDB + Mongoose
- JWT Auth + Role-Based Access Control (RBAC)
- Google Maps API (geocoding/maps)
- Cloudinary (image uploads)
- Firebase Cloud Messaging (push notifications)
- Netlify (CI/CD deployment)
- Cron Jobs (auto-deletion of expired donations)
- Post food with quantity, type, location, and image.
- Get notified of claims and confirm/decline them.
- Browse donations in grid/map view.
- Filter by distance, type, expiry.
- Claim available items
- Monitor platform activity
- View analytics and system stats.
- π§± Repository Pattern (modular code structure)
- π¦ Layered Logic (clear frontend/backend separation)
- β Type Safety with TypeScript
- β‘ Real-Time Sync using Socket.IO + MongoDB Change Streams
- π Agile Management using Jira workflows
-
Clone the repository:
git clone https://github.com/GSG-NEXT-JS-PROJECT/Food-Rescue-Hub.git cd Food-Rescue-Hub
-
Install Dependencies
npm install
-
Configure Environment Variables
Create a .env.local file in the root directory and add the following:
# =============== Database Configuration =============== DB_PASSWORD=your_mongodb_password DB_URL=your_mongodb_url # ================== Authentication =================== SESSION_SECRET=your_session_secret_key # ================== Cloudinary Setup ================== CLOUDINARY_URL=cloudinary://API_KEY:API_SECRET@CLOUD_NAME NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=your_cloud_name NEXT_PUBLIC_CLOUDINARY_API_KEY=your_cloudinary_api_key CLOUDINARY_API_SECRET=your_cloudinary_api_secret # ================== Firebase Configuration ============ NEXT_PUBLIC_GOOGLE_API_KEY=your_google_maps_api_key NEXT_PUBLIC_FIREBASE_FCM_VAPID_KEY=your_firebase_vapid_key NEXT_PUBLIC_FIREBASE_API_KEY=your_firebase_api_key FIREBASE_PROJECT_ID=your_firebase_project_id FIREBASE_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n FIREBASE_CLIENT_EMAIL=your_firebase_service_account_email # ================== Email Configuration =============== SMTP_HOST=smtp.gmail.com SMTP_PORT=587 SMTP_USER=your_email@domain.com SMTP_PASS=your_email_app_password # ================== Real-Time Communication =========== NEXT_PUBLIC_SOCKET_IO_URL=http://localhost:4000
-
Start the Development Server
npm run dev
-
Set Up Real-Time Socket Server
cd socket-server npm install npm start
We welcome contributions! To get started:
- Fork the repository and clone it locally.
- Follow the Getting Started steps.
- Check out open issues or submit a new one.
- Submit pull requests with clear descriptions and adhere to our coding standards.
This project is licensed under the MIT License - see the LICENSE file for details.