Skip to content

DeepakJain06/FoodExpiryTracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯« Food Expiry Tracker

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.


πŸ“Œ Features

  • βœ… 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

πŸš€ Live Demo

(Coming Soon after Deployment)


🧠 Tech Stack

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

πŸ› οΈ Local Development Setup

βš™οΈ 1. Fork & Clone the Repository

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.


---

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors