calm-nutrition

byABCDE

You are a senior full-stack software engineer and system architect. Your task is to build a COMPLETE FULL-STACK WEB APPLICATION called: "AI Nutrition Label Scanner" โš ๏ธ IMPORTANT REQUIREMENTS: - The project must be fully working with NO ERRORS. - All frontend and backend must be CONNECTED properly. - Only deployment and external API key setup can be left incomplete. - Follow CLEAN CODE practices and proper folder structure. - Generate code STEP-BY-STEP in logical phases. ------------------------------------------------------------ ๐ŸŒ PROJECT OVERVIEW: Build a nutrition label scanner web app where users: 1. Register and login 2. Create a medical profile (health conditions) 3. Upload or capture an image of a food nutrition label 4. System analyzes the label using AI (OCR + NLP) 5. Output personalized health recommendation: - Can the user eat it or not? - Nutritional breakdown (sugar, protein, energy, etc.) - Visual charts (graphs) - Warnings based on medical conditions - Suggested alternatives ------------------------------------------------------------ ๐Ÿง  TECH STACK: FRONTEND: - HTML - CSS - JavaScript - React.js (with functional components and hooks) BACKEND: - Python (Flask or FastAPI preferred) - OpenCV (image preprocessing) - OCR (Tesseract) - NLP (spaCy or NLTK) DATABASE & AUTH: - Firebase Firestore - Firebase Authentication IMAGE STORAGE: - Cloudinary (store uploaded images and return URL) ------------------------------------------------------------ ๐Ÿ‘ค USER ROLES: 1. USER PANEL 2. ADMIN PANEL Use Firestore field: - userType = 1 โ†’ normal user - userType = 2 โ†’ admin After login: - Redirect users based on userType ------------------------------------------------------------ ๐Ÿ” AUTHENTICATION FLOW: - Register user with: - Name - Age - Email - Password - Medical conditions: - Diabetes - High BP / Low BP - Heart Disease - Kidney Disease - Allergies (text input) - Store in Firestore - Login: - Fetch email & password from Firestore - Identify userType - Redirect: - User โ†’ User Panel - Admin โ†’ Admin Dashboard ------------------------------------------------------------ ๐Ÿ“ฑ USER PANEL PAGES: 1. Home Page 2. About Page 3. Profile Page - Show/edit medical data 4. Scan Page โš ๏ธ IMPORTANT: - Lock "Scan Page" until profile is completed ------------------------------------------------------------ ๐Ÿ“ธ IMAGE SCANNING FLOW: 1. User uploads or captures image 2. Image is uploaded to Cloudinary 3. Cloudinary returns image URL 4. Store URL in Firestore 5. Send URL to Python backend API ------------------------------------------------------------ ๐Ÿงช BACKEND PROCESSING: Python should: 1. Fetch image from URL 2. Preprocess image using OpenCV 3. Extract text using OCR (Tesseract) 4. Use NLP to identify: - Sugar - Protein - Calories - Fat - Sodium - Ingredients 5. Match extracted data with user's medical profile ------------------------------------------------------------ ๐Ÿ“Š OUTPUT TO USER: Display: 1. Decision: - "Safe to Eat" / "Avoid" 2. Nutritional Breakdown: - Sugar - Protein - Energy - Fat - Sodium 3. Charts: - Use Chart.js or Recharts - Bar charts or pie charts 4. Warnings: Example: - "High sugar - Not recommended for diabetes" - "High sodium - Risk for BP patients" 5. Recommendations: - Suggest healthier alternatives ------------------------------------------------------------ ๐Ÿ› ๏ธ ADMIN PANEL: Admin Dashboard should include: 1. Total Users 2. New Users (daily) 3. Health trends (basic stats) 4. Manage Users: - View users - Block / Unblock users ------------------------------------------------------------ ๐Ÿ“ PROJECT STRUCTURE: Generate proper folder structure: Frontend (React): - components/ - pages/ - services/ - firebaseConfig.js Backend (Python): - app.py / main.py - routes/ - services/ - OCR module - NLP module ------------------------------------------------------------ ๐Ÿ”— API INTEGRATION: Create REST APIs: - /analyze-label (POST) - /get-user-data - /admin/stats - /block-user ------------------------------------------------------------ ๐ŸŽฏ DEVELOPMENT STEPS: Follow this EXACT ORDER: STEP 1: Setup project structure STEP 2: Firebase setup (Auth + Firestore) STEP 3: React frontend UI (all pages) STEP 4: Authentication system STEP 5: Profile creation & validation STEP 6: Cloudinary image upload integration STEP 7: Python backend setup STEP 8: OCR + NLP pipeline STEP 9: API integration (frontend โ†” backend) STEP 10: Data visualization (charts) STEP 11: Admin dashboard STEP 12: Final integration testing ------------------------------------------------------------ ๐ŸŽจ UI/UX REQUIREMENTS: - Clean modern UI - Responsive design - Use cards, dashboards, and charts - Show loading states - Show error handling ------------------------------------------------------------ โš ๏ธ FINAL OUTPUT FORMAT: - Provide FULL CODE for: - Frontend - Backend - Ensure everything connects properly - Include comments in code - No missing dependencies ------------------------------------------------------------ IMPORTANT: Do NOT skip steps. Do NOT give partial code. Ensure everything works logically end-to-end.

Landing
Landing

Comments (0)

No comments yet. Be the first!

Project Tasks18

#2

Align Color and Theme

To Do

As a user, I want all pages to have a consistent color scheme and theme aligned with the SRD design guidelines. Apply the global color palette (Background #F5F9F6, Surface #FFFFFF, Text #2C3E50, Accent #27AE60, Muted #BDC3C7) across all existing scaffold pages (home, login, signup, welcome, dashboard/overview, dashboard/ai-assistant, dashboard/settings). Set up global CSS variables or a theme provider in React so all components inherit the correct styles. Ensure typography, spacing, and component styles are consistent. Remove scaffold pages not needed by the application.

AI 80%
Human 20%
High Priority
1 day
Frontend Developer
#11

Implement User Registration API

To Do

As a user, I want to be able to use the backend API to register my account. Implement the user registration endpoint that accepts name, age, email, password, and medical conditions, stores the user in Firebase Firestore with userType=1, and handles validation and error responses.

AI 80%
Human 20%
High Priority
1 day
Backend Developer
#12

Implement Profile Management API

To Do

As a user, I want to be able to use the backend API to create and update my medical profile. Implement endpoints to fetch and update medical profile data (health conditions) in Firestore for the authenticated user.

AI 80%
Human 20%
High Priority
1 day
Backend Developer
#13

Implement Cloudinary Image Upload

To Do

As a user, I want to be able to use the backend service to upload nutrition label images to Cloudinary. Implement the image upload integration that accepts an image file or URL, uploads it to Cloudinary, stores the returned URL in Firestore, and returns the URL to the frontend for further processing.

AI 75%
Human 25%
High Priority
1 day
Backend Developer
#16

Implement Admin Stats API

To Do

As an admin, I want to be able to use the backend API to retrieve dashboard statistics. Implement the /admin/stats endpoint that returns total users, new users (daily), and aggregated health trend data from Firestore. Restricted to admin users (userType=2).

AI 75%
Human 25%
Medium Priority
1 day
Backend Developer
#17

Implement Block/Unblock User API

To Do

As an admin, I want to be able to use the backend API to block or unblock users. Implement the /block-user endpoint that updates the user's status in Firestore, preventing blocked users from accessing the application. Restricted to admin users (userType=2).

AI 75%
Human 25%
Medium Priority
1 day
Backend Developer
#1

Implement Landing Page Design

To Do

As a user, I want to see a visually captivating landing page based on the existing JSX design (Landing v2) that features the interactive 3D nutrition label scanner with hover animations, click interactions, AI scan beam visualization, and smooth transitions. This is the entry point of the user flow where users can view a demo, navigate to Register or Login. Remove any scaffold pages not needed by the application. Implement the color palette: Background #F5F9F6, Surface #FFFFFF, Text #2C3E50, Accent #27AE60, Muted #BDC3C7.

Depends on:#2
Waiting for dependencies
AI 90%
Human 10%
High Priority
2 days
Frontend Developer
#14

Implement OCR and NLP Pipeline

To Do

As a user, I want the backend to extract nutritional information from my uploaded label image. Implement the OCR and NLP pipeline: fetch the image from the Cloudinary URL, preprocess using OpenCV, extract text with Tesseract OCR, parse nutritional fields (sugar, protein, calories, fat, sodium, ingredients) using spaCy NLP, and return structured nutritional data.

Depends on:#13
Waiting for dependencies
AI 70%
Human 30%
High Priority
3 days
Backend Developer
#3

Build Register Page

To Do

As a user, I want to be able to register an account by providing my name, age, email, password, and medical conditions (diabetes, high/low BP, heart disease, kidney disease, allergies). The page should validate inputs, show error messages, and redirect to Login on success. In the user flow this page is reached from the Landing page and leads to the Login page.

Depends on:#1#11
Waiting for dependencies
AI 85%
Human 15%
High Priority
1.5 days
Frontend Developer
#4

Build Login Page

To Do

As a user, I want to be able to sign in with my email and password. The login page should authenticate via Firebase, identify the userType field (1 = regular user, 2 = admin), and redirect accordingly: regular users go to the Profile/Dashboard, admins go to the Admin Dashboard. This page is reached from Landing or Register in the user flow.

Depends on:#1
Waiting for dependencies
AI 85%
Human 15%
High Priority
1 day
Frontend Developer
#15

Implement Analyze Label API

To Do

As a user, I want to be able to use the /analyze-label backend API to receive personalized health recommendations. Implement the POST /analyze-label endpoint that accepts the image URL and user ID, runs the OCR/NLP pipeline, matches extracted nutritional data against the user's medical profile, and returns: Safe/Avoid decision, nutritional breakdown, warnings, and alternative suggestions. Must process within 5 seconds.

Depends on:#12#14
Waiting for dependencies
AI 75%
Human 25%
High Priority
2 days
Backend Developer
#5

Build Profile Page

To Do

As a user, I want to be able to view and edit my medical profile including health conditions (diabetes, high/low BP, heart disease, kidney disease, allergies). The profile page should display current medical data and allow updates saved to Firestore. In the user flow, after login the user is directed here to set medical data, and from the Results page users can return here. The Scan page must be locked until the profile is completed.

Depends on:#12#4
Waiting for dependencies
AI 85%
Human 15%
High Priority
2 days
Frontend Developer
#8

Build Admin Dashboard Page

To Do

As an admin, I want to view a dashboard showing key stats: total users, new users (daily), and health trends/statistics. This page is the landing page for admin users after login in the user flow and links to the Trends and User Management pages.

Depends on:#4#16
Waiting for dependencies
AI 85%
Human 15%
Medium Priority
1.5 days
Frontend Developer
#6

Build Scan Page

To Do

As a user, I want to be able to upload or capture an image of a food nutrition label. The page should allow image selection or camera capture, upload to Cloudinary, store the returned URL in Firestore, and send the URL to the backend /analyze-label API. The page must be locked/inaccessible until the user has completed their medical profile. In the user flow this page is reached from the Profile page and leads to the Results page.

Depends on:#5#13#15
Waiting for dependencies
AI 80%
Human 20%
High Priority
2 days
Frontend Developer
#9

Build Admin Trends Page

To Do

As an admin, I want to view health trend statistics and visualizations showing usage patterns across all users. This page is accessible from the Admin Dashboard and displays aggregated health and nutritional data trends.

Depends on:#8#16
Waiting for dependencies
AI 80%
Human 20%
Medium Priority
1.5 days
Frontend Developer
#10

Build Admin Users Page

To Do

As an admin, I want to view all registered users and be able to block or unblock them. The Users page should display a list of users with their details and status, and provide block/unblock actions that update Firestore. In the user flow this page is reached from the Admin Dashboard and supports Block User and Unblock User actions.

Depends on:#17#8
Waiting for dependencies
AI 85%
Human 15%
Medium Priority
1.5 days
Frontend Developer
#7

Build Results Page

To Do

As a user, I want to view personalized health recommendations after scanning a nutrition label. The Results page should display: a Safe/Avoid decision, nutritional breakdown (sugar, protein, energy, fat, sodium), visual bar/pie charts using Chart.js or Recharts, warnings based on medical conditions (e.g. 'High sugar - Not recommended for diabetes'), and suggested healthy alternatives. In the user flow this page is reached from the Scan page and links back to Profile. Show loading states during analysis.

Depends on:#6
Waiting for dependencies
AI 85%
Human 15%
High Priority
2 days
Frontend Developer
#18

Integrate Frontend with Backend APIs

To Do

As a user, I want all frontend pages to seamlessly communicate with the backend APIs. Connect the Scan page to /analyze-label, the Results page to display API responses, the Profile page to the profile management API, and the Admin pages to /admin/stats and /block-user. Implement loading states, error handling, and proper authentication headers across all API calls.

Depends on:#15#16#10#17#7#9
Waiting for dependencies
AI 75%
Human 25%
High Priority
2 days
Frontend Developer
Landing design preview
Login: Sign In
Dashboard: View Stats
Dashboard: View Trends
Users: View All Users
Users: Block User
Users: Unblock User