WasteLess: A food-waste prevention app that tracks items in shared fridges, calculates spoil dates, and sends notifications when items are about to go bad or have spoiled.
WasteLess allows multiple users to share one or more fridges. It automatically reads product expiry dates via QR-code scans, adjusts spoilage timelines once items are opened, and notifies users to reduce food waste.
The project consists of:
- Database Schema (Question 1): A normalized MySQL schema with tables for users, fridges, products, QR codes, fridge items, and notifications. Spoil dates are computed dynamically based on opening dates.
- CRUD API (Question 2): A FastAPI backend connected to the MySQL database, providing full Create, Read, Update, Delete endpoints for Users, Fridges, Fridge-Sharing, Fridge Items, and Notifications.
- MySQL server
- Python
-
Import the SQL schema:
mysql -u <username> -p < wasteless_schema.sql
-
(Optional) Load sample data:
mysql -u <username> -p wasteless < sample_data.sql
-
Navigate to the
wasteless-apidirectory:cd wasteless-api -
Create and activate a virtual environment:
python -m venv venv source venv/Scripts/activate # or venv/bin/activate on Unix
-
Configure database credentials in
app/db.py. -
Run the server:
uvicorn app.main:app --reload
-
Swagger UI available at
http://127.0.0.1:8000/docs
root/
|-- images/
|---
├── wasteless.sql # Question 1: Well-commented SQL schema and Sample data inserts
├── wasteless-api/ # Question 2: Backend
│ ├── app/
│ │ ├── db.py
│ │ ├── models.py
│ │ ├── schemas.py
│ │ ├── crud.py
│ │ └── main.py
