Scan any food product. Know what's actually in it.
NutriScan combines barcode scanning, OCR, and AI to give you an instant ingredient safety verdict — green, yellow, or red.
Point your camera at a barcode and NutriScan pulls the full product data from Open Food Facts, then runs the ingredient list through Gemini for an AI-powered safety verdict. No barcode? The OCR fallback reads the label directly. Every scan is saved to your personal history in Firestore.
| Feature | Details |
|---|---|
| 🔐 Auth | Firebase email/password |
| 📷 Scanning | Mobile Scanner (barcode) + ML Kit (OCR fallback) |
| 🌐 Product Data | Open Food Facts API |
| 🤖 AI Analysis | Gemini — traffic-light verdict (🟢 / 🟡 / 🔴) |
| 🗂️ History | Per-user scan history in Cloud Firestore |
| 💾 Local State | Onboarding + profile via SharedPreferences |
Flutter + Dart
├── Firebase Core, Auth, Firestore
├── Open Food Facts API
├── Gemini API (google_generative_ai)
├── Google ML Kit Text Recognition
└── SharedPreferences
lib/
├── main.dart # App entry and routing
├── screens/ # UI screens
├── services/ # Auth, Firestore, Gemini, OCR, Open Food Facts
├── models/ # Domain models
└── widgets/ # Reusable UI components
Before you start: This repo ships with no API keys and no Firebase config. You bring your own.
- Flutter SDK
- Android Studio or Xcode
- A Firebase project you control
- A Gemini API key
git clone https://github.com/ShubhZ06/NutriScan.git
cd NutriScan
flutter pub get- Create a Firebase project and enable Authentication (Email/Password) and Firestore.
- Add an Android app — use your package name.
- Download
google-services.json→ place it atandroid/app/google-services.json. - For iOS/macOS, add an Apple app and place
GoogleService-Info.plistatios/Runner/GoogleService-Info.plist.
Both config files are git-ignored. Never commit them.
Seeandroid/app/google-services.example.jsonfor the expected file structure.
Copy the example env file and fill in your values:
cp .env.example .env.local# .env.local
GEMINI_API_KEY=your_gemini_api_key
GEMINI_MODEL=gemini-2.5-flashRun the app:
flutter run --dart-define-from-file=.env.localOr pass defines inline:
flutter run \
--dart-define=GEMINI_API_KEY=your_gemini_api_key \
--dart-define=GEMINI_MODEL=gemini-2.5-flashflutter build apk --release --dart-define-from-file=.env.local- Never commit API keys, Firebase config files, or signing keystores.
- Keep all secrets in local, git-ignored files (
.env.local,google-services.json,GoogleService-Info.plist). - If a key was ever committed — even briefly — rotate it immediately.
- Use a separate Firebase project for dev/test work.
See SECURITY.md for the full disclosure and handling policy.
Contributions are welcome. Quick flow:
- Fork the repo and create a feature branch.
- Implement your changes with tests where possible.
- Make sure
flutter analyzepasses and all tests are green. - Open a PR with a clear summary of what changed and why.
See CONTRIBUTING.md for full guidelines.
Licensed under the terms in LICENSE.