A smart full-stack web application that allows users to track food expiry dates, receive automated email alerts before expiration (30, 15, and 5 days), and manage their inventory efficiently.
- β Register/Login with JWT Authentication
- π Add, edit, and delete food items with expiry dates
- β° Email notifications 30, 15, and 5 days before food expiry
- π Dashboard with filtering: All / Expiring Soon / Expired
- βοΈ Notification preference toggle
- π Protected routes and role-based access (Admin/Staff Ready)
- π± Fully responsive design
(Coming Soon after Deployment)
| Layer | Technology |
|---|---|
| Frontend | React + Vite + Tailwind CSS + Bootstrap |
| Backend | Node.js + Express.js |
| Database | MongoDB + Mongoose |
| Auth | JWT (JSON Web Tokens) |
| Scheduler | node-cron + Nodemailer |
git clone https://github.com/your-username/your-repo-name.git
cd your-repo-name
π§© 2. Backend Setup (/backend)
bash
Copy code
##cd backend
npm install
π Create a .env file inside /backend folder:
env
Copy code
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password
Note: Use Google App Passwords for Gmail SMTP if 2FA is enabled.
βΆοΈ Start Backend Server
bash
Copy code
npm start
The server runs on: http://localhost:5000
π¨ 3. Frontend Setup (/frontend)
bash
Copy code
cd frontend
npm install
βΆοΈ Start Frontend Server
bash
Copy code
npm run dev
Frontend runs on: http://localhost:5173
βοΈ Email Notification System
Automatically runs every day at 9:00 AM
Sends email alerts to users for food items expiring in:
π
30 days
π
15 days
π
5 days
Scheduler uses node-cron and nodemailer
β
Users can enable/disable notification from the dashboard.
π Project Structure Overview
pgsql
Copy code
π root/
β
βββ backend/
β βββ models/
β βββ routes/
β βββ controllers/
β βββ middleware/
β βββ emailScheduler.js
β βββ server.js
β βββ .env
β
βββ frontend/
β βββ public/
β βββ src/
β βββ index.html
β βββ vite.config.js
β
βββ README.md
βββ package.json
π Troubleshooting
500 Server Error?
Check your .env variables and ensure MongoDB URI & email credentials are correct.
Email not sending?
Ensure less secure apps are enabled or use app password for Gmail SMTP.
CORS issues?
Confirm your backend has proper CORS configuration.
π¦ Build for Production
To create production builds:
Backend (Optional for deployment):
bash
Copy code
npm run build # if using TS or Babel
Frontend:
bash
Copy code
npm run build
π§βπ» Author
Deepak Jain
GitHub: @deepakjain06
π€ Contributing
Contributions are welcome! Feel free to fork this repo, make changes, and submit a pull request.
π License
This project is licensed under the MIT License.
---