A comprehensive nutrition analysis platform that helps users track their nutritional intake by analyzing food product labels and meals using AI. Built with a Flutter frontend and Spring Boot backend, leveraging Google Cloud's Vertex AI for intelligent food analysis.
- πΈ Scan product labels and food items using your device's camera
- π AI-powered nutrition analysis using Google Cloud Vertex AI
- π Track daily nutrient intake with detailed breakdowns
- π View historical food consumption data
- π Visual representations of macronutrient distribution
- π€ User profiles with personalized dietary preferences and health metrics
- β‘ Real-time nutritional insights and recommendations
- π Secure Firebase authentication integration
- π Cross-platform support with synchronized data
FoodScanAI_Recording.mp4
![]() |
![]() |
![]() |
---|---|---|
![]() |
![]() |
![]() |
Food Scan AI follows a modern, scalable architecture:
- Frontend: Flutter mobile app with MVVM architecture
- Backend: Spring Boot RESTful API service
- Database: PostgreSQL for persistent storage
- Authentication: Firebase Authentication
- AI Analysis: Google Cloud Vertex AI (Gemini 2.0 Flash)
- Cloud Infrastructure: Google Cloud Platform
/
βββ flutter-app/ # Flutter frontend application
β βββ lib/
β β βββ core/ # App-wide constants
β β βββ config/ # Environment configuration
β β βββ models/ # Data models
β β βββ repositories/ # Data access layer with interfaces
β β βββ services/ # Business logic services
β β βββ theme/ # App theme definitions
β β βββ viewmodels/ # ViewModels for business logic
β β βββ views/ # UI components
β β β βββ screens/ # Full page views
β β β βββ widgets/ # Reusable UI components
β β βββ main.dart # Application entry point
β βββ assets/ # App resources (images, fonts, etc.)
β
βββ spring-backend/ # Spring Boot backend service
βββ src/
β βββ main/
β β βββ java/com/scanmyfood/backend/
β β β βββ configurations/ # App configs
β β β βββ controllers/ # REST API endpoints
β β β βββ models/ # Data entities
β β β βββ repositories/ # Database access
β β β βββ services/ # Business logic
β β β βββ ScanMyFoodBackendApplication.java
β β βββ resources/ # Application properties
β βββ test/ # Unit and integration tests
βββ pom.xml # Maven dependencies
- Flutter SDK (>=3.4.3)
- Java JDK 17+
- Maven 3.6+
- PostgreSQL 14+
- Firebase project with Authentication enabled
- Google Cloud project with Vertex AI API enabled
- Clone the repository
git clone https://github.com/nikhileshmeher0204/read_the_label.git
cd read_the_label
- Navigate to the Flutter app directory
cd flutter-app
-
Set up Firebase
- Create a Firebase project at firebase.google.com
- Add Android and iOS apps to your project
- Download and add the configuration files (
google-services.json
for Android andGoogleService-Info.plist
for iOS) - Enable Authentication with Email/Password provider
-
Create a
.env
file in the Flutter app directory:
# Optional local development URL (if not using default)
API_BASE_URL=http://localhost:8080/api
- Install dependencies
flutter pub get
- Run the app
flutter run
- Navigate to the Spring Boot backend directory
cd spring-backend
-
Configure Google Cloud credentials
- Create a service account in your Google Cloud project
- Grant it access to Vertex AI API
- Download the service account key file as
firebase-service-account.json
- Place it in
src/main/resources/
-
Configure PostgreSQL
- Create a PostgreSQL database named
scanmyfood
- Update database connection details in
application.properties
if needed:
- Create a PostgreSQL database named
spring.datasource.url=jdbc:postgresql://localhost:5432/scanmyfood
spring.datasource.username=your_username
spring.datasource.password=your_password
- Build and run the Spring Boot application
# Using Maven
mvn spring-boot:run
# Or using the Maven wrapper
./mvnw spring-boot:run
This application uses a combination of state management approaches:
-
Frontend: Provider for Flutter app state management
- ViewModels:
UiViewModel
: Handles UI state and navigationProductAnalysisViewModel
: Manages product scanning and analysisMealAnalysisViewModel
: Handles food image analysisDailyIntakeViewModel
: Controls daily consumption trackingOnboardingViewModel
: Manages user onboarding flow
- ViewModels:
-
Backend: Spring services for business logic
UserService
: User profile and preferences managementVertexAiServiceImpl
: AI analysis implementation- Authentication handled via Firebase integration
- Flutter SDK (>=3.4.3)
- Dart SDK
- Firebase Authentication for user management
- Provider for state management
- SharedPreferences for local storage
- Material Design 3 with custom theme
- Key Flutter packages:
image_picker
for camera integrationflutter_dotenv
for environment variablesfl_chart
for data visualizationrive
for animationshttp
for API communication
- Spring Boot 3.4.5 for RESTful API development
- Spring Data JPA for database operations
- PostgreSQL for data persistence
- Google Cloud Vertex AI for AI-powered analysis
- Firebase Admin SDK for authentication verification
- Maven for dependency management
- Google Cloud Platform:
- Vertex AI (Gemini 2.0 Flash model)
- Firebase Authentication
- Cloud Storage (optional for production)
- Build the Flutter app for production:
flutter build apk --release # for Android
flutter build ios --release # for iOS
- Package the Spring Boot application:
mvn clean package
- Deploy the resulting JAR file to your server or cloud provider
- Real-time data synchronization between devices
- Advanced meal planning with AI recommendations
- Barcode scanning for quick product lookup
- Machine learning for personalized nutritional insights
- Dietary goal tracking and achievement rewards
- Social sharing and community features
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Google Cloud Vertex AI for powerful AI capabilities
- Spring Boot team for the excellent backend framework
- Flutter team for the amazing cross-platform UI toolkit
- Firebase for seamless authentication
- PostgreSQL for reliable data storage