Nutrition Plans & Tracker

Dual-sided nutrition system: trainers create structured meal plans with macros and ingredients, while clients track daily food intake, water consumption, and progress toward their nutritional goals.

Overview

The Nutrition feature has two distinct sides. On the trainer side, it provides a plan builder for creating structured meal plans organized by day, with individual meals (breakfast, lunch, dinner, snacks) containing ingredients with full macro breakdowns (calories, protein, carbs, fats). These plans can be saved as templates and assigned to clients as part of their training program.

On the client side, the nutrition tracker enables daily food logging with a searchable common foods database, serving size adjustments, and macro calculations. Clients set customizable daily goals for calories, protein, carbs, and fats, then track their intake throughout the day with visual progress bars showing consumed vs. goal values. The tracker also includes water intake tracking (cups per day) and a daily streak counter to encourage consistency.

The food database is pre-populated with common foods including nutritional data per standard serving. Clients can save favorite foods for quick re-logging and search the database to add custom entries. Weekly progress summaries help clients and trainers evaluate adherence over time.

User Stories

Trainer Stories

As a trainer, I want to create structured meal plans with daily meals and ingredients so that my clients have clear nutrition guidance.

As a trainer, I want to specify macros (calories, protein, carbs, fats) for each meal so that clients can track their nutritional intake accurately.

As a trainer, I want to save meal plan templates so that I can quickly assign them to multiple clients with similar goals.

As a trainer, I want to assign nutrition plans to clients alongside their workout programs so that they get a complete training package.

Client Stories

As a client, I want to set daily calorie and macro goals so that I can track my nutrition against personalized targets.

As a client, I want to log food by meal type (breakfast, lunch, dinner, snacks) so that I can see my intake breakdown throughout the day.

As a client, I want to search a common foods database and add items quickly so that logging meals is fast and easy.

As a client, I want to save favorite foods for quick re-logging so that I can add my regular meals in seconds.

As a client, I want to see a daily summary with progress bars for each macro so that I know at a glance how close I am to my goals.

As a client, I want to track my water intake and see my daily streak so that I stay motivated and consistent.

Data Model

Table Key Columns Description
nutrition_goals id, user_id, daily_calories, daily_protein_g, daily_carbs_g, daily_fats_g, daily_water_cups, created_at, updated_at Customizable daily macro and hydration targets per user.
food_log_entries id, user_id, food_name, meal_type, calories, protein_g, carbs_g, fats_g, serving_size, serving_unit, log_date, created_at Individual food log entries per day. Meal types: breakfast, lunch, dinner, snack.
common_foods id, name, calories, protein_g, carbs_g, fats_g, serving_size, serving_unit, category Pre-populated food database with standard nutritional data per serving.
favorite_foods id, user_id, food_name, calories, protein_g, carbs_g, fats_g, serving_size, serving_unit User-saved favorites for quick re-logging.
program_meals id, program_id, meal_name, meal_type, day_number, ingredients, calories, protein_g, carbs_g, fats_g, instructions Trainer-created meal plans within programs. Structured by day and meal type.

Client Tracker Features

Daily Goals Dashboard

Visual progress bars showing calories, protein, carbs, and fats consumed vs. daily targets. Color-coded feedback (under, on track, over).

Meal-Based Logging

Log food entries by meal type: Breakfast, Lunch, Dinner, Snacks. Each entry captures food name, serving size, and full macro breakdown.

Food Database Search

Searchable common foods database with quick-add functionality. Pre-populated with items like chicken breast, brown rice, eggs, salmon, broccoli, etc.

Favorite Foods

Save frequently logged foods for instant re-logging. One-tap add from favorites list to any meal category.

Water Intake Tracking

Track daily water consumption in cups. Visual counter with daily goal (default 8 cups). Quick-add buttons for easy logging.

Streak & Progress

Daily logging streak counter to motivate consistency. Weekly progress views showing trends across all macro categories.

Sample Common Foods

Food Calories Protein Carbs Fats Serving
Chicken Breast16531g0g3.6g100g
Brown Rice2155g45g1.8g1 cup cooked
Banana1051.3g27g0.4g1 medium
Eggs786g0.6g5g1 large
Almonds1646g6g14g1 oz
Sweet Potato1032.3g24g0.1g1 medium
Salmon20820g0g13g100g
Broccoli553.7g11g0.6g1 cup

Screens & Routes

Route File Description
/nutrition src/routes/_authed/_onboarded/_client/nutrition.tsx Client nutrition tracker — daily goals dashboard, food logging, water tracking, streak counter

Acceptance Criteria

Client Tracker

Trainer Meal Plans

API Surface

The nutrition API is planned but not yet implemented. The following server functions and hooks are expected based on the data model and feature requirements.

Planned Server Functions

GET getNutritionGoals — Fetch user's daily macro targets

POST upsertNutritionGoals — Create or update daily targets

GET getFoodLogEntries — Fetch entries for a given date

POST addFoodLogEntry — Log a food item to a meal

POST deleteFoodLogEntry — Remove a logged food item

GET searchCommonFoods — Search the common foods database

GET getFavoriteFoods — Fetch user's saved favorites

POST addFavoriteFood — Save a food to favorites

POST removeFavoriteFood — Remove from favorites

Planned Query Keys

nutritionKeys.all → ['nutrition']

nutritionKeys.goals() → ['nutrition', 'goals']

nutritionKeys.foodLog(date) → ['nutrition', 'food-log', date]

nutritionKeys.favorites() → ['nutrition', 'favorites']

nutritionKeys.commonFoods(query) → ['nutrition', 'common-foods', query]

Current Status

Built
  • Nutrition page UI with mock data
  • Daily goals display (calories, protein, carbs, fats)
  • Meal-based food log display
  • Common foods sample data
  • Water intake tracker UI
  • Database tables defined (program_meals)
In Progress
  • Database schema for nutrition_goals, food_log_entries, common_foods, favorite_foods
  • Common foods seed data (USDA-sourced)
Not Started
  • API server functions (all CRUD)
  • React Query hooks
  • Food search integration
  • Favorite foods system
  • Streak counter logic
  • Weekly progress view
  • Trainer meal plan builder
  • Meal plan assignment to clients