AI-powered calorie & nutrition tracking for iOS and Android
NutriTrack is a mobile-first application for tracking daily nutrition, water intake, weight, and intermittent fasting. Users complete a guided onboarding flow to set profile and goals, then use a Today dashboard to log meals and water, view macro progress, and—when configured—monitor fasting windows. Additional tabs provide Log history, Progress charts, a Fasting timer, and Profile settings. The app supports barcode scanning (Open Food Facts), manual and AI-assisted food entry, and optional Fitbit integration for steps and activity.
Layer
Technologies
Framework
React 19, React Native 0.81, Expo SDK 54
Language
TypeScript 5.9
Routing
Expo Router (file-based)
Styling
NativeWind (Tailwind CSS), Moti (animation)
State
Zustand, TanStack React Query
Forms & validation
React Hook Form, Zod
Charts
Victory Native
Backend
Supabase (PostgreSQL, Auth, RLS)
Auth
Supabase Auth (email/password, optional Apple Sign-In)
Secrets
Expo Secure Store
calorie-tracker/
├── README.md
└── nutritrack/
├── app/ # 📱 Expo Router screens
│ ├── (auth)/ # 🔐 Auth group
│ │ ├── welcome.tsx
│ │ ├── sign-in.tsx
│ │ ├── sign-up.tsx
│ │ ├── forgot-password.tsx
│ │ └── onboarding/ # 👤 Multi-step onboarding
│ │ ├── step-1-profile.tsx
│ │ ├── step-2-goals.tsx
│ │ ├── step-3-activity.tsx
│ │ └── step-4-fasting.tsx
│ ├── (tabs)/ # 📊 Main app tabs
│ │ ├── index.tsx # Today
│ │ ├── log.tsx
│ │ ├── progress.tsx
│ │ ├── fasting.tsx
│ │ └── profile.tsx
│ ├── add-food/ # 🍎 Add food flows
│ │ ├── search.tsx
│ │ ├── barcode.tsx
│ │ ├── camera.tsx
│ │ └── manual.tsx
│ ├── food/[id].tsx # Food item detail
│ ├── _layout.tsx # Root layout & auth gate
│ └── app.config.js
├── components/
│ ├── auth/ # HeroIllustration, AuthPrimaryButton
│ ├── dashboard/ # CalorieRing, MacroBar
│ ├── modals/ # AppAlert, EditGoalModal
│ ├── onboarding/ # OnboardingStep, FastingWindowArc
│ └── ui/ # Button, Card, SelectCard, StyledInput, DatePickerModal
├── constants/ # theme.ts, colors, spacing, strings
├── hooks/ # useTodayData, useUnits, useFastingTimer
├── lib/ # calculations, units, weightLog, food, auth, supabase
├── stores/ # useAuthStore, useFastingStore, useGoalsStore
├── types/ # Profile, FoodItem, FoodLogEntry, enums
├── assets/ # icon, splash, favicon, Android adaptive icons
└── supabase/
└── migrations/ # PostgreSQL schema & RLS
🔐 Authentication & Onboarding
Feature
Description
Welcome
Entry screen with sign-in and sign-up; optional hero/illustration.
Email / password
Supabase Auth; secure session handling.
Apple Sign-In
Optional, via Expo Apple Authentication.
Onboarding
Multi-step: profile (name, DOB, sex, height, weight) → goals (lose/maintain/gain, target weight, weekly pace) → activity level → optional fasting (protocol, eating window).
Forgot password
Reset flow via Supabase.
Profile creation
Database trigger creates profiles row on signup; onboarding completion stored on profile.
Element
Description
Calorie ring
Daily intake vs goal (from profile).
Macro bar
Protein, carbs, fat progress.
Meal cards
Breakfast, Lunch, Dinner, Snacks with per-meal calories and quick-add.
Water
Logged amount vs goal; unit (ml/oz) from profile.
Date picker
View another day’s summary.
Greeting
Time-based (e.g. Good morning/afternoon/evening).
Method
Description
Search
In-app search over user + global food items; recent and favourites.
Barcode
Scan product barcode; lookup via Open Food Facts; save as food item.
Camera
Capture-based flow for adding foods.
Manual
Custom foods: name, brand, serving size, per-100g macros.
Log entry
Date, meal type, serving amount/unit, computed calories and macros; optional link to food_items.
Favourites & recent
Quick re-logging.
Screen
Description
Log
History of food and water (and weight where shown).
Progress
Weight and nutrition trends (Victory Native charts).
Weight log
Optional weight entries with date and notes (weight_log).
Feature
Description
Fasting tab
Current session, timer, protocol (e.g. 16:8).
Fasting config
Protocol, eating window start/end, fasting days, notifications (schema).
Fasting sessions
Start/end time, target duration, completed, notes.
Feature
Description
Profile tab
Edit profile, goals, preferences.
Unit preferences
Metric/imperial; per-measurement: weight (kg/lbs), height (cm/ft), water (ml/oz).
Goal editing
Calorie and macro targets (e.g. EditGoalModal).
Theme
Dark mode and related settings on profile.
Integration
Description
Fitbit
fitbit_connections (tokens, user id), fitbit_daily_data (steps, calories burned, active minutes, distance, heart rate, sleep); RLS enforced.
Table
Purpose
profiles
Extends auth users: demographics, goals (calorie, protein, carbs, fat, water, steps), activity level, unit preferences, onboarding completion, theme.
food_items
User and global foods: name, brand, barcode, serving size/unit, per-100g macros, source (manual, openfoodfacts, ai), favourite.
food_log_entries
User log: date, meal type, serving amount/unit, calories and macros, optional food_item_id.
water_log
User, date, amount_ml.
weight_log
User, date, weight_kg, notes.
fasting_sessions
User, start/end time, target duration, protocol, completed, notes.
fasting_config
User, protocol, eating window, fasting days, notifications.
fitbit_connections
User, Fitbit user id, tokens, last synced.
fitbit_daily_data
User, date, steps, calories_burned, active_minutes, distance_km, heart rate, sleep.
Row Level Security (RLS) enabled on all tables.
Policies restrict access to auth.uid(); food_items allows read of global (user_id IS NULL) items.
Triggers: handle_new_user creates profile on signup; set_updated_at maintains updated_at on profiles.
Migration
Description
20250101000000_initial_schema.sql
Tables, indexes, RLS policies, triggers.
20260310000000_add_unit_preferences.sql
Adds weight_unit, height_unit, water_unit to profiles; backfills from unit_system for imperial users.
Token
Usage
ThemeColors
background, surface, primary (#5B5BD6), accent (green, amber, red, blue), text (primary/secondary/tertiary), border, shadow.
Typography
Outfit (display, semibold, medium), Inter (body).
cardShadow
Consistent shadow for white cards.
Components
Reusable UI in components/ui; feature components in auth, dashboard, modals, onboarding.
Icons
@expo/vector-icons (e.g. Ionicons).
Area
Details
Expo
app.json / app.config.js: name, slug, scheme, orientation, camera permission copy, icons, splash, iOS/Android/Web.
NativeWind
tailwind.config.js, global.css, custom Babel preset.
TypeScript
Strict typing; shared types in types/index.ts.
Environment
Supabase URL and anon key (and optional Fitbit/OpenAI) via env; .env is gitignored.
Proprietary. All rights reserved.
NutriTrack — nutrition tracking, simplified.