Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Typing SVG

Node.js Express.js MongoDB React Vite TailwindCSS

License: MIT PRs Welcome Made with ❀

Overview β€’ Features β€’ Tech Stack β€’ Architecture β€’ Getting Started β€’ API Reference β€’ Contributing


Visitors GitHub last commit GitHub repo size Status


πŸ“– Overview

ExpireX is a full-stack MERN (MongoDB, Express, React, Node.js) application that helps individuals and small businesses keep track of perishable or time-sensitive inventory β€” food, medicine, cosmetics, documents, anything with a shelf life.

The app automatically flags items that are fresh, expiring soon, or expired, sends email reminders on a schedule, and gives you a clean dashboard with charts to visualize your inventory health at a glance.

πŸ’‘ Built with a clean MVC (Model–View–Controller) architecture on the backend and a modern component-based React frontend β€” designed to be easy to read, extend, and deploy.

πŸ”— Live Demo Β Β·Β  API Base URL

Deploy Status API Status

πŸŽ₯ Tip: Record a 10–15s screen capture of the dashboard/add-item flow, convert it to a GIF (ScreenToGif / Kap), drop it in a docs/ or .github/assets/ folder, and embed it below β€” a live animated preview is the single highest-impact thing you can add for recruiters skimming your repo.

![ExpireX demo](./.github/assets/demo.gif)

✨ Features

πŸ” Auth JWT-based register/login, forgot & reset password via email
πŸ“¦ Inventory CRUD Add, edit, delete, and search items with category & quantity tracking
⏰ Expiry Intelligence Auto-classification into Fresh, Expiring Soon, and Expired
πŸ”” Notifications In-app notification bell + automated email reminders via cron jobs
πŸ—‘οΈ Auto Cleanup Scheduled job archives expired items and removes stale entries
πŸ“Š Dashboard Bar & pie charts (Chart.js) showing category distribution and status breakdown
πŸŒ— Theming Light/dark mode via React Context
πŸ“± Responsive UI TailwindCSS + Framer Motion for a smooth, mobile-friendly experience
πŸš€ CI/CD Ready GitHub Actions workflow to install, build, and test on every push

πŸ›  Tech Stack

Tech stack icons



Layer Technology
Frontend React 19, Vite, React Router 7, TailwindCSS, Chart.js, Axios, Framer Motion, React Hot Toast
Backend Node.js, Express 4, JWT, Bcrypt.js
Database MongoDB with Mongoose ODM
Scheduling node-cron
Email Nodemailer (Gmail transport)
CI/CD GitHub Actions
Deployment Render (API) Β· Vercel (Client)

πŸ— Architecture & MVC Workflow

ExpireX is split into two independent apps that talk to each other over a REST API:

ExpireX/
β”œβ”€β”€ backend/     β†’ Node + Express API (MVC pattern)
└── frontend/    β†’ React + Vite SPA (Component/Context pattern)

Backend β€” MVC breakdown

backend/
β”œβ”€β”€ models/          # M β€” Mongoose schemas (data + validation)
β”‚   β”œβ”€β”€ User.js
β”‚   β”œβ”€β”€ Item.js
β”‚   β”œβ”€β”€ ExpiredItem.js
β”‚   └── Notification.js
β”‚
β”œβ”€β”€ controllers/      # C β€” Business logic that talks to Models
β”‚   β”œβ”€β”€ authController.js         (register, login, profile , password reset)
β”‚   β”œβ”€β”€ itemController.js         (CRUD for inventory items)
β”‚   β”œβ”€β”€ expiredController.js      (fetch archived/expired items)
β”‚   β”œβ”€β”€ notificationController.js (list, read, delete notifications)
β”‚   └── dashboardController.js    (aggregate stats for charts)
β”‚
β”œβ”€β”€ routes/            # HTTP endpoints β†’ wire URLs to Controllers
β”‚   β”œβ”€β”€ authRoutes.js        β†’ /api/auth
β”‚   β”œβ”€β”€ itemRoutes.js        β†’ /api/items
β”‚   β”œβ”€β”€ expiredRoutes.js     β†’ /api/expired
β”‚   β”œβ”€β”€ notificationRoutes.jsβ†’ /api/notifications
β”‚   └── dashboardRoutes.js   β†’ /api/dashboard
β”‚
β”œβ”€β”€ middleware/
β”‚   β”œβ”€β”€ authMiddleware.js    # protects routes via JWT (req.user)
β”‚   └── errorMiddleware.js   # centralized error handler
β”‚
β”œβ”€β”€ services/
β”‚   └── emailService.js      # nodemailer templates (welcome, reminder, reset)
β”‚
β”œβ”€β”€ cron/
β”‚   β”œβ”€β”€ expiryReminderCron.js # daily job β†’ emails users about items expiring soon
β”‚   └── deleteExpiredCron.js  # daily job β†’ archives/removes expired items
β”‚
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ db.js           # MongoDB connection
β”‚   └── mailConfig.js    # Nodemailer transporter setup
β”‚
β”œβ”€β”€ app.js       # Express app: middleware + route mounting
└── server.js    # Entry point: connects DB, starts cron jobs, starts server

Request lifecycle (the "V" is the JSON response consumed by React):

Client (React)
   β”‚  axios request + JWT
   β–Ό
Route  ──▢  Middleware (authMiddleware)  ──▢  Controller  ──▢  Model (Mongoose)  ──▢  MongoDB
   β–²                                                                                     β”‚
   └────────────────────────── JSON response ◀── errorMiddleware β—€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

ℹ️ Note: expiredRoutes.js exists in the codebase to expose expired-item history; make sure it's mounted in app.js (app.use("/api/expired", expiredRoutes)) if you want that endpoint active.

Frontend β€” component structure

frontend/src/
β”œβ”€β”€ pages/          # Route-level screens (Dashboard, ItemList, Login, Profile...)
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ common/      # Reusable UI: Button, InputField, Loader, ExpiryBadge...
β”‚   β”œβ”€β”€ layout/      # Navbar, Sidebar, Footer, DashboardLayout
β”‚   └── dashboard/    # ItemCard, ItemForm, BarChartCard, PieChartCard...
β”œβ”€β”€ context/         # AuthContext, ThemeContext, NotificationContext
β”œβ”€β”€ services/        # api.js (axios instance) + authService/itemService/...
β”œβ”€β”€ hooks/           # useFetch, useDebounce, usePagination, useLocalStorage...
β”œβ”€β”€ routes/          # AppRoutes.jsx β€” route definitions + ProtectedRoute
└── utils/           # constants, validators, expiryUtils, helpers

πŸš€ Getting Started

Prerequisites

  • Node.js β‰₯ 18 (project tested with Node 20)
  • MongoDB β€” local instance or a free MongoDB Atlas cluster
  • A Gmail account (with an App Password) for sending emails β€” or swap mailConfig.js for another provider

1. Clone the repository

git clone https://github.com/<your-username>/ExpireX.git
cd ExpireX

2. Backend setup

cd backend
npm install

Create a .env file inside backend/:

PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_super_secret_jwt_key
EMAIL_USER=your_gmail_address@gmail.com
EMAIL_PASS=your_gmail_app_password
FRONTEND_URL=http://localhost:5173
NODE_ENV=development

Run the API:

npm run dev     # nodemon, hot-reload
# or
npm start        # plain node

The server boots on http://localhost:5000, connects to MongoDB, and starts both cron jobs (expiry reminders + expired-item cleanup).

3. Frontend setup

Open a new terminal:

cd frontend
npm install

Create/update .env inside frontend/:

VITE_API_URL=http://localhost:5000/api

Run the client:

npm run dev

Visit http://localhost:5173 in your browser. πŸŽ‰

4. Build for production

# frontend
cd frontend
npm run build      # outputs to frontend/dist

# backend β€” just run
cd backend
npm start

⏱ Automated Jobs

Cron Job File What it does
Expiry Reminder cron/expiryReminderCron.js Runs daily, scans items nearing their expiry date, and emails the owner a reminder
Expired Cleanup cron/deleteExpiredCron.js Runs daily, moves items past their expiry date into the ExpiredItem archive and cleans active listings

πŸ“‘ API Reference

Base URL: http://localhost:5000/api

πŸ” Auth β€” /auth
Method Endpoint Description Auth
POST /auth/register Register a new user ❌
POST /auth/login Log in, receive JWT ❌
GET /auth/profile Get current user profile βœ…
PUT /auth/profile Update profile βœ…
PUT /auth/change-password Change password βœ…
POST /auth/forgot-password Request password reset email ❌
POST /auth/reset-password/:token Reset password with token ❌
πŸ“¦ Items β€” /items
Method Endpoint Description Auth
POST /items Add a new item βœ…
GET /items List all items for the user βœ…
GET /items/:id Get a single item βœ…
PUT /items/:id Update an item βœ…
DELETE /items/:id Delete an item βœ…
πŸ—‘οΈ Expired β€” /expired
Method Endpoint Description Auth
GET /expired List archived/expired items βœ…
πŸ”” Notifications β€” /notifications
Method Endpoint Description Auth
GET /notifications List notifications βœ…
PUT /notifications/read-all Mark all as read βœ…
PUT /notifications/:id Mark one as read βœ…
DELETE /notifications/:id Delete a notification βœ…
πŸ“Š Dashboard β€” /dashboard
Method Endpoint Description Auth
GET /dashboard/stats Aggregate stats: total items, fresh/expiring/expired counts, category distribution βœ…

βœ… = requires Authorization: Bearer <token> header (set automatically by the frontend AuthContext after login).


πŸ”„ CI/CD

A GitHub Actions workflow (.github/workflows/ci-cd.yml) runs on every push to main:

  1. Checks out the code
  2. Installs backend dependencies + runs tests (if present)
  3. Installs frontend dependencies
  4. Builds the frontend
  5. Reports pipeline success βœ…

πŸ—Ί Roadmap

  • Barcode/QR scanning for quick item entry
  • Push notifications (Web Push / mobile)
  • Multi-user households / shared inventories
  • Export inventory reports (CSV/PDF)
  • Unit & integration test suite

🀝 Contributing

Contributions are what make the open-source community amazing! Any contributions are greatly appreciated.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

Distributed under the MIT License. See LICENSE for more information.


Releases

Packages

Contributors

Languages