During Sprint-3, I focused on building and refining a critical feature for our inventory management backend: a low stock alert system. Alongside this, I dedicated time to improving project documentation and maintaining clarity in code contributions. This sprint challenged both my technical implementation skills and my ability to communicate system behavior effectively for team collaboration.
What Was Implemented
The low stock alert system was designed to run once daily at 10 AM on weekdays, checking if any products in categorized_database.json
had dropped below their respective minimum stock threshold. If a product was low, an email alert was automatically triggered using nodemailer
and Gmail’s SMTP service.
To ensure this didn’t overload the system, I used a time-gated setInterval()
inside index.js
that only allowed email triggers if the day was between Monday and Friday and the hour equaled 10. The function checkAndSendLowStockAlert()
in stockAlert.js
handled the core logic and email composition.
Documentation Work
I also spent significant time documenting:
- Purpose and responsibilities of the new
stockAlert.js
module. - Integration lines in
stockAlert.js
showing how and when the alert system executes. - Comments in code explaining each logic block.
- A issue description called Low stock product alert covering everything from cron-like scheduling logic to pending
Gmail
credentials that require updates for the system to function securely.
GitLab Activity Highlights
- Issue description : adding stockAlert.js to send an email for product running low – Added logic for stock monitoring and automated email notifications.
- Commit: Integrate alert system into main app flow – Integrated scheduled function into
index.js
with time and weekday validation. - Documentation Update: stockAlert.js – Wrote inline and README documentation explaining stock alert logic and configuration.
What Worked Well
- Modularization: Separating the alert system logic from
index.js
into its own file (stockAlert.js
) helped maintain clean code structure and made debugging much easier. - Scheduled execution: Implementing a weekday/time condition made the feature realistic for workplace use and prevented unnecessary system loads.
- Collaborative Documentation: Keeping a running commentary in GitLab merge requests helped the team understand changes quickly and facilitated smooth peer reviews.
What Didn’t Work Well
- Gmail integration required an app password and correct permissions. The first few test runs failed due to missing or incorrect credentials.
- Initial testing limitations: Since the alert only triggers once per day at 10 AM, simulating scenarios for rapid testing was a challenge.
- Delayed implementation of logging: Early iterations lacked logs or fallbacks, making failures harder to trace.
- After talking to professor Karl, he wanted to the server to handle this, so an issue was created so it alert can be server-handled task.
What Could Be Improved as a Team
- Create a shared
.env
or config file that can be used across modules instead of hardcoding emails or thresholds. - Develop a simulation mode to test time-bound functions instantly, especially for scheduled jobs.
- Review and testing sessions could be more frequent and planned earlier in the sprint.
What Could Be Improved as an Individual
- I should’ve created mock data and test harnesses sooner to simulate alerts without waiting for specific days or times.
- Next time, I’ll also write unit tests for alert logic to ensure that key conditions are evaluated correctly.
- I should’ve been quicker to document issues with the Gmail setup and create a checklist for anyone running the alert system in another environment.
Apprenticeship Pattern: “Breakable Toys” (Chapter 3)
Summary: The “Breakable Toys” pattern encourages developers to build small, personal projects that simulate real-world systems, allowing them to make mistakes safely and learn without real consequences.
Why I Chose It: This pattern resonated deeply with my experience during the sprint. The low stock alert feature was like a small “toy system” that had the same structure as production-level alert systems (scheduled jobs, email APIs, condition checks) but existed in a controlled environment.
Relevance: During this sprint, I often wished for a sandboxed copy of our inventory system just to run quick iterations. The constraints of the main codebase slowed experimentation. Had I consciously embraced the “Breakable Toys” mindset earlier, I could have built a parallel mini-system that isolated alert logic and Gmail testing—speeding up development and reducing risk.
How It Would’ve Helped: Reading this pattern in advance would have prompted me to:
- Clone and strip down the inventory codebase into a test script.
- Avoid introducing bugs into the primary system.
- Feel more confident experimenting with cron-style scheduling and async email logic.
Low Stock Alert System
From the blog cs@worcester – A Journey through CS by mgl1990 and used with permission of the author. All other rights reserved by the author.