A Flutter-based health intelligence app that scans packaged food products and delivers a personalized suitability verdict based on your unique health profile, goals, and medical conditions. Features Offline-First Hive DB, Cloud Firestore profile sync, Admin-Approved Global Product Registry, and Manual Product Submission.
For an in-depth deep dive into the system architecture, data flow, performance optimizations, and admin workflow, see LEARN.md.
Most nutrition apps just show you numbers. NutriDecide reasons about them.
- πΈ 1-Tap Scan: Instant food analysis via barcode
- π§ Inference Engine: Cross-references nutrients with your personal health DNA
- π― Offline-First: 20,000 foods indexed locally via Hive (O(1) lookup)
- βοΈ Cloud Sync: Profile persistence via Firebase Firestore
- π Community-Driven Database: Users submit unknown products β Admins approve β Available globally
- π‘οΈ Admin System: Role-based admin panel for product review and user management
Scan Barcode
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββ
β 1. Check user's custom_products/{barcode} β
β 2. Check global_products/{barcode} β
β 3. Check local Hive DB (20k foods) β
β 4. Check Open Food Facts API β
ββββββββββββββββββββββββββββββββββββββββββββββββ
β β
Found Not Found
β β
βΌ βΌ
Analyze & βββββββββββββββ
Show Verdict β Try Again β
β Add Manuallyβ
ββββββββ¬βββββββ
β
βΌ
Save to pending_products/{barcode}
Save to user custom_products/{barcode}
β
βΌ
Admin Reviews & Approves
β
βΌ
Moved to global_products/{barcode}
β
βΌ
β
Available to ALL users forever
- Camera-based barcode detection with
mobile_scanner - 4-phase fallback data acquisition (Custom β Global β Hive β API)
- Automatic caching of API results for future offline use
- Weighted Risk Algorithm that factors in diabetes, hypertension, PCOS, allergies
- Specialized Gym/Fitness Mode with protein density scoring
- Vegan/Vegetarian dietary compliance checks
- Instant allergen detection with fail-safe blocking
- When a scan finds no data, users can contribute product information
- Barcode is the primary key β no random UUIDs
- Saves to both
pending_products(for admin review) andcustom_products(for immediate user access) - Duplicate barcode detection prevents duplicates
- Validation: Sugar (0β100g), required fields enforced
- Role-based access β visible only when
users/{uid}.role == "admin" - Pending Products tab β real-time stream with live count badge
- Approve β copies full document from
pending_productstoglobal_products(batch write) - Reject β deletes from
pending_products - Users tab β list all users with health profiles and conditions
- Fresh Firestore read on approve to prevent data loss from stale snapshots
- Complete health profile: age, weight, height, conditions, allergies, diet type
- Synced to Cloud Firestore for multi-device access
- Role field (
user|admin) for access control
- Scan history persisted in
users/{uid}/history - Recent scans displayed on home screen
- Full history view with streak tracking
| Technology | Purpose |
|---|---|
| π Flutter | Cross-platform UI framework |
| π Hive | High-performance offline food database (O(1) barcode lookup) |
| π₯ Firebase Auth | User authentication |
| βοΈ Cloud Firestore | User profiles, pending/global products, scan history |
| π’ Node.js | Optional regional food API server |
| π MongoDB | Optional backend data store |
| π‘οΈ DotEnv | Secure credentials management |
git clone git@github.com:abhi-jithb/NutriDecide.git
cd NutriDecideflutter pub get- Ensure
android/app/google-services.jsonis present - Create a
.envfile in root:
BACKEND_URL=https://your-api.onrender.com/api
flutter runIn Firebase Console β Firestore β users/{your-uid} β set field:
{ "role": "admin" }lib/
βββ app.dart # MaterialApp with theme management
βββ main.dart # Entry point
βββ core/
β βββ data/
β β βββ food_database_service.dart # Hive-based offline food DB
β β βββ admin_repository.dart # Admin Firestore operations
β βββ theme/app_theme.dart # Material 3 design system
β βββ services/
β β βββ app_initializer.dart # Parallel boot sequence
β β βββ global_error_handler.dart # Production crash protection
β βββ presentation/splash_screen.dart
βββ features/
β βββ admin/
β β βββ admin_panel_screen.dart # Admin review panel (approve/reject)
β βββ auth/
β β βββ services/auth_service.dart
β β βββ presentation/ # Login, Signup, Profile Setup
β βββ scan/
β β βββ scan_screen.dart # Camera scanner
β β βββ models/
β β β βββ nutrition_data.dart # Product data model
β β β βββ scan_history_item.dart
β β βββ services/
β β β βββ nutrition_service.dart # 4-phase data lookup
β β β βββ scoring_engine.dart # Risk score calculator
β β β βββ ingredient_analyzer.dart # Additive detection
β β βββ data/scan_repository.dart # Scan history persistence
β β βββ presentation/
β β βββ verdict_screen.dart # Results display
β β βββ manual_entry_screen.dart # Manual product form
β β βββ history_screen.dart # Scan history
β βββ home/home_screen.dart # Dashboard
β βββ profile/ # Health DNA profile
β βββ settings/settings_screen.dart # Preferences + admin access
β βββ navigation/bottom_nav_screen.dart
| Collection | Purpose | Access |
|---|---|---|
users/{uid} |
User profile + role | Owner only (admin can read all) |
users/{uid}/history/{id} |
Scan history | Owner only |
users/{uid}/custom_products/{barcode} |
User's pending submissions | Owner only |
pending_products/{barcode} |
Products awaiting admin review | Auth create, Admin read/delete |
global_products/{barcode} |
Admin-approved products | Auth read, Admin write |
- Manual Product Entry: Barcode-linked form with validation and duplicate detection
- Admin Panel: Two-tab admin interface with real-time pending count badges
- Global Product Registry: Admin approve/reject workflow with batch Firestore writes
- Role Management:
user/adminroles via Firestore with conditional UI rendering - 4-Phase Lookup: custom_products β global_products β Hive β Open Food Facts API
- Firestore Security Rules: Full coverage for all new collections with admin guard functions
- Safety Fixes: Fresh Firestore read on approve, duplicate barcode guard on submit
- Hive Migration: Replaced JSON loading with binary-indexed Hive boxes for O(1) lookup
- Cloud Architecture: Firebase Auth + Cloud Firestore for multi-device profile sync
- UX Optimization: 1-Tap Scan logic with auto scanner restarts
- Crash Protection: GlobalErrorHandler and error boundaries
- Legal Compliance: Medical Disclaimer and Privacy Policy screens
- Offline Data System: Native scan against local dataset
- Ingredient Analyzer: Advanced regex for red-line additives (MSG, E-numbers)
- Gym Mode: Specialized auditing for sweeteners and protein density
π₯ NutriDecide Β· Community-Driven Health Intelligence Β· Built with Flutter & Firebase
Preventive health, reimagined.