React Β· Node.js Β· Express Β· MongoDB Β· JWT Β· Gemini / Groq Vision AI
An Arabic-first management system for print shops that combines employee attendance, print-job tracking, inventory control, printer management, financial reporting, and image-based AI waste classification.
Smart Printer Management System is a full-stack web application designed to help a print shop manage its daily operations from one place.
The system provides two main experiences:
- Employee App (React): attendance, print-job registration, AI-assisted waste reporting, and personal statistics.
- Admin Portal (EJS/Express): operational dashboard, employee management, printer management, inventory, attendance reports, printing reports, waste reports, and financial reports.
The project also includes a Vision AI workflow that analyzes an uploaded image of damaged paper and classifies the likely cause as Machine, Employee, or Unknown, with a short Arabic explanation.
- Dashboard with daily operational statistics.
- Employee management: view, add, edit, search, and delete employees.
- Printer management and active-printer tracking.
- Inventory and paper-stock management.
- Low-stock monitoring.
- Print-job management and recent activity tracking.
- Attendance reports.
- Printing reports.
- Waste reports.
- Financial reporting and daily revenue tracking.
- Role-based access control for protected admin pages.
- Secure sign-in using JWT authentication.
- Smart daily Check In / Check Out attendance flow.
- Browser geolocation capture for attendance records.
- Prevention of duplicate attendance registration on the same day.
- Register new print jobs using available paper/material inventory.
- Server-side print-price calculation.
- Submit paper-waste reports.
- Upload a waste image for AI analysis.
- View personal profile information and monthly statistics.
- Responsive bottom navigation for quick access to main employee features.
- Image upload with validation and an 8 MB size limit.
- Vision-based waste analysis using Gemini or Groq.
- Automatic provider fallback when both providers are configured.
- Classification into:
MachineEmployeeUnknown
- Short Arabic AI explanation for the detected issue.
- AI result, provider, explanation, and status are stored with the waste report.
- Safe manual-review fallback when AI analysis is unavailable or inconclusive.
| Layer | Technologies |
|---|---|
| Frontend | React 19, React Router, Axios, Bootstrap 5, Bootstrap Icons |
| Employee UI | React SPA |
| Admin UI | EJS server-rendered views |
| Backend | Node.js, Express 5 |
| Database | MongoDB, Mongoose |
| Authentication | JWT, bcryptjs |
| AI / Vision | Google Gemini API, Groq Vision API |
| File Uploads | Multer |
| Validation | Joi |
| Maps / Location | Browser Geolocation, Leaflet, React Leaflet |
| Utilities | Moment.js, CORS, Cookie Parser, Dotenv |
flowchart LR
E[Employee] --> R[React Employee App\nlocalhost:3000]
A[Admin] --> V[EJS Admin Portal\nlocalhost:3001]
R --> API[Node.js / Express API]
V --> API
API --> DB[(MongoDB)]
API --> AI{Vision AI}
AI --> G[Google Gemini]
AI --> Q[Groq Vision]
Employee / Admin
β
React SPA / EJS Views
β
Express Routes + Middleware
β
Controllers + Services
β
Mongoose Models
β
MongoDB
Waste Image β AI Service β Gemini / Groq β Classification β MongoDB
smart_printer/
β
βββ client/ # React employee application
β βββ public/
β βββ src/
β β βββ components/
β β βββ pages/
β β β βββ Login.js
β β β βββ Attendance.js
β β β βββ PrintJob.js
β β β βββ WasteReport.js
β β β βββ Profile.js
β β βββ services/
β βββ .env.example
β βββ package.json
β
βββ server/ # Node.js / Express backend
β βββ config/
β βββ controllers/
β βββ middlewares/
β βββ models/
β βββ routes/
β βββ services/
β β βββ wasteAIService.js
β βββ utils/
β βββ validators/
β βββ views/ # EJS admin portal
β βββ public/
β βββ .env.example
β βββ index.js
β βββ package.json
β
βββ docs/
β βββ screenshots/
β
βββ README.md
Make sure you have:
- Node.js 18+
- npm
- A MongoDB Atlas database or local MongoDB instance
- Optional: a Gemini API key and/or Groq API key for AI waste analysis
git clone <YOUR_REPOSITORY_URL>
cd <YOUR_PROJECT_FOLDER>cd server
npm installCreate server/.env using server/.env.example:
PORT=3001
CLIENT_ORIGIN=http://localhost:3000
MONGO_URI=mongodb+srv://USERNAME:PASSWORD@YOUR_CLUSTER.mongodb.net/smart_printer?retryWrites=true&w=majority
JWT_SECRET=replace_with_a_long_random_secret
# Preferred AI provider: gemini or groq
AI_PROVIDER=gemini
# Gemini
GEMINI_API_KEY=your_gemini_api_key
GEMINI_MODEL=gemini-2.5-flash
# Optional Groq fallback
GROQ_API_KEY=your_groq_api_key
GROQ_VISION_MODEL=qwen/qwen3.8-27bStart the backend:
npm run devor:
npm startBackend URL:
http://localhost:3001
Open another terminal:
cd client
npm installCreate client/.env:
REACT_APP_API_URL=http://localhost:3001Start React:
npm startFrontend URL:
http://localhost:3000
The application uses JWT-based authentication.
- Protected employee API routes require a valid token.
- Admin-only routes use role-based authorization middleware.
- Passwords are hashed using
bcryptjs. - Secrets and database credentials are stored in environment variables.
Important: Never commit
server/.envor real API keys to GitHub.
- The employee selects the printer where the issue occurred.
- The number of wasted sheets is entered.
- A photo of the damaged paper is uploaded.
- The backend validates and sends the image to the configured Vision AI provider.
- The AI returns a strict structured result containing the likely cause and an Arabic explanation.
- The waste report and AI analysis are stored in MongoDB.
- If the preferred provider fails, the service can automatically try the configured fallback provider.
Example AI result:
{
"decision": "Machine",
"explanation": "ΩΩΨ¬Ψ― ΨͺΩΩ Ω
Ψ§Ψ―Ω ΩΨ§ΨΆΨ ΩΩ Ψ§ΩΩΨ±Ω ΩΨ±Ψ¬Ψ ΩΨ¬ΩΨ― Ω
Ψ΄ΩΩΨ© Ω
ΩΩΨ§ΩΩΩΩΨ© Ψ£Ψ«ΩΨ§Ψ‘ Ψ§ΩΨ·Ψ¨Ψ§ΨΉΨ©."
}
Login
|
Admin Dashboard
|
Employee View
|
Smart Attendance
|
Print Job Registration
|
AI Waste Upload
|
AI-Assisted Waste Analysis Result
|
|
Inventory Management
|
Employee Management
|
Employee Profile
|
|
The admin dashboard summarizes important daily data, including:
- Total printers
- Total employees
- Low-stock inventory items
- Daily revenue
- Print jobs created today
- Employees present today
- Total wasted sheets today
- Recent print jobs
- Current staff attendance status
- Keep
.envfiles outside version control. - Use a strong, unique
JWT_SECRET. - Rotate API keys immediately if they are ever exposed.
- Restrict MongoDB Atlas network access and database-user permissions.
- Use HTTPS and secure deployment secrets in production.
- Consider HttpOnly secure cookies instead of browser
localStoragefor production authentication.
- Server-side attendance geofencing around the workplace.
- Separate check-in and check-out GPS locations.
- MongoDB transactions / atomic stock updates for high-concurrency printing.
- Improved dashboard charts and analytics.
- Push/email notifications for low stock.
- More advanced AI waste categories and confidence scoring.
- Export reports to PDF/Excel.
- Full responsive admin dashboard.
- Automated API and integration tests.
- Production deployment with HTTPS.
- React production build: working
- Backend JavaScript syntax validation: passing
- MongoDB integration: working
- JWT authentication: working
- Role-based admin protection: working
- Attendance flow: working
- Print-job workflow: working
- AI waste analysis: working
- Gemini / Groq fallback support: implemented
This project is currently intended for educational and academic use. Add a dedicated LICENSE file if you plan to distribute it publicly under a specific open-source license.
Smart Printer Management System
Built to make print-shop operations smarter, more traceable, and easier to manage.









