A intelligent platform connecting food surplus from canteens with users in need, reducing food waste while supporting communities.
FoodWise is a smart food redistribution platform that enables canteens and food establishments to share surplus food with users in need. By connecting food donors with recipients in real-time, we reduce food waste and combat food insecurity.
- π Reduce food waste from canteens and establishments
- π€ Connect surplus food with people in need
- π Track food redistribution metrics
- β° Prevent food spoilage with pickup time management
- β Post surplus food listings with details (name, quantity, location)
- β Set pickup times for fresh food distribution
- β Track claimed food items
- β Monitor redistribution statistics
- π Secure authentication with email/password
- β Browse available food listings in real-time
- β Claim food items for pickup
- β View food details (quantity, location, pickup time)
- π Secure authentication with email/password
- β Password recovery options
- π Real-time stats dashboard
- π Automatic expiration handling
- π± Responsive web interface
- π Firebase authentication & Firestore database
| Layer | Technology |
|---|---|
| Frontend | HTML5, CSS3, JavaScript (Vanilla) |
| Backend | Node.js + Express.js |
| Database | Firebase Firestore |
| Authentication | Firebase Auth |
| Nodemailer | |
| Styling | Tailwind CSS |
smart-food-redistribution-FoodWise/
βββ public/ # Static frontend files
β βββ index.html # Main entry point
β βββ canteen/ # Canteen UI
β β βββ canteen-login.html # Canteen login page
β β βββ canteen-login.css # Canteen login styles
β β βββ canteen-dashboard.html # Canteen dashboard
β β βββ reset-pass-canteen.html # Password reset
β βββ user/ # User UI
β βββ user-login.html # User login page
β βββ user-login.css # User login styles
β βββ user-dashboard.html # User dashboard
β βββ reset-pass-user.html # Password reset
β
βββ src/ # Source code
β βββ app/ # Application logic
β β βββ canteen-app.js # Canteen JavaScript
β β βββ user-app.js # User JavaScript
β β βββ canteen-login.js # Canteen login handler
β β βββ user-login.js # User login handler
β βββ config/ # Configuration
β βββ firebaseconfig.js # Firebase setup
β βββ serviceAccountKey.json # Firebase service account
β
βββ server/ # Backend server
β βββ server.js # Express server & API
β
βββ package.json # Dependencies
βββ .env # Environment variables
βββ README.md # This file
- Node.js v16+ and npm/yarn
- Git for version control
- Firebase Account with Firestore & Authentication enabled
- Firebase Service Account Key (for admin operations)
- Modern web browser (Chrome, Firefox, Safari, Edge)
git clone <repository-url>
cd smart-food-redistribution-FoodWisenpm install- Go to Firebase Console
- Create a new project or use existing one
- Enable Firestore Database and Authentication (Email/Password)
- Download your Firebase Admin SDK private key (JSON)
- Save it as
src/config/serviceAccountKey.json
Create a .env file in the root directory:
# Firebase Configuration
SERVICE_ACCOUNT_JSON={"type":"service_account",...}
# OR use with the JSON file directly
GOOGLE_APPLICATION_CREDENTIALS=./src/config/serviceAccountKey.json
# Server Configuration
PORT=3000
NODE_ENV=development
# Email Configuration (Optional - for password reset)
EMAIL_USER=your-email@gmail.com
EMAIL_PASSWORD=your-app-passwordnpm run dev- Backend runs on
http://localhost:3000 - Frontend can be served via Live Server or Python
npm start# Using Python 3
cd public
python3 -m http.server 8000
# Using Python 2
python -m SimpleHTTPServer 8000
# Visit http://localhost:8000http://localhost:3000/api
GET /api/healthResponse:
{ "status": "ok" }POST /api/food
Content-Type: application/json
{
"foodName": "Leftover Pizza",
"quantity": "5 slices",
"location": "Main Canteen, Building A",
"pickupTime": "2026-05-16T18:00:00Z",
"postedBy": "canteen-user@example.com"
}GET /api/foodResponse:
[
{
"id": "food123",
"foodName": "Leftover Pizza",
"quantity": "5 slices",
"location": "Main Canteen",
"pickupTime": "2026-05-16T18:00:00Z",
"status": "available",
"postedBy": "canteen@example.com",
"createdAt": "2026-05-16T12:00:00Z"
}
]POST /api/food/:id/claim
Content-Type: application/json
{
"claimedBy": "user@example.com"
}GET /api/statsResponse:
{
"totalListings": 42,
"availableListings": 15,
"claimedListings": 20,
"expiredListings": 7,
"totalQuantity": "150 items"
}POST /api/expireAutomatically marks expired listings based on pickupTime.
{
"id": "food_12345",
"foodName": "string",
"quantity": "string",
"location": "string",
"pickupTime": "timestamp",
"status": "available | claimed | expired",
"postedBy": "string (email)",
"createdAt": "timestamp",
"claimedBy": "string | null (email)",
"claimedAt": "timestamp | null",
"expiresAt": "timestamp"
}{
"uid": "firebase-uid",
"email": "string",
"displayName": "string",
"role": "canteen | user",
"createdAt": "timestamp",
"lastLogin": "timestamp"
}| Variable | Description | Required |
|---|---|---|
SERVICE_ACCOUNT_JSON |
Firebase service account JSON | β |
GOOGLE_APPLICATION_CREDENTIALS |
Path to service account file | β (if not using above) |
PORT |
Server port | β (default: 3000) |
NODE_ENV |
Environment type | β (default: development) |
EMAIL_USER |
Email for password reset | β |
EMAIL_PASSWORD |
Email app password | β |
We welcome contributions! Here's how:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
- Use consistent naming conventions
- Add comments for complex logic
- Test before submitting PR
- Update documentation
This project is licensed under the MIT License - see LICENSE file for details.