How md-suhail07-code/label-lens works
Label-Lens is a personalized food-label safety app. Users create an account and health profile, scan a barcode or enter ingredients, review an ingredient-risk result and alternatives, and revisit scan history. The shown backend barcode path retrieves product data and asks Gemini to clean and analyze ingredients with health context; the README also describes OCR, regulatory grounding, and safer swaps. Those additional capabilities are preserved as documented features, but their implementation is not evident in the excerpts. Frontend-to-API links are therefore marked unverified where source was not shown.
Main entry points: App.jsx Application router · userController.js Account operations · ocrController.js Scan analysis · userRoute.js Account API
Components 28
User experience
- Application router
Frontend/src/App.jsx - Scanner workflow
Frontend/src/pages/Scanner.jsx - Manual entry
Frontend/src/pages/ManualEntry.jsx - Analysis results
Frontend/src/pages/ResultsPage.jsx - Scan history
Frontend/src/pages/History.jsx - Health profile
Frontend/src/pages/HealthProfile.jsx - Scanner controls
Frontend/src/components/scanner/ScanModeToggle.jsx - Scanner overlay
Frontend/src/components/scanner/ScannerOverlay.jsx
Accounts and profiles
- Account screens
Frontend/src/pages/Signup.jsx - Email verification
Frontend/src/pages/EmailVerify.jsx - Profile state
Frontend/src/context/UserProfileContext.jsx - Account API
Backend/routes/userRoute.js - Account operations
Backend/controllers/userController.js - Authentication guard
Backend/middleware/isAuthenticated.js - Verification mailer
Backend/mailer/verifyEmail.js - OTP mailer
Backend/mailer/sendOtp.js
Product analysis
- Scan API
Backend/routes/ocrRoute.js - Scan analysis
Backend/controllers/ocrController.js - OCR reading
Backend/controllers/ocrController.js - HTTP server
Backend/server.js
Persistence
- History state
Frontend/src/context/ScanHistoryContext.jsx - User records
Backend/models/userModel.js - Login sessions
Backend/models/sessionModel.js - Scan records
Backend/models/historyModel.js - MongoDB connection
Backend/database/db.js
Other components
- Consumer
- OpenFoodFacts
- Gemini analysis
Connections 31
- Consumer → Application router: uses
Frontend/src/App.jsx - Application router → Scanner workflow: routes to
Frontend/src/App.jsx - Application router → Manual entry: routes to
Frontend/src/App.jsx - Application router → Analysis results: routes to
Frontend/src/App.jsx - Application router → Scan history: routes to
Frontend/src/App.jsx - Application router → Health profile: routes to
Frontend/src/App.jsx - Application router → Account screens: routes to
Frontend/src/App.jsx - Application router → Email verification: routes to
Frontend/src/App.jsx - Scanner workflow → Scanner controls: renders
Frontend/src/pages/Scanner.jsx - Scanner workflow → Scanner overlay: renders
Frontend/src/pages/Scanner.jsx - Scanner workflow → Scan API: submits scan
- Manual entry → Scan API: submits ingredients
- Scan API → Scan analysis: dispatches
Backend/routes/ocrRoute.js - Scan analysis → OpenFoodFacts: looks up products
Backend/controllers/ocrController.js - Scan analysis → Gemini analysis: requests analysis
Backend/controllers/ocrController.js - OCR reading → Scan analysis: documented OCR capability
README.md - Scan analysis → Analysis results: returns analysis
- Health profile → Profile state: updates profile
- Scan history → History state: reads scans
- Account screens → Account API: account requests
- Email verification → Account API: verifies email
- HTTP server → Account API: mounts
Backend/server.js - HTTP server → Scan API: mounts
Backend/server.js - HTTP server → MongoDB connection: connects
Backend/server.js - Account API → Account operations: dispatches
Backend/routes/userRoute.js - Account API → Authentication guard: guards routes
Backend/routes/userRoute.js - Account operations → User records: reads and writes
Backend/controllers/userController.js - Account operations → Login sessions: manages sessions
Backend/controllers/userController.js - Account operations → Verification mailer: sends verification
Backend/controllers/userController.js - Account operations → OTP mailer: sends OTP
Backend/controllers/userController.js - Authentication guard → User records: loads user
Backend/middleware/isAuthenticated.js