The server-side application for the ExpiredIs ecosystem — a web service designed for product expiration date tracking. Built with Node.js and Express, it provides a secure RESTful API, utilizes an SQLite database, and features automated daily background tasks for expiration monitoring.
- Runtime Environment: Node.js
- Backend Framework: Express.js
- Database: SQLite (
sqlite3) - Authentication: Passport.js (
passport-jwt) &bcryptfor password hashing - Security & Validation:
express-validatorandcors - Automation:
node-cron - Email Service Integration: Resend API
The server includes a built-in background task scheduler powered by node-cron that manages the following automated workflow:
- Schedule: Runs automatically every single day.
- Database Scan: Scans the SQLite database to identify products expiring in exactly 3 days.
- Notification: Compiles a summary list and instantly delivers an email alert to the user via the Resend API integration.
POST /register— Registers a new user account (includes data validation viaexpress-validator).POST /login— Authenticates user credentials and returns a JWT bearer token upon success.
GET /items— Retrieves a list of all products belonging to the authenticated user.POST /items— Adds a new product to the tracking catalog.DELETE /items— Removes a specific product from the database.
Clone the repository and install all required node modules:
npm installCreate a .env file in the root directory of the backend project and populate it with your configuration:
PORT=5000
JWT_SECRET_KEY=your_super_secret_jwt_key
SALTED_ROUNDS=12
ALLOW_ORIGINS=http://localhost:5173,http://localhost:3000
RESEND_API_KEY=re_your_resend_api_key
EMAIL_FROM=ExpiredIs <noreply@yourdomain.com>Launch the application server:
npm startThe server will boot up and become accessible locally at: http://localhost:5000