π± NutriTrack is a sophisticated Android nutrition tracking application built with modern Android development tools and libraries. The app provides personalized nutrition coaching through AI, comprehensive user insights, and specialized tools for healthcare professionals.
- π Features
- ποΈ Architecture
- π Documentation
- π οΈ Technology Stack
- π Getting Started
- π± Usage
- π§ͺ Testing
- π Performance
- π Security
- π Accessibility
- π¨ Troubleshooting
β οΈ Known Limitations- π€ Contributing
- π License
- π₯ Team
- π Support
- π Version History
- π Future Enhancements
- User Authentication & Registration: Secure user management with BCrypt password hashing
- Personalized Questionnaires: Multi-step onboarding to capture user preferences and personas
- Profile Management: Customizable user profiles with dietary preferences
- AI Nutrition Coach: Real-time chat with Gemini AI for personalized advice
- Smart Recommendations: AI-powered meal suggestions based on user goals
- Progress Tracking: Intelligent insights into nutrition patterns
- Score Tracking & Insights: Comprehensive nutrition scoring with historical data
- Visual Analytics: Charts and graphs for progress visualization
- Goal Setting: Customizable nutrition and health goals
- Clinician Dashboard: Professional tools for healthcare providers
- Patient Management: Monitor multiple patients with detailed analytics
- Export Functionality: Generate reports for further analysis
- Dark/Light Theme: Modern Material Design 3 with automatic theme switching
- Offline-First: Full functionality without internet connection
- Responsive Design: Optimized for various screen sizes and orientations
The application follows Clean Architecture principles with:
βββ Presentation Layer (View)
β βββ Composable UI Components
β βββ Screen Composables
β βββ Navigation Setup
βββ Business Logic Layer (ViewModel)
β βββ State Management
β βββ Business Rules
β βββ User Interactions
βββ Data Layer (Model)
βββ Room Database
βββ Repository Pattern
βββ Network APIs
βββ Data Sources
This project includes comprehensive documentation covering all aspects of the application:
The main documentation file covering:
- Application overview and architecture
- Getting started guide
- Navigation system
- Data layer (entities, DAOs, repositories)
- ViewModels and state management
- UI components and screens
- Utilities and helper classes
- API integration
- Theme and styling
- Usage examples with code samples
ποΈ Database Documentation
Detailed database documentation including:
- Database schema and entity relationships
- Room configuration and migrations
- DAO interfaces with all available methods
- Repository pattern implementation
- Type converters and database initialization
- Performance optimization strategies
- Usage examples for database operations
Comprehensive UI components guide covering:
- Core reusable components (ScoreProgressBar, TimePickerComponent, etc.)
- Navigation components (BottomNavigationBar, TopAppBar)
- Authentication components (AuthenticationButton, UserIdDropdown)
- Form components with validation
- Chart components for data visualization
- Animation components and page transitions
- Best practices for component composition
- Accessibility and performance guidelines
ποΈ ViewModels Documentation
Complete ViewModels and state management guide including:
- MVVM architecture implementation
- State management patterns with UiState
- Dependency injection with ViewModelProviderFactory
- Detailed documentation for all ViewModels:
- AuthViewModel (authentication and registration)
- GenAIViewModel (AI chat functionality)
- QuestionnaireViewModel (multi-step questionnaire)
- ClinicianDashboardViewModel (healthcare professional tools)
- UserStatsViewModel (statistics and scoring)
- Testing strategies for ViewModels
- Performance optimization techniques
- Language: Kotlin 2.0.21
- UI Framework: Jetpack Compose with Material Design 3
- Architecture: MVVM with Repository pattern
- Database: Room with SQLite
- Navigation: Navigation Compose
- Async Programming: Coroutines and Flow
- Minimum SDK: 31 (Android 12)
- Target SDK: 35 (Android 14)
- AI Integration: Google Generative AI (Gemini)
- Image Loading: Coil for Compose
- Networking: Retrofit with Gson converter
- Security: BCrypt for password hashing
- Splash Screen: AndroidX Core SplashScreen
- Dependency Injection: Manual DI with Factory pattern
- Build System: Gradle with Kotlin DSL
- Code Generation: KSP (Kotlin Symbol Processing)
- Database Schema: Room with auto-generated DAOs
- Android Studio Hedgehog or newer
- Android SDK API 31 or higher
- Kotlin 2.0.21 or newer
- Google Gemini API key
-
Clone the repository
git clone https://github.com/your-username/nutritrack.git cd nutritrack -
Set up API keys Create a
secrets.propertiesfile in the root directory:API_KEY=your_gemini_api_key_here MAPS_API_KEY=your_google_maps_api_key_here
Note: The MAPS_API_KEY is required for potential future location-based features.
-
Build and run
./gradlew build ./gradlew installDebug
The app requires minimal configuration:
- API Keys: Add your Gemini AI API key to
secrets.properties - Database: Automatically initialized on first run with sample data
- Permissions: Internet permission for AI functionality
- Registration: Create an account or use existing user data
- Questionnaire: Complete the onboarding questionnaire to set preferences
- Home Dashboard: View nutrition scores and personalized insights
- AI Coach: Chat with the nutrition coach for personalized advice
- Insights: Track progress over time with detailed analytics
- Clinician Dashboard: Access specialized dashboard for patient overview
- Patient Management: View and monitor multiple patients
- AI Recommendations: Generate professional nutrition recommendations
- Data Export: Export patient data for further analysis
The project includes comprehensive testing strategies:
./gradlew test./gradlew connectedAndroidTest./gradlew connectedCheckThe app is optimized for performance with:
- Lazy Loading: Efficient list rendering with LazyColumn/LazyRow
- Database Indexing: Optimized queries with proper indexes
- Memory Management: Proper lifecycle-aware components
- Image Optimization: Efficient image loading with Coil
- Animation Performance: Hardware-accelerated animations
Security measures implemented:
- Password Hashing: BCrypt for secure password storage
- API Key Management: Secure API key handling with build variants
- Data Validation: Input validation at all layers
- SQL Injection Prevention: Parameterized queries with Room
The app follows Android accessibility guidelines:
- Content Descriptions: Proper content descriptions for screen readers
- Color Contrast: WCAG-compliant color contrast ratios
- Touch Targets: Minimum 48dp touch target sizes
- Keyboard Navigation: Full keyboard navigation support
Problem: Build fails with missing API key error
> Task :app:compileDebugKotlin FAILEDSolution:
- Ensure
secrets.propertiesfile exists in project root - Verify API_KEY is properly set
- Check for typos in property names
Problem: KSP processing fails
Could not resolve com.google.devtools.kspSolution:
- Update KSP version in
build.gradle.kts - Clean and rebuild project:
./gradlew clean build
Problem: App crashes on startup Solution:
- Check if all required permissions are granted
- Verify database initialization
- Check logcat for specific error messages
Problem: AI chat not working Solution:
- Verify internet connection
- Check Gemini API key validity
- Ensure API key has proper quotas
Problem: Data not persisting Solution:
- Check Room database version migrations
- Verify entity annotations
- Check database operations on main thread
- Check GitHub Issues
- Review the documentation files
- Enable debug logging in
local.properties:DEBUG_MODE=true
- Offline AI: AI features require internet connection
- Single Language: Currently supports English only
- Device Compatibility: Requires Android 12+ (API 31)
- Storage: Local database only (no cloud sync yet)
- User Accounts: No account recovery mechanism
- Large datasets may impact scrolling performance
- Image loading depends on network speed
- Database queries should be optimized for large user bases
- API keys stored in local.properties (not committed to repo)
- Passwords hashed with BCrypt (secure storage)
- No end-to-end encryption for chat messages
We welcome contributions! Please follow these steps:
-
Fork the Repository
git clone https://github.com/Eryc123Y/NutriTrack.git cd NutriTrack -
Create a Feature Branch
git checkout -b feature/amazing-feature
-
Make Your Changes
- Follow Kotlin coding conventions
- Add KDoc comments for public APIs
- Include unit tests for new features
- Update documentation as needed
-
Commit Your Changes
git commit -m 'feat: add amazing feature' -
Push and Open a Pull Request
git push origin feature/amazing-feature
- Kotlin Style: Follow official Kotlin conventions
- Naming: Use clear, descriptive names
- Documentation: KDoc for all public APIs
- Testing: Maintain 80%+ test coverage
- Commits: Use Conventional Commits
When reporting bugs, please include:
- Android device and OS version
- App version (v1.0.0)
- Steps to reproduce
- Expected vs actual behavior
- Logcat output if applicable
- FIT2081 - Monash University for the opportunity
- Google - For Gemini AI and Android development tools
- JetBrains - For the amazing Kotlin language
- Open Source Community - For the libraries and tools used
This project is licensed under the MIT License - see the LICENSE file for details.
- Developer: Xingyu Yang
- Student ID: 33533563
- Course: FIT2081 Assignment 1
For support and questions:
- Create an issue in the GitHub repository
- Check the documentation files for detailed information
- Review the code examples in the documentation
- Initial release with core functionality
- User authentication and registration
- AI-powered nutrition coaching
- Comprehensive questionnaire system
- Clinician dashboard
- Score tracking and insights
- π Push Notifications: Meal reminders and achievement notifications
- π Advanced Analytics: Detailed reports and nutrition insights
- βοΈ Cloud Sync: Secure data synchronization across devices
- π Fitness Integration: Connect with fitness trackers and health apps
- π Multi-language Support: Expand to Spanish, French, German
- πΈ Food Recognition: AI-powered food logging from photos
- π¬ Social Features: Community challenges and sharing
- β‘ Offline AI: Downloadable AI models for offline advice
- π¨ Custom Themes: More personalization options
- πΊ Wear OS Support: Companion app for smartwatches
- π§ Export/Import: Data portability features
- π± App Version: 1.0.0
- π Package ID: com.example.fit2081a1_yang_xingyu_33533563
- π¦ APK Size: ~15MB
- π― Minimum API: 31 (Android 12)
- π Target API: 35 (Android 14)
- π Complete API Documentation - Start here for a comprehensive overview
- ποΈ Database Documentation - Database schema and operations
- π¨ UI Components Documentation - UI components and design system
- ποΈ ViewModels Documentation - State management and business logic
Built with β€οΈ using modern Android development practices