workout-app

AI Build Reference — Minimal Nutrition + Workout Tracker iOS App

1. Product Vision

Build a native iOS health app inspired by the simplicity of a Notes app: the user should be able to open the app, type food in plain language, press return/done, and immediately see estimated calories, macros, and eventually micronutrients. The app should feel extremely fast, minimal, Apple-native, and low-friction.

The core differentiation versus simple calorie trackers is that this app combines:

  1. Natural-language food logging — “100g chicken breast”, “a banana”, “burger with fries”, etc.
  2. Structured nutrition intelligence — calories, protein, carbs, fat, water, fiber, sugar, vitamins, minerals, and confidence level.
  3. Internal nutrition database learning — once a food or ingredient has been resolved, it is saved in a standardized database so future logs can use cached/internal data before calling AI again.
  4. Workout logging that is actually useful — fast set-by-set workout tracking, predicted weights/reps based on history, workout templates, and progress insights.
  5. Apple Health-style insights — clean cards for food big picture, detailed nutrients, and workouts.

The app should not become bloated. The main user experience must stay as simple as writing notes.


2. Reference App / Inspiration

Reference: Mist — Nutrition Tracker / getmistapp.com.

Observed positioning from the website and App Store: Mist is marketed as a health/nutrition tracker that lets users track food and exercise quickly, like a notes app. It automatically calculates calories, supports macros, simple stats, and a minimal interface.

Important: do not clone branding, exact assets, copy, icons, or proprietary design. Use the concept of minimal note-like logging and build an original UI.

Screenshots provided as visual references

The attached screenshots show these important UX ideas:

The target style is: Apple Health + Notes app + clean rounded cards + minimal typography + large whitespace.


3. Platforms and Technical Preference

Build a native iOS app first.

Preferred stack:

The app should work offline for existing logs and cached foods. AI enrichment requires internet.


4. Core UX Principles

  1. Fast first: logging food or a workout must take seconds.
  2. Natural language first: users should not have to navigate complex menus before logging.
  3. Structured behind the scenes: every loose input becomes structured data.
  4. AI as resolver, not source of truth: AI parses and estimates; the app stores structured results with confidence and source metadata.
  5. Cache aggressively: do not call AI if an equivalent food/ingredient already exists.
  6. Show confidence clearly: when nutrition estimates are uncertain, mark them as estimated.
  7. Minimal interface: avoid MyFitnessPal-style complexity.
  8. Health-safe wording: insights should be educational, not medical diagnosis.

5. Main Navigation

Use one main screen with a top-left menu or sheet rather than a heavy tab bar.

Main screen

The default screen is the daily journal.

Elements:

Top-left menu

Menu opens a bottom sheet or full-screen panel with:

  1. Journal
  2. Insights
  3. Workouts
  4. Profile (Goals + Settings)

Top-right action

Reserved for later:

For MVP, it can be a placeholder or hidden.


6. Food Logging Flow

User flow

  1. User opens app.
  2. Types a food item naturally:
    • “100g chicken breast”
    • “2 eggs”
    • “burger with ketchup and lettuce”
    • “half a bowl of oatmeal”
  3. User presses done/return/checkmark.
  4. App immediately creates a pending log line.
  5. App resolves nutrition via this order:
    1. Exact local match
    2. Normalized local match
    3. Ingredient decomposition from existing internal database
    4. External verified nutrition source, if integrated
    5. AI resolver as fallback
  6. App displays calories immediately when available.
  7. User can tap the entry to open a bottom sheet with details.

Food detail bottom sheet

When tapping a logged food, show:


7. Nutrition AI Resolution Logic

The AI must output strict JSON. No unstructured prose.

AI resolver responsibilities

The AI should:

  1. Parse user input.
  2. Identify whether it is a simple food, branded food, recipe, meal, restaurant item, or ambiguous item.
  3. Normalize food names.
  4. Estimate quantity and units.
  5. Convert to grams or ml when possible.
  6. Break composite meals into likely ingredients.
  7. Return calories, macros, micronutrients if available.
  8. Include confidence and assumptions.
  9. Flag uncertainty.
  10. Suggest whether the entry should be cached.

Important rule

AI estimates should be treated as estimated nutrition data, not verified truth. The database should store:


8. Internal Food Database Strategy

The app must build an internal nutrition database over time.

Standardization principle

Store nutrition per 100g or 100ml as the canonical base unit.

When a user enters “50g carrot,” store or lookup carrot per 100g, then calculate proportionally.

Food matching hierarchy

Before calling AI, check:

  1. foods.normalized_name
  2. aliases/synonyms
  3. fuzzy match
  4. embeddings/vector similarity if implemented
  5. ingredient decomposition match

Example:

Example composite:

Duplicate handling

The system should detect possible duplicate foods:

Implement a duplicate review process:

When duplicates exist, keep the best record based on:

  1. verified/public source beats AI source
  2. user-corrected beats model-estimated
  3. higher confidence beats lower confidence
  4. more complete micronutrient profile beats incomplete profile
  5. newer model output only beats old if source quality is equal

Do not automatically delete duplicates at first. Mark them as possible_duplicate_of and build a review/admin function.


9. Suggested Data Model

User

type User = {
  id: string
  appleUserId?: string
  createdAt: string
  displayName?: string
  birthYear?: number
  sex?: "male" | "female" | "other" | "prefer_not_to_say"
  heightCm?: number
  weightKg?: number
  activityLevel?: string
  goalType?: "fat_loss" | "maintenance" | "muscle_gain" | "performance" | "health"
  calorieTarget?: number
  proteinTargetG?: number
  carbTargetG?: number
  fatTargetG?: number
  waterTargetMl?: number
}

Food

type Food = {
  id: string
  canonicalName: string
  normalizedName: string
  category?: string
  baseUnit: "g" | "ml" | "unit"
  baseQuantity: number // usually 100
  caloriesPerBase: number
  proteinGPerBase?: number
  carbsGPerBase?: number
  fatGPerBase?: number
  fiberGPerBase?: number
  sugarGPerBase?: number
  sodiumMgPerBase?: number
  waterGPerBase?: number
  micronutrients?: MicronutrientProfile
  sourceType: "verified_dataset" | "user_corrected" | "ai_estimated" | "brand_label" | "restaurant_estimate"
  sourceName?: string
  sourceUrl?: string
  confidence: number // 0-1
  modelVersion?: string
  assumptions?: string[]
  aliases?: string[]
  possibleDuplicateOf?: string
  createdAt: string
  updatedAt: string
}

MicronutrientProfile

type MicronutrientProfile = {
  vitaminA_mcg?: number
  vitaminC_mg?: number
  vitaminD_mcg?: number
  vitaminE_mg?: number
  vitaminK_mcg?: number
  thiamin_mg?: number
  riboflavin_mg?: number
  niacin_mg?: number
  vitaminB6_mg?: number
  folate_mcg?: number
  vitaminB12_mcg?: number
  calcium_mg?: number
  iron_mg?: number
  magnesium_mg?: number
  phosphorus_mg?: number
  potassium_mg?: number
  zinc_mg?: number
  copper_mg?: number
  manganese_mg?: number
  selenium_mcg?: number
}

FoodLogEntry

type FoodLogEntry = {
  id: string
  userId: string
  date: string
  originalText: string
  resolvedFoodId?: string
  mealType?: "breakfast" | "lunch" | "dinner" | "snack" | "unknown"
  quantity: number
  unit: "g" | "ml" | "unit" | "serving"
  calories: number
  proteinG?: number
  carbsG?: number
  fatG?: number
  fiberG?: number
  sugarG?: number
  waterMl?: number
  micronutrients?: MicronutrientProfile
  confidence: number
  status: "pending" | "resolved" | "needs_review" | "failed"
  createdAt: string
  updatedAt: string
}

CompositeFoodComponent

type CompositeFoodComponent = {
  id: string
  parentFoodId: string
  componentFoodId: string
  estimatedGrams: number
  confidence: number
}

10. Workout Feature

The workout feature should be better than Mist’s current workout tracking. The goal is fast logging for people who already know what they are doing in the gym.

Workout entry points

From menu:

From journal:

Workout templates

Users can create and save:

A template contains ordered exercises.

Active workout UI

When a workout starts, show a compact bottom card, not a huge complicated screen.

Card requirements:

Prediction logic

For each exercise:

Workout saving

After completing a workout:


11. Workout Data Model

Exercise

type Exercise = {
  id: string
  name: string
  normalizedName: string
  primaryMuscles?: string[]
  secondaryMuscles?: string[]
  equipment?: "barbell" | "dumbbell" | "machine" | "cable" | "bodyweight" | "other"
  movementPattern?: "push" | "pull" | "squat" | "hinge" | "carry" | "core" | "isolation" | "cardio"
}

WorkoutTemplate

type WorkoutTemplate = {
  id: string
  userId: string
  name: string
  exerciseIds: string[]
  createdAt: string
  updatedAt: string
}

WorkoutSession

type WorkoutSession = {
  id: string
  userId: string
  templateId?: string
  name?: string
  startedAt: string
  endedAt?: string
  status: "active" | "completed" | "discarded"
}

WorkoutSet

type WorkoutSet = {
  id: string
  workoutSessionId: string
  exerciseId: string
  setNumber: number
  reps?: number
  weightKg?: number
  durationSeconds?: number
  distanceMeters?: number
  isPredicted: boolean
  completedAt?: string
}

12. Insights Section

The insights page should use clean Apple Health-style cards.

Top segmented control names:

Option A:

  1. Overview
  2. Nutrients
  3. Workouts

Option B:

  1. Big Picture
  2. Nutrition Detail
  3. Training

Preferred for MVP: Overview / Nutrients / Training.

Overview

Shows big-picture daily and weekly health tracking:

Nutrients

Detailed micronutrient and food quality view:

Show confidence. If micronutrient data is incomplete, say so clearly.

Possible recommendations:

Do not give medical claims.

Training

Workout analytics:

Example insight:


13. Apple Health Integration

Eventually integrate HealthKit.

Read from Apple Health

Ask permission to read:

Write to Apple Health

Ask permission to write:

HealthKit must be optional. The app should still work without Health permissions.


14. AI Architecture

Never call the AI API directly from iOS. Use backend functions.

Suggested backend flow

  1. iOS sends raw log text to backend.
  2. Backend normalizes text.
  3. Backend searches internal food database.
  4. If match is strong, return structured nutrition immediately.
  5. If no match, backend calls AI resolver.
  6. Backend validates AI JSON against schema.
  7. Backend stores resolved food per 100g/100ml if cacheable.
  8. Backend returns final log entry to iOS.

Backend modules


15. AI Food Resolver Prompt

Use this as the starting prompt for the backend AI call:

You are a nutrition data resolver for a consumer food logging app.

Your job is to convert a user's natural-language food log into structured nutrition data.

Rules:
- Return strict JSON only.
- Do not include markdown.
- Use metric units.
- Normalize all foods to a canonical food name.
- For simple foods, provide nutrition per consumed quantity and per 100g or 100ml when possible.
- For composite foods, break the meal into likely ingredients with estimated grams.
- Include calories, protein, carbs, fat, fiber, sugar, sodium, water, and micronutrients when reasonably available.
- Include assumptions.
- Include a confidence score from 0 to 1.
- If the input is ambiguous, still provide a best estimate but mark low confidence and list clarification questions.
- Do not invent branded nutrition unless the brand/product is clearly identified.
- Prefer generic estimates when brand is unknown.
- Do not make medical claims.

User input:


User profile context, if available:


Return this JSON shape:
{
  "input": "string",
  "entryType": "simple_food | composite_food | branded_food | restaurant_food | drink | supplement | unknown",
  "canonicalName": "string",
  "normalizedName": "string",
  "consumedQuantity": {
    "amount": number,
    "unit": "g | ml | unit | serving",
    "estimatedGrams": number | null,
    "estimatedMl": number | null
  },
  "nutritionConsumed": {
    "calories": number,
    "proteinG": number,
    "carbsG": number,
    "fatG": number,
    "fiberG": number | null,
    "sugarG": number | null,
    "sodiumMg": number | null,
    "waterG": number | null,
    "micronutrients": {
      "vitaminA_mcg": number | null,
      "vitaminC_mg": number | null,
      "vitaminD_mcg": number | null,
      "vitaminE_mg": number | null,
      "vitaminK_mcg": number | null,
      "calcium_mg": number | null,
      "iron_mg": number | null,
      "magnesium_mg": number | null,
      "potassium_mg": number | null,
      "zinc_mg": number | null,
      "selenium_mcg": number | null,
      "vitaminB12_mcg": number | null,
      "folate_mcg": number | null
    }
  },
  "nutritionPer100gOr100ml": {
    "baseUnit": "g | ml | unknown",
    "calories": number | null,
    "proteinG": number | null,
    "carbsG": number | null,
    "fatG": number | null,
    "fiberG": number | null,
    "sugarG": number | null,
    "sodiumMg": number | null,
    "waterG": number | null,
    "micronutrients": {}
  },
  "components": [
    {
      "canonicalName": "string",
      "normalizedName": "string",
      "estimatedGrams": number,
      "nutritionConsumed": {},
      "confidence": number
    }
  ],
  "shouldCache": true,
  "cacheLevel": "food | meal | do_not_cache",
  "confidence": number,
  "assumptions": ["string"],
  "clarificationQuestions": ["string"],
  "safetyNotes": ["string"]
}

16. MVP Build Plan

Phase 1 — Native iOS prototype

Build:

Do not build AI first. Get the UX working with mock data.

Phase 2 — Local data model

Build:

Phase 3 — Backend + AI resolver

Build:

Phase 4 — Insights

Build:

Phase 5 — Workout logging

Build:

Phase 6 — HealthKit

Build:


17. First Prompt for Claude Code / Codex

Use this prompt to start the project:

You are a senior iOS architect and product engineer. Help me build a native SwiftUI iOS app that is a minimal nutrition and workout tracker inspired by the simplicity of a Notes app, without copying any proprietary branding or assets from existing apps.

Read this full product reference and then produce a practical implementation plan.

The app concept:
- Main screen is a daily journal.
- User types natural-language foods like “100g chicken breast”, “2 eggs”, “a banana”, or “burger with ketchup”.
- The app shows calories on the right of each line and a bottom summary pill with calories, protein, carbs, and fat.
- Tapping a food opens a bottom sheet with macros, micronutrients, confidence, assumptions, and edit options.
- The backend should resolve food entries using internal database lookup first, then AI only when needed.
- Resolved foods should be stored in a standardized internal database per 100g or per 100ml.
- Duplicate foods should be detected and marked for review rather than blindly inserted.
- The app also needs a workout logger: users can start a workout, choose a template or random workout, log exercises set-by-set in a compact bottom card, and get predictions for reps/weight based on past history.
- Insights should use Apple Health-style cards with three sections: Overview, Nutrients, and Training.
- Later the app should sync selected data with Apple HealthKit.

Technical preference:
- SwiftUI for iOS.
- SwiftData or Core Data for local persistence.
- Supabase or Firebase for backend/cloud sync.
- AI API must be called from backend only, never directly from iOS.
- Swift Charts for insights.
- HealthKit later.

Your task now:
1. Propose the best architecture for the MVP.
2. Decide whether SwiftData or Core Data is better for the first version.
3. Design the folder structure.
4. Define the first local data models.
5. Build a step-by-step implementation plan.
6. Create the first SwiftUI screens with mock data:
   - DailyJournalView
   - FoodEntryRow
   - BottomNutritionSummaryCard
   - FoodDetailSheet
   - Side/Menu sheet placeholder
7. Use clean Apple-native design: large whitespace, rounded cards, minimal black/gray typography, subtle shadows, and no heavy tab bar.
8. Do not implement backend or AI yet; create interfaces/protocols so they can be added later.
9. Make the code production-minded, modular, and easy to extend.
10. Before coding, explain assumptions and tradeoffs.

Start by creating the architecture and MVP implementation plan. Then implement the first working SwiftUI prototype.

18. Questions to Resolve Later

These are not blockers for the MVP, but they should be decided before production:

  1. Will the app require account creation, or will it support full local guest mode?
  2. Should food logs be private/local by default?
  3. Which nutrition database should seed the internal food database?
  4. Will users be allowed to correct nutrition values manually?
  5. Should AI-estimated nutrition be visibly labeled as estimated?
  6. Should the app include barcode scanning?
  7. Should restaurant/branded food be included in MVP?
  8. Should workout data be separate from Apple Health workouts or fully synced?
  9. Will the app monetize through subscription, one-time purchase, or freemium?
  10. What is the minimum safe wording for supplement recommendations?

19. Important Product Constraint

The main risk is overbuilding. The app should not become a complicated fitness dashboard too early.

The MVP should prove one thing first:

Can a user log food and workouts faster than existing apps while still receiving useful structured insights?

Everything else is secondary.