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
π Repository Structure
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.
π Integrations (Schema)
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.