A React Native Expo app for tracking daily protein intake with real-time cloud synchronization.
- 📊 Home Screen: View daily protein consumption and remaining allowance below your limit
- 🔐 User Authentication: Secure login with Firebase Authentication
- ☁️ Cloud Sync: Real-time data synchronization across all your devices
- 👥 Collaborative Tracking: Share your account with others for real-time collaboration
- 📷 Scan Screen: Use barcode scanner to scan food items (requires camera permissions)
- ➕ Add Meal Screen: Manually add foods with name, protein per 100g, and grams eaten
- ⚙️ Settings Screen: Configure daily protein limit and manage your account
- React Native with Expo
- TypeScript for type safety
- Expo Router for navigation (tab-based navigation)
- Zustand for global state management
- Firebase Authentication for user login
- Cloud Firestore for real-time data synchronization
- AsyncStorage for local data persistence and offline access
- Expo Camera & Barcode Scanner for scanning barcodes
- EAS Update for over-the-air (OTA) updates
- StyleSheet for styling (following React Native best practices)
-
Clone the repository:
git clone https://github.com/Reivaxmar/protein-tracker.git cd protein-tracker -
Install dependencies:
npm install
-
Set up Firebase (required for authentication and cloud sync):
- Follow the detailed guide in FIREBASE_SETUP.md
- Configure your Firebase credentials in
/config/firebase.ts
-
Start the development server:
npm start
-
Run on your device:
- iOS: Press
iin the terminal or scan the QR code with the Camera app - Android: Press
ain the terminal or scan the QR code with the Expo Go app - Web: Press
win the terminal
- iOS: Press
protein-tracker/
├── app/ # Expo Router screens
│ ├── _layout.tsx # Root layout with tab navigation
│ ├── index.tsx # Home screen
│ ├── add-meal.tsx # Add meal screen
│ ├── scan.tsx # Barcode scanner screen
│ └── settings.tsx # Settings screen
├── store/
│ └── proteinStore.ts # Zustand store with AsyncStorage
├── types/
│ └── index.ts # TypeScript type definitions
├── utils/
│ ├── helpers.ts # Helper functions
│ └── api.ts # OpenFoodFacts API integration
└── assets/ # App icons and images
- View your daily protein limit
- See total protein consumed today
- Check remaining allowance below your limit
- View all meals added today
- Progress bar shows percentage of daily limit (with warnings when approaching or exceeding)
- Enter the food name
- Enter protein per 100g (check food labels)
- Enter grams eaten
- The app automatically calculates total protein
- Tap "Add Meal" to save
- Grant camera permissions when prompted
- Point camera at a food barcode
- The app automatically queries the OpenFoodFacts database
- View detailed product information including:
- Product name and brand
- Protein content per 100g
- Other nutrients (energy, carbs, fat, fiber, etc.)
- Enter the quantity you ate (in grams)
- See the calculated total protein
- Tap "Add to Meal" to save the food to your daily log
- The meal is automatically saved and your daily protein total is updated
- Set your daily protein limit to help manage your protein intake
- Change app language (English/Spanish)
- Manage meal tags
- Export your data via email
- View your logged-in account
- Logout from your account
- Create an account with email and password
- Secure login with Firebase Authentication
- Password must be at least 6 characters
- All your data (meals, recipes, ingredients, settings) is automatically synced to the cloud
- Data is updated in real-time across all your logged-in devices
- Changes made on one device appear instantly on all other devices
- Offline support: Data is cached locally and synced when you're back online
- Share your account credentials with family members or friends
- Multiple people can log in with the same account on different devices
- Everyone sees the same data and updates in real-time
- Perfect for couples or families tracking protein intake together
- Your data is private and secure
- Only you (and those you share credentials with) can access your data
- Each user's data is isolated in Firebase Firestore
- All communication is encrypted via HTTPS
For detailed Firebase setup instructions, see FIREBASE_SETUP.md.
All meals and settings are automatically saved both locally (using AsyncStorage) and to the cloud (using Firebase Firestore). Your data persists even after closing the app and is synchronized across all your devices.
The app uses Zustand for global state management with the following features:
- Track meals by date
- Calculate daily protein totals
- Persist data to AsyncStorage
- Update maximum protein limit
npx tsc --noEmitnpm startThis app is configured with EAS Update to deliver JavaScript and asset changes directly to users without requiring them to reinstall the app from the app store.
- The app automatically checks for updates on launch
- If an update is available, it downloads and applies it automatically
- Users will see the updated app on the next restart (or immediately if reloaded)
- Updates only work for JavaScript code and assets (images, fonts, etc.)
Native code changes still require a full rebuild and resubmission to app stores. This includes:
- Changes to
app.config.jsthat affect native configuration (permissions, plugins, etc.) - Adding or updating native modules or dependencies
- Modifying iOS or Android native code
- Changing the app icon or splash screen
- Updates to Expo SDK version
To publish an OTA update:
- Make your JavaScript or asset changes
- Run the following command:
eas update --branch production --message "Your update message" - Users will receive the update the next time they open the app
The app uses different update channels for different environments:
- production: Live app updates for production builds
- preview: Testing updates before production release
OTA updates are configured in:
app.config.js: Runtime version and update URLeas.json: Build profiles and update channelsapp/_layout.tsx: Update check logic on app launch
For detailed setup instructions, see EAS_SETUP.md.
For deployment instructions (web and native), see DEPLOY.md.
For more information, see the Expo Updates documentation.
See LICENSE file for details.