feat: initial implementation — all 35 requirements across phases 1-3
Backend (Spring Boot 3.2 / Java 21 / PostgreSQL): - JWT auth with BCrypt password hashing - User profile + Mifflin-St Jeor BMR calculator - Food search + barcode via OpenFoodFacts API with local cache - Meal CRUD with user data isolation and ownership checks - AI photo analysis (OpenAI Vision) with confidence intervals - AI correction feedback loop for personalisation - Flyway DB migrations + RFC-7807 error responses Mobile (React Native / TypeScript): - Full navigation stack (Auth → Tabs → Home stack) - Design tokens (WCAG 2.2 AA colours, 8px grid, 48px touch targets) - 10 screens: Login, Register, Home, Search, Camera, AI Result, Edit Meal, Daily Details, History, Profile - Confidence-aware calorie display (kcal ± range) - Repeat last meal shortcut + macro tracking Docs: - docs/PLAN-AND-REQUIREMENTS.md - docs/traceability.csv (35 requirements, all Implemented)
This commit is contained in:
428
idea/figmaDetails.md
Normal file
428
idea/figmaDetails.md
Normal file
@@ -0,0 +1,428 @@
|
||||
Perfect — let’s turn your wireframes into a **Figma-ready design system + component spec** that you (or Marta 👀) can directly implement.
|
||||
|
||||
This is structured exactly how real product teams define UI systems so you can **scale later without redesigning everything**.
|
||||
|
||||
***
|
||||
|
||||
# 🎨 1. Design Tokens (FOUNDATION — define this first in Figma)
|
||||
|
||||
## 🟢 Colors
|
||||
|
||||
Create **Color Styles** in Figma:
|
||||
|
||||
```
|
||||
Primary/Green #22C55E (main action)
|
||||
Primary/Dark #16A34A
|
||||
|
||||
Gray/900 #0F172A (text)
|
||||
Gray/700 #334155
|
||||
Gray/500 #64748B
|
||||
Gray/300 #CBD5F5
|
||||
Gray/100 #F1F5F9
|
||||
|
||||
Background #FFFFFF
|
||||
Background/Muted #F8FAFC
|
||||
|
||||
Error/Red #EF4444
|
||||
Warning/Yellow #F59E0B
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## 🔤 Typography
|
||||
|
||||
Create text styles:
|
||||
|
||||
```
|
||||
Heading/Large 24px / SemiBold / Line 32
|
||||
Heading/Medium 20px / SemiBold
|
||||
Body/Large 16px / Regular
|
||||
Body/Medium 14px / Regular
|
||||
Caption 12px / Regular
|
||||
|
||||
Number/Kcal 28px / Bold
|
||||
```
|
||||
|
||||
👉 Font: **Inter / SF Pro** (mobile-friendly)
|
||||
|
||||
***
|
||||
|
||||
## 📏 Spacing System (8px grid)
|
||||
|
||||
```
|
||||
4px
|
||||
8px
|
||||
16px
|
||||
24px
|
||||
32px
|
||||
48px
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# 🧱 2. Core Components (Figma Components)
|
||||
|
||||
***
|
||||
|
||||
## 🔘 Button Component
|
||||
|
||||
Create **Component: Button**
|
||||
|
||||
### Variants:
|
||||
|
||||
```
|
||||
Type: Primary / Secondary / Ghost
|
||||
State: Default / Pressed / Disabled
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### Primary Button
|
||||
|
||||
```
|
||||
Height: 48px
|
||||
Padding: 0 16px
|
||||
Radius: 12px
|
||||
|
||||
Fill: Green/Primary
|
||||
Text: White / 16px / Medium
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### Secondary Button
|
||||
|
||||
```
|
||||
Border: 1px Gray/300
|
||||
Fill: White
|
||||
Text: Gray/900
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## 🧩 Input Field
|
||||
|
||||
```
|
||||
Height: 48px
|
||||
Radius: 10px
|
||||
Border: Gray/300
|
||||
|
||||
States:
|
||||
- Focus → Green border
|
||||
- Error → Red border
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# 🍱 3. Meal Item Component (CRITICAL)
|
||||
|
||||
```
|
||||
Component: MealItemRow
|
||||
|
||||
Layout:
|
||||
[ Icon ] [ Name ] [ kcal ]
|
||||
|
||||
Height: 56px
|
||||
Padding: 12px
|
||||
|
||||
Name: 16px / Medium
|
||||
Kcal: 14px / Gray/500
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### Variants:
|
||||
|
||||
```
|
||||
Type:
|
||||
- Default
|
||||
- Editable
|
||||
- AI Suggested (badge)
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### AI Suggested Variant
|
||||
|
||||
```
|
||||
Add:
|
||||
[ ⚡ Suggested ]
|
||||
|
||||
Background: Light green tint
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# 🍽️ 4. Food Row (search results)
|
||||
|
||||
```
|
||||
Component: FoodRow
|
||||
|
||||
--------------------------------
|
||||
Chicken breast
|
||||
165 kcal / 100g
|
||||
--------------------------------
|
||||
```
|
||||
|
||||
Height: 64px
|
||||
Padding: 12px
|
||||
|
||||
***
|
||||
|
||||
# 📊 5. Progress Card (Home TOP section)
|
||||
|
||||
```
|
||||
Component: CalorieCard
|
||||
|
||||
--------------------------------
|
||||
🔥 1800 / 2200 kcal
|
||||
Remaining: 400
|
||||
|
||||
[ Progress bar ]
|
||||
--------------------------------
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### Progress Bar Spec
|
||||
|
||||
```
|
||||
Height: 8px
|
||||
Radius: 999px
|
||||
|
||||
Background: Gray/200
|
||||
Fill: Green/Primary
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# ➕ 6. Floating Action Button (FAB)
|
||||
|
||||
```
|
||||
Component: FAB
|
||||
|
||||
Size: 56x56
|
||||
Radius: 50%
|
||||
Fill: Primary Green
|
||||
|
||||
Icon: + (white)
|
||||
Shadow:
|
||||
Y: 4
|
||||
Blur: 12
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# 📷 7. AI Suggestion Card (MOST IMPORTANT COMPONENT)
|
||||
|
||||
```
|
||||
Component: AISuggestionCard
|
||||
|
||||
--------------------------------
|
||||
🍚 Rice 150g
|
||||
🍗 Chicken 120g
|
||||
|
||||
Confidence: 78%
|
||||
|
||||
[ Edit ]
|
||||
[ Confirm ]
|
||||
--------------------------------
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### Layout
|
||||
|
||||
* Vertical stack
|
||||
* Items = **repeatable component**
|
||||
|
||||
***
|
||||
|
||||
### Item inside card
|
||||
|
||||
```
|
||||
Component: AISuggestionItem
|
||||
|
||||
Name (left)
|
||||
Grams (right)
|
||||
Confidence (small text)
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# 🎛️ 8. Slider Component (Edit Screen)
|
||||
|
||||
```
|
||||
Component: PortionSlider
|
||||
|
||||
--------------------------------
|
||||
Rice
|
||||
150g [——●—————]
|
||||
|
||||
--------------------------------
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### Specs:
|
||||
|
||||
* Track height: 4px
|
||||
* Thumb: 16px circle
|
||||
* Active color: Green
|
||||
* Range: 0–500g
|
||||
|
||||
***
|
||||
|
||||
# 📱 9. Screen Layouts (Frame Specs)
|
||||
|
||||
***
|
||||
|
||||
## 🏠 Home Screen
|
||||
|
||||
Frame: `Home`
|
||||
|
||||
```
|
||||
Padding: 16px
|
||||
Vertical spacing: 16px
|
||||
|
||||
Structure:
|
||||
|
||||
[ Title ]
|
||||
|
||||
[ CalorieCard ]
|
||||
|
||||
[ Meal List (MealItemRow x N) ]
|
||||
|
||||
[ Repeat Card ]
|
||||
|
||||
[FAB floating bottom right]
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## 📷 AI Result Screen
|
||||
|
||||
Frame: `AI_Result`
|
||||
|
||||
```
|
||||
Padding: 16px
|
||||
|
||||
[ Title ]
|
||||
|
||||
[ AISuggestionCard ]
|
||||
|
||||
[ Primary CTA: Confirm ]
|
||||
|
||||
[ Secondary CTA: Edit ]
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## ✏️ Edit Meal Screen
|
||||
|
||||
Frame: `Edit_Meal`
|
||||
|
||||
```
|
||||
Padding: 16px
|
||||
|
||||
List of:
|
||||
[ PortionSlider x items ]
|
||||
|
||||
Bottom:
|
||||
[ Total calories ]
|
||||
|
||||
Sticky Footer:
|
||||
[ Save Meal Button ]
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# 🔄 10. Component Hierarchy (IMPORTANT)
|
||||
|
||||
```
|
||||
App
|
||||
├── Screens
|
||||
│ ├── Home
|
||||
│ ├── AddMeal
|
||||
│ ├── AIResult
|
||||
│ ├── EditMeal
|
||||
│
|
||||
├── Components
|
||||
│ ├── Button
|
||||
│ ├── MealItemRow
|
||||
│ ├── FoodRow
|
||||
│ ├── AISuggestionCard
|
||||
│ ├── Slider
|
||||
│ ├── ProgressBar
|
||||
│
|
||||
├── Tokens
|
||||
├── Colors
|
||||
├── Typography
|
||||
├── Spacing
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# 🧠 11. Interaction States (you must define in Figma)
|
||||
|
||||
For each component:
|
||||
|
||||
### Button
|
||||
|
||||
* Default
|
||||
* Pressed (darker)
|
||||
* Disabled (opacity 40%)
|
||||
|
||||
### Food Row
|
||||
|
||||
* Hover (if web)
|
||||
* Selected
|
||||
|
||||
### AI Suggestions
|
||||
|
||||
* Pending
|
||||
* Edited
|
||||
* Confirmed
|
||||
|
||||
***
|
||||
|
||||
# ⚡ 12. Developer-Friendly Naming (IMPORTANT for you)
|
||||
|
||||
Use naming like this in Figma:
|
||||
|
||||
```
|
||||
btn/primary/default
|
||||
btn/primary/pressed
|
||||
|
||||
meal-item/default
|
||||
meal-item/ai
|
||||
|
||||
card/calorie
|
||||
card/ai-suggestion
|
||||
|
||||
slider/portion
|
||||
fab/default
|
||||
```
|
||||
|
||||
👉 This maps directly to code components later.
|
||||
|
||||
***
|
||||
|
||||
# 🚀 Final Result
|
||||
|
||||
With this setup you get:
|
||||
|
||||
✅ Scalable design system
|
||||
✅ Fast implementation (React Native ready)
|
||||
✅ Clean UX focused on speed
|
||||
|
||||
***
|
||||
|
||||
# 🎯 What I can do next (high value)
|
||||
|
||||
I can generate:
|
||||
|
||||
👉 **React Native component skeleton matching this design system**
|
||||
👉 or **real Figma JSON/import structure (so you don’t rebuild manually)**
|
||||
|
||||
Just tell me 👍
|
||||
0
idea/figmaStyleWireframes.md
Normal file
0
idea/figmaStyleWireframes.md
Normal file
495
idea/mvpDataStructAndWorkflows.md
Normal file
495
idea/mvpDataStructAndWorkflows.md
Normal file
@@ -0,0 +1,495 @@
|
||||
Perfect — this is exactly the kind of product where a **clean MVP design = 80% of success**.
|
||||
|
||||
I’ll give you **copy‑paste ready PRD, data model, APIs, and UI flows** — structured so you could literally start building (or drop into Notion / repo).
|
||||
|
||||
***
|
||||
|
||||
# 🧾 1. MVP PRD (Feature Set)
|
||||
|
||||
## 🎯 Product Vision
|
||||
|
||||
> “The easiest way to track calories with minimal effort and acceptable accuracy using AI + smart defaults.”
|
||||
|
||||
***
|
||||
|
||||
## 👤 Target User
|
||||
|
||||
* Busy professionals (like you 😄)
|
||||
* Eat mixed: home + restaurant + packaged food
|
||||
* Want **low friction**, not perfect precision
|
||||
|
||||
***
|
||||
|
||||
## ✅ MVP Scope (STRICT — avoid scope creep)
|
||||
|
||||
### Core Features
|
||||
|
||||
### 1. Meal Logging (3 methods)
|
||||
|
||||
#### ✅ A. Quick Add (manual)
|
||||
|
||||
* Search food
|
||||
* Select portion (grams / default servings)
|
||||
* Add to day
|
||||
|
||||
#### ✅ B. Barcode scan
|
||||
|
||||
* Scan product → auto-fill nutrition
|
||||
|
||||
#### ✅ C. Photo (AI assist, NOT full auto)
|
||||
|
||||
* Take picture
|
||||
* App suggests:
|
||||
* detected food(s)
|
||||
* estimated portions
|
||||
* User must confirm/edit
|
||||
|
||||
👉 Important: **User confirmation required (trust + accuracy)**
|
||||
|
||||
***
|
||||
|
||||
### 2. Daily Tracking
|
||||
|
||||
* Calories consumed (main KPI)
|
||||
* Optional:
|
||||
* protein / carbs / fat
|
||||
* Remaining calories (based on goal)
|
||||
|
||||
***
|
||||
|
||||
### 3. User Profile
|
||||
|
||||
* Age, weight, height
|
||||
* Goal:
|
||||
* lose / maintain / gain
|
||||
* Daily calorie target (calculated)
|
||||
|
||||
(BMR-based baseline — like MyFitnessPal approach)
|
||||
|
||||
***
|
||||
|
||||
### 4. History & Reuse
|
||||
|
||||
* Recent foods
|
||||
* Repeat last meal (1 tap)
|
||||
|
||||
***
|
||||
|
||||
### 5. Correction Loop (THIS IS YOUR SECRET WEAPON)
|
||||
|
||||
* User edits AI result
|
||||
* Store correction
|
||||
* Improve next suggestions
|
||||
|
||||
***
|
||||
|
||||
## ❌ NOT in MVP (important discipline)
|
||||
|
||||
* No social features
|
||||
* No meal plans
|
||||
* No wearable integrations
|
||||
* No deep health analytics
|
||||
|
||||
***
|
||||
|
||||
# 🧠 2. Data Model (clean + scalable)
|
||||
|
||||
Use something like **Postgres (or Firestore if you go fast)**.
|
||||
|
||||
***
|
||||
|
||||
## Core Entities
|
||||
|
||||
### User
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "uuid",
|
||||
"email": "string",
|
||||
"createdAt": "timestamp",
|
||||
"profile": {
|
||||
"age": 30,
|
||||
"weightKg": 80,
|
||||
"heightCm": 180,
|
||||
"goal": "lose|maintain|gain",
|
||||
"dailyCaloriesTarget": 2200
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### FoodItem (normalized DB)
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "uuid",
|
||||
"name": "Chicken breast",
|
||||
"source": "openfoodfacts|custom|ai",
|
||||
"caloriesPer100g": 165,
|
||||
"macros": {
|
||||
"protein": 31,
|
||||
"fat": 3.6,
|
||||
"carbs": 0
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### MealEntry
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "uuid",
|
||||
"userId": "uuid",
|
||||
"date": "2026-05-16",
|
||||
"items": [
|
||||
{
|
||||
"foodItemId": "uuid",
|
||||
"quantityGrams": 200,
|
||||
"calories": 330
|
||||
}
|
||||
],
|
||||
"source": "manual|barcode|photo",
|
||||
"confidence": 0.82
|
||||
}
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### PhotoAnalysis (AI trace — VERY IMPORTANT)
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "uuid",
|
||||
"userId": "uuid",
|
||||
"imageUrl": "string",
|
||||
"detectedItems": [
|
||||
{
|
||||
"name": "rice",
|
||||
"estimatedGrams": 150,
|
||||
"confidence": 0.76
|
||||
}
|
||||
],
|
||||
"userCorrections": [
|
||||
{
|
||||
"name": "rice",
|
||||
"correctedGrams": 180
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### UserFoodMemory (optimization layer)
|
||||
|
||||
```json
|
||||
{
|
||||
"userId": "uuid",
|
||||
"foodName": "coffee with milk",
|
||||
"avgPortionGrams": 250,
|
||||
"lastUsed": "timestamp"
|
||||
}
|
||||
```
|
||||
|
||||
👉 This enables:
|
||||
|
||||
* auto-fill frequent meals
|
||||
* personalization
|
||||
|
||||
***
|
||||
|
||||
# 🔌 3. API Design (clean + realistic)
|
||||
|
||||
Assume REST (simple for MVP)
|
||||
|
||||
***
|
||||
|
||||
## Auth
|
||||
|
||||
```
|
||||
POST /auth/register
|
||||
POST /auth/login
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## User
|
||||
|
||||
```
|
||||
GET /user/profile
|
||||
PUT /user/profile
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## Food Search
|
||||
|
||||
```
|
||||
GET /foods?query=chicken
|
||||
```
|
||||
|
||||
Response:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"id": "uuid",
|
||||
"name": "Chicken breast",
|
||||
"caloriesPer100g": 165
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## Barcode
|
||||
|
||||
```
|
||||
GET /foods/barcode/{code}
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## Meal Logging
|
||||
|
||||
```
|
||||
POST /meals
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"date": "2026-05-16",
|
||||
"items": [
|
||||
{
|
||||
"foodItemId": "uuid",
|
||||
"grams": 200
|
||||
}
|
||||
],
|
||||
"source": "manual"
|
||||
}
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## Daily Overview
|
||||
|
||||
```
|
||||
GET /meals/daily?date=2026-05-16
|
||||
```
|
||||
|
||||
Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"totalCalories": 1800,
|
||||
"target": 2200,
|
||||
"remaining": 400,
|
||||
"meals": [...]
|
||||
}
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## Photo Analysis (AI entry point)
|
||||
|
||||
```
|
||||
POST /ai/analyze-meal
|
||||
```
|
||||
|
||||
Request:
|
||||
|
||||
* image
|
||||
|
||||
Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"suggestions": [
|
||||
{
|
||||
"name": "pasta",
|
||||
"grams": 250,
|
||||
"confidence": 0.78
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## Feedback Loop
|
||||
|
||||
```
|
||||
POST /ai/correction
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"analysisId": "uuid",
|
||||
"corrections": [...]
|
||||
}
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# 📱 4. UI Flows (VERY IMPORTANT — UX is everything)
|
||||
|
||||
I’ll give you **clear flows you can directly translate into screens**
|
||||
|
||||
***
|
||||
|
||||
## 🏠 Home Screen (Daily Dashboard)
|
||||
|
||||
```
|
||||
------------------------------------
|
||||
Calories: 1800 / 2200
|
||||
Remaining: 400
|
||||
|
||||
[ + Add Meal ]
|
||||
|
||||
Today:
|
||||
- Breakfast (450 kcal)
|
||||
- Lunch (800 kcal)
|
||||
- Dinner (550 kcal)
|
||||
------------------------------------
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## ➕ Add Meal (entry selector)
|
||||
|
||||
```
|
||||
Choose how to log:
|
||||
|
||||
[ 📷 Take Photo ]
|
||||
[ 🔍 Search Food ]
|
||||
[ 📦 Scan Barcode ]
|
||||
```
|
||||
|
||||
👉 Always start here — reduces friction.
|
||||
|
||||
***
|
||||
|
||||
## 📷 Photo Flow
|
||||
|
||||
### Step 1 — Capture
|
||||
|
||||
```
|
||||
[ Camera View ]
|
||||
[ Snap ]
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### Step 2 — AI Suggestion (critical UX moment)
|
||||
|
||||
```
|
||||
We detected:
|
||||
|
||||
- Rice (150g)
|
||||
- Chicken (120g)
|
||||
|
||||
[ Edit ] [ Confirm ]
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### Step 3 — Edit
|
||||
|
||||
```
|
||||
Rice: 150g → [ adjust slider ]
|
||||
Chicken: 120g → [ adjust ]
|
||||
[ + Add item ]
|
||||
|
||||
[ Save Meal ]
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## 🔍 Manual Search Flow
|
||||
|
||||
```
|
||||
Search: "chicken"
|
||||
|
||||
Results:
|
||||
- Chicken breast
|
||||
- Chicken thigh
|
||||
|
||||
→ Select
|
||||
→ Choose grams
|
||||
→ Add
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## 📊 Daily Details Screen
|
||||
|
||||
```
|
||||
Total: 1800 kcal
|
||||
|
||||
Macros:
|
||||
Protein: 120g
|
||||
Carbs: 180g
|
||||
Fat: 60g
|
||||
|
||||
Meals:
|
||||
- Breakfast
|
||||
- Lunch
|
||||
- Dinner
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## 🔁 Repeat Meal (killer UX shortcut)
|
||||
|
||||
On Home:
|
||||
|
||||
```
|
||||
[ Repeat yesterday's lunch ]
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# 🎯 5. Architecture Decisions (important for you)
|
||||
|
||||
Given your background:
|
||||
|
||||
### Backend
|
||||
|
||||
* FastAPI or Spring Boot (you’re Java → maybe Spring Boot)
|
||||
|
||||
### Frontend
|
||||
|
||||
* React Native (fast MVP)
|
||||
|
||||
### AI
|
||||
|
||||
* Start with API-based (no custom model)
|
||||
* Later optimize
|
||||
|
||||
***
|
||||
|
||||
# 🚀 6. What makes YOUR app better (MVP differentiation)
|
||||
|
||||
Focus on:
|
||||
|
||||
✅ Minimal friction
|
||||
✅ Smart defaults
|
||||
✅ Learning user habits
|
||||
|
||||
NOT:
|
||||
❌ Better AI model
|
||||
❌ More features
|
||||
|
||||
***
|
||||
|
||||
# ✅ Next logical step
|
||||
|
||||
If you want, I can next:
|
||||
|
||||
👉 Turn this into **actual repo structure + starter code (backend + mobile)**
|
||||
👉 Or design **clickable UI wireframes (Figma-style)**
|
||||
|
||||
Just tell me which direction 👍
|
||||
238
idea/start.md
Normal file
238
idea/start.md
Normal file
@@ -0,0 +1,238 @@
|
||||
Great idea — this is actually a **non-trivial product problem**, not just a simple app. The hardest part is not UI or tracking, but **accuracy vs usability trade-off**.
|
||||
|
||||
Let me break it down in a way that fits your background (architecture + GenAI + product thinking).
|
||||
|
||||
***
|
||||
|
||||
# 🧠 1. First principle: “Precise calorie counting” is inherently imperfect
|
||||
|
||||
Even the best apps are not 100% accurate because:
|
||||
|
||||
* Food labels themselves can legally deviate (\~20%) [\[scienceinsights.org\]](https://scienceinsights.org/most-accurate-calorie-tracker-apps-ai-and-wearables/)
|
||||
* Portion estimation is the biggest error source (humans underestimate 20–40%) [\[healthlyai.com\]](https://www.healthlyai.com/blog/ai-calorie-tracking-vs-manual-logging)
|
||||
* AI image recognition still has \~10–25% error depending on food complexity [\[scienceinsights.org\]](https://scienceinsights.org/most-accurate-calorie-tracker-apps-ai-and-wearables/)
|
||||
|
||||
👉 So your goal should be:
|
||||
|
||||
> **“consistent estimation” > “absolute precision”**
|
||||
|
||||
***
|
||||
|
||||
# 🏗️ 2. 3 viable approaches (you should choose one or combine)
|
||||
|
||||
## Option A — Database-driven (classic, most reliable baseline)
|
||||
|
||||
**How it works:**
|
||||
|
||||
* User selects food from DB or scans barcode
|
||||
* Calories come from nutrition datasets
|
||||
|
||||
**Tech:**
|
||||
|
||||
* APIs like Open Food Facts (free, open DB) [\[openfoodfa....github.io\]](https://openfoodfacts.github.io/openfoodfacts-server/api/)
|
||||
* USDA / Nutritionix / Edamam [\[rapidapi.com\]](https://rapidapi.com/collection/nutrition)
|
||||
|
||||
✅ Pros:
|
||||
|
||||
* Most consistent & explainable
|
||||
* Easy to build MVP
|
||||
* Works well for packaged food
|
||||
|
||||
❌ Cons:
|
||||
|
||||
* Bad UX for homemade meals
|
||||
* Requires manual input
|
||||
|
||||
***
|
||||
|
||||
## Option B — AI / Image-based (cool, but tricky)
|
||||
|
||||
**How it works:**
|
||||
|
||||
1. Detect food (CV model)
|
||||
2. Estimate portion (hard!)
|
||||
3. Map to nutrition DB
|
||||
|
||||
Typical pipeline:
|
||||
|
||||
* Image → food classification → portion estimation → calorie calculation [\[arxiv.org\]](https://arxiv.org/html/2412.09936v1)
|
||||
|
||||
✅ Pros:
|
||||
|
||||
* Amazing UX (“just take a photo”)
|
||||
* Differentiating feature
|
||||
|
||||
❌ Cons:
|
||||
|
||||
* Accuracy varies a lot
|
||||
* Hard problem (volume estimation especially)
|
||||
|
||||
***
|
||||
|
||||
## Option C — Hybrid (BEST PRACTICE ✅)
|
||||
|
||||
This is what modern apps do:
|
||||
|
||||
* Barcode scan → DB
|
||||
* Photo → AI suggestion
|
||||
* Manual correction → user confirms
|
||||
|
||||
👉 This gives:
|
||||
|
||||
* Speed of AI
|
||||
* Accuracy of database
|
||||
|
||||
📌 Industry trend:
|
||||
|
||||
> Best apps combine AI + verified food databases [\[welling.ai\]](https://www.welling.ai/articles/most-accurate-calorie-tracker-app)
|
||||
|
||||
***
|
||||
|
||||
# 🧩 3. Recommended architecture (simple but scalable)
|
||||
|
||||
Given your background, I’d suggest:
|
||||
|
||||
## 🟢 MVP architecture
|
||||
|
||||
```text
|
||||
Mobile App (React Native)
|
||||
|
|
||||
Backend (Node / Java / FastAPI)
|
||||
|
|
||||
----------------------------------
|
||||
| Food DB API (OpenFoodFacts) |
|
||||
| AI Service (image analysis) |
|
||||
| User data (Firebase / Postgres)|
|
||||
----------------------------------
|
||||
```
|
||||
|
||||
## Key components
|
||||
|
||||
### 1. Food data layer
|
||||
|
||||
* Cache food DB locally (performance)
|
||||
* Normalize entries (important!)
|
||||
|
||||
### 2. AI service (optional MVP v2)
|
||||
|
||||
* Start simple:
|
||||
* OpenAI / vision model
|
||||
* or pre-trained food classifier
|
||||
* Later:
|
||||
* custom fine-tuned model
|
||||
|
||||
### 3. Calorie engine
|
||||
|
||||
* Core logic:
|
||||
* calories = portion × kcal\_per\_100g
|
||||
* Add:
|
||||
* macro tracking (protein/fat/carbs)
|
||||
|
||||
***
|
||||
|
||||
# 🎯 4. Where you can actually differentiate (this is key)
|
||||
|
||||
Most apps already exist. Your edge must be here:
|
||||
|
||||
## 💡 Ideas (aligned with your GenAI interest)
|
||||
|
||||
### 1. “Confidence-aware calories”
|
||||
|
||||
Instead of:
|
||||
|
||||
> 500 kcal
|
||||
|
||||
Show:
|
||||
|
||||
> 500 kcal ± 80 kcal (confidence 85%)
|
||||
|
||||
👉 No one does this well, but it’s honest and valuable.
|
||||
|
||||
***
|
||||
|
||||
### 2. Learning system
|
||||
|
||||
* User corrects AI → model improves
|
||||
* Build personal “food profile”
|
||||
|
||||
***
|
||||
|
||||
### 3. Context-aware tracking
|
||||
|
||||
* “Restaurant mode”
|
||||
* “Home cooking mode”
|
||||
* “Meal template reuse”
|
||||
|
||||
***
|
||||
|
||||
### 4. Behavioural layer (underrated)
|
||||
|
||||
Apps fail because people stop logging.
|
||||
|
||||
Add:
|
||||
|
||||
* Auto-suggestions
|
||||
* Meal prediction
|
||||
* “You usually eat this at lunch”
|
||||
|
||||
***
|
||||
|
||||
# ⚙️ 5. Practical MVP plan (step-by-step)
|
||||
|
||||
## Phase 1 (2–3 weeks)
|
||||
|
||||
✅ Manual + DB only
|
||||
|
||||
* Food search
|
||||
* Barcode scan
|
||||
* Daily calorie counter
|
||||
|
||||
## Phase 2
|
||||
|
||||
✅ Add AI assist
|
||||
|
||||
* Upload photo → suggest food
|
||||
* User confirms
|
||||
|
||||
## Phase 3
|
||||
|
||||
✅ Smart features
|
||||
|
||||
* Meal history
|
||||
* Predictions
|
||||
* Personalisation
|
||||
|
||||
***
|
||||
|
||||
# 🧪 6. Accuracy strategy (critical)
|
||||
|
||||
To be “more or less precise”, do this:
|
||||
|
||||
1. Use **verified databases first**
|
||||
2. Always allow **manual override**
|
||||
3. Store **user corrections**
|
||||
4. Avoid pretending AI is exact
|
||||
|
||||
***
|
||||
|
||||
# 🚀 My recommendation for YOU
|
||||
|
||||
Given your skills + interests:
|
||||
|
||||
👉 Build a **GenAI-first hybrid app**
|
||||
|
||||
* Start simple (DB + manual)
|
||||
* Add AI layer as enhancement
|
||||
* Focus on **UX + intelligence**, not just counting
|
||||
|
||||
***
|
||||
|
||||
# 💬 If you want next step
|
||||
|
||||
I can help you:
|
||||
|
||||
* define **feature set for MVP (like PRD)**
|
||||
* design **data model + APIs**
|
||||
* or sketch **UI flows (very important here)**
|
||||
|
||||
Just tell me 👍
|
||||
Reference in New Issue
Block a user