A modern web app to scan and analyze food ingredients for halal status, with user authentication, dashboards, reporting, and admin moderation.
- Frontend: HTML, Vanilla JS, CSS
- Backend: Node.js, Express, MongoDB (Mongoose), JWT Auth, Cohere AI, Tesseract.js
- Database: MongoDB (local or Atlas)
- UI/UX: SweetAlert2, FontAwesome
- Scan and analyze food ingredients for halal status (OCR & AI extraction)
- User registration and login (JWT-based)
- Save scan results (per user)
- Submit and manage inaccuracy reports
- User dashboard: manage saved results & reports
- Admin dashboard: review/respond to reports, moderate saved results
- Testimonials system
- Responsive, modern UI
- Clone the repository
git clone <repository-url> cd halal-scanner
- Install dependencies
cd backend npm install cd .. npm install
- Configure Environment Variables
- Create
.envinbackend:MONGO_URI=mongodb://localhost:27017/halal-scanner JWT_SECRET=your_jwt_secret_here COHERE_API_KEY=your_cohere_api_key_here
- Replace
your_jwt_secret_herewith a secure secret for JWT - Replace
your_cohere_api_key_herewith your Cohere API key - For production, use a MongoDB Atlas URI instead of localhost
- Create
- Start the backend
cd backend npm start - Open the app
- Open
index.htmlin your browser.
- Open
You can generate default credentials for Admin and User using the mongo-init.js script.
cd backend
node mongo-init.jsPOST /auth/signup— Register userPOST /auth/signin— Authenticate user, returns JWT
POST /analyze-ingredients— Analyze ingredient list for halal statusPOST /extract-ingredients-ai— Extract ingredients from OCR text (AI)
GET /api/saved-results— Get user's saved resultsPOST /save-results— Save scan resultDELETE /saved-results/:id— Delete saved result
POST /submit-report— Submit inaccuracy reportGET /user-reports— Get user's reportsGET /api/user/reports— Get user's reports (alternative endpoint)DELETE /reports/:id— Delete report
GET /admin/reports— Get all reportsPUT /admin/reports/:id— Update report status/note
GET /api/testimonials— Get all testimonialsPOST /api/testimonials— Submit testimonial
GET /health— Check API statusGET /— Welcome message and API status
- User: { name, email, password (hashed), is_admin }
- SavedResult: { user_id, result_data, created_at }
- Report: { user_id, item_name, reason, status, admin_note, created_at }
- Testimonial: { name, rating, testimony, created_at }
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
- Open an issue in the repository
- Contact the development team