Overview
The SmartShelf alert system provides real-time notifications for critical inventory events, helping managers and administrators take immediate action to prevent stockouts, reduce waste, and maintain optimal inventory levels.Alert Categories
The system monitors four distinct alert types:Expired Items
Severity: CRITICALItems that have passed their expiry date. Immediate removal required for safety and compliance.
Expiring Soon
Severity: HIGH/MEDIUMItems expiring within 7 days. Priority sale or use recommended to prevent waste.
Low Stock
Severity: HIGH/MEDIUMItems below reorder threshold (default: 10 units). Reordering needed to prevent stockouts.
Out of Stock
Severity: HIGHItems with zero quantity. Immediate restocking required to fulfill orders.
Real-Time Notifications
Live Alert Feed
The Manager Dashboard displays a live alert feed (ManagerDashboard.tsx:485-508):Severity Indicators
Visual indicators for quick severity assessment:Alert Types in Detail
Expired Items
Items that have passed their expiry date (alertController.js:89-121):- “Expired 1 day ago”
- “Expired 5 days ago”
Expiring Soon Alerts
Items expiring within configurable timeframe (alertController.js:39-84):- ≤ 1 day: CRITICAL
- ≤ 3 days: HIGH
- ≤ 5 days: MEDIUM
- 6-7 days: LOW
Low Stock Alerts
Items below threshold quantity (alertController.js:7-34):- Default: 10 units
- Configurable via query parameter or environment variable
- High severity if quantity ≤ 50% of threshold
Out of Stock Alerts
Items with zero quantity (alertController.js:124-150):Alert API Endpoints
Get All Critical Alerts
Combined view of all high-priority alerts (alertController.js:155-252):- Expired items (CRITICAL)
- Critically expiring items (≤3 days)
- Out of stock items (HIGH)
- Critical low stock (below 5 units)
Get Alert Summary
Overall statistics (alertController.js:331-373):Category-Specific Alerts
Alerts filtered by category (alertController.js:257-326):Individual Alert Endpoints
- Expired
- Expiring Soon
- Low Stock
- Out of Stock
Notification Analytics Endpoint
Special endpoint for Manager Dashboard (analyticsController.js:171-272):- Combines all alert types
- Sorts by severity
- Returns human-readable messages
- Includes timestamps
Alert Configuration
Environment Variables
Runtime Configuration
Alerts can be customized via query parameters:Integration with Other Features
Task Automation
Critical alerts can trigger automatic task creation:Dashboard Integration
Alerts feed into dashboard KPIs:Best Practices
Daily Alert Review
Daily Alert Review
- Review critical alerts first thing each morning
- Address expired items immediately
- Plan actions for high-severity alerts
- Monitor trends in alert frequency
Threshold Optimization
Threshold Optimization
- Adjust thresholds based on consumption rates
- Different thresholds for different categories
- Consider supplier lead times
- Account for demand variability
Alert Response Workflow
Alert Response Workflow
- Triage alerts by severity
- Create tasks for action items
- Document actions taken
- Update inventory accordingly
- Review and adjust thresholds
Preventive Measures
Preventive Measures
- Use FEFO to prevent expiry
- Implement automatic reordering
- Regular inventory audits
- Track alert trends
Performance Considerations
Alert queries are optimized with database indexes on:
expiryDate(ascending)quantity(ascending)updatedAt(descending)
Access Control
| Role | View Alerts | Configure Thresholds | Create Tasks from Alerts |
|---|---|---|---|
| Admin | ✅ All | ✅ | ✅ |
| Manager | ✅ All | ✅ | ✅ |
| Worker | ❌ | ❌ | ❌ |
Related Features
FEFO Ordering
Prevent expiry alerts with FEFO
Demand Forecasting
Predict low stock alerts
Task Management
Create tasks from alerts
Analytics Dashboard
Visualize alert trends