Skip to content

mattlee24/nutritrack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

NutriTrack

NutriTrack

AI-powered calorie & nutrition tracking for iOS and Android

React Native Expo TypeScript Supabase NativeWind


πŸ“– Overview

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.


πŸ›  Technology Stack

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

✨ Features

πŸ” 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.

πŸ“Š Today Dashboard

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).

🍎 Food Logging

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.

πŸ“ˆ Progress & History

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).

⏱ Fasting

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.

πŸ‘€ Profile & Settings

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.

πŸ—„ Data Model

Core Tables

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.

Security

  • 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.

Migrations

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.

🎨 Design System

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).

βš™ Configuration

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.

πŸ“„ License

Proprietary. All rights reserved.


NutriTrack β€” nutrition tracking, simplified.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors