- Student 1: Hiranya Pahasara - ITBIN-2313-0019 - Role: Backend Developer
- Student 2: Pasan Ariyarathna - ITBIN-2313-0009 - Role: DevOps/Release Manager
- Student 3: Nethmina Seeman - ITBIN-2313-0103 - Role: Frontend Developer
The Vegetable Wastage Reduction System is a web application designed to track and reduce vegetable wastage in Sri Lanka. It enables agricultural agents to monitor harvest data across all 25 districts in real-time, identify production trends, and make data-driven decisions to minimize wastage.
🔗 Live URL: https://veg-waste-reduction-devops-assignment.onrender.com/
- Frontend: HTML5, CSS3, JavaScript (Vanilla)
- Backend: Node.js, Express.js
- Database: SQLite3
- DevOps: GitHub Actions (CI/CD)
- Deployment: Render
- Version Control: Git, GitHub
- Communication: Discord(https://discord.gg/JyDUZQSW)
- 🔐 User authentication (Admin, Employee, Customer roles)
- 📊 Real-time harvest data tracking by district
- 📈 Production trend visualization
- 🗺️ District-wise analytics
- 🌱 Seasonal data management
- 📱 Responsive mobile design
- 🔄 Automated CI/CD pipeline
- 🚀 One-click cloud deployment
We implemented a professional Git workflow:
main— Production branch (protected, requires PRs)develop— Integration branch for testingfeature/*— Individual feature branchesfeature/frontend-ui— Frontend UI developmentfeature/backend-api— Backend API developmentfeature/devops-pipeline— CI/CD pipeline setup
docs/readme— Edit readme file
- Repository initialization and GitHub configuration
- GitHub Actions CI/CD pipeline setup
.github/workflows/ci.yml— Node.js matrix testing (18.x, 20.x), install hardening, audit.github/workflows/deploy.yml— Vercel auto-deployment with secrets checks- Security audit with high severity threshold
- Branch protection rules on
mainanddevelop - Deployment platform setup (Render configuration)
- Merge conflict resolution and release coordination
- Commits: ci (initial), deploy (initial), chore (dependencies), docs (badges)
- Complete responsive UI/UX design and implementation
- HTML pages:
frontend/index.html,frontend/signin.html,frontend/category.html,frontend/dashboard-admin.html,frontend/dashboard-agent.html,frontend/dashboard-customer.html,frontend/District-tracking.html,frontend/seasonal-guide.html,frontend/seasonal-tracking.html - CSS styling with mobile responsiveness:
frontend/styles.css - JavaScript authentication logic:
frontend/auth.js - Core application functions:
frontend/app.js - Add to API overview:
frontend/vegetable-details.js - README creation and maintenance
- User documentation and setup instructions
- Code review participation
- Commits: feat (homepage), feat (login), docs (readme), style (responsive design)
- Express.js server setup with RESTful API design
- SQLite database schema and configuration
- API endpoints implementation in
backend/server.js- GET
/api/vegetables— Fetch all vegetables - GET
/api/vegetables/:id— Fetch single vegetable - GET
/api/harvest/:vegetableId— District totals by date - POST
/api/harvest— Add harvest data (employee only) - PUT
/api/harvest/:id— Update harvest data (employee only) - DELETE
/api/harvest/:id— Delete harvest data (employee only) - Auth: POST
/api/auth/register, POST/api/auth/login
- GET
- Database seeding script:
backend/seed-data.js - Backend testing and validation
- API documentation
- Commits: feat (server), feat (endpoints), test (seed-data)
- Node.js v18 or v20
- Git
- npm (bundled with Node.js)
# Clone repository
git clone https://github.com/PasanAriyarathna/veg-waste-reduction-devops-assignment.git
cd veg-waste-reduction-devops-assignment
# Install dependencies
npm install
# Seed database (optional)
node backend/seed-data.js
# Start server (serves frontend and APIs)
npm start
# Open the app
# http://localhost:3000- Admin — email:
admin@mail.com, password:admin123 - Employee (Colombo) — email:
farmer@colombo.com, password:farm123 - Employee (Galle) — email:
farmer@galle.com, password:farm123 - Customer — email:
customer@mail.com, password:cust123
GET /api/vegetables— List categoriesGET /api/vegetables/:id— Category detailsGET /api/harvest/:vegetableId— Aggregated quantities per district/datePOST /api/harvest— Add harvest (requiresemployeeRole: "employee")PUT /api/harvest/:id— Update harvest (employee only)DELETE /api/harvest/:id— Delete harvest (employee only)POST /api/auth/register— Customer or employee (auto by district)POST /api/auth/login— Login and receive role/district
- CI pipeline (
.github/workflows/ci.yml): Node 18.x, 20.x matrix; npm install; audit (high severity) - Deploy workflow (
.github/workflows/deploy.yml): build + deploy to production on main push
- Render (supported): Web Service with PORT env,
/tmpSQLite copy for persistence
- CI/CD failures: Node 16 EOL, missing system dependencies for native modules, strict npm audit blocking builds
- Vercel serverless crashes: Needed to export Express app, guard
app.listen, and copy SQLite to/tmpfor writable storage - Authentication errors: 401s resolved by seeding default users; frontend null button errors fixed with proper element IDs
- SQLite persistence: Read-only filesystem on serverless—mitigated with
/tmpcopy (note: data resets on redeploy)