Turn your kitchen into an AI-powered nutrition lab. ChefByte automates meal planning, inventory management, macro tracking, and price intelligence so you can stay focused on cooking and hitting your goals.
Traditional meal prep is manual, error-prone, and disconnected: inventory lives in spreadsheets, nutrition data is guessed, shopping lists are static, and grocery prices shift weekly. ChefByte fixes that loop by unifying inventory, recipes, macros, and shopping automation inside one intelligent system.
- Scan a barcode once and let OpenFoodFacts, GPT-4, and Walmart scraping backfill nutrition, storage, expiration, and price data automatically.
- Use manual product creation when a hardware scan is impossible but you still need full control over nutrition and inventory metadata.
- Rank recipes by macro density (protein/carbs per 100 calories), ingredient availability, and prep time to find the most efficient meals for your targets.
- Auto-build shopping lists from inventory gaps, meal plans, and Walmart matches, then import purchases straight into stock.
- Track macros in real time as meal-plan entries are marked done, temp items are logged, and automation scripts keep data fresh.
- Layer in LiquidTrack ESP8266 scales, Walmart scraping, and Supabase-powered automation to keep data synced without persistent servers.
| Capability | What it delivers | Automation / data sources |
|---|---|---|
| AI-Enhanced Barcode Scanning | One scan pulls nutrition, storage, expiration, name cleanup | OpenFoodFacts API, GPT-4, Walmart scraping fallback |
| Manual Product Creation | Dedicated “New Product” modal for full control without a scan | Inventory UI, same schema as scanned items |
| Macro Density Recipe Search | Percentile rankings, protein/carbs per 100 cal sliders, “Can Be Made” filter | Uses stock levels, recipe metadata, macro recompute script |
| Intelligent Shopping Lists | Calculates gaps to minimum stock, respects what’s already queued, exports to Walmart links | Automation scripts, Walmart price manager |
| Automated Walmart Price Tracking | Batch searches (5 products, 4 results each), 5-worker scraper updates, manual price entry for non-Walmart | Vercel function /api/walmart-scrape, background job tracker |
| Integrated Macro Tracking | Combines meal-plan execution, temp items, progress bars, target macros editor | Dashboard widgets, grocy_config goals, Supabase data |
| LiquidTrack Smart Scales | ESP8266 events authenticate via API key, log consumption automatically | /api/liquidtrack function, device_keys, liquid_events tables |
-
Sunday Meal Prep Session
- Open recipe search, enable “Can Be Made”, set protein density 8–15 g/100 cal.
- Pick five high-protein recipes, add to meal plan (Mon–Fri lunches).
- Click “Add Below Min Stock” → 12 items flow into shopping list.
- “Get Cart Links” copies Walmart URLs → paste, order, cost auto-estimated at $87.34.
- After groceries arrive, click “Import Shopping List” to assign inventory.
-
Daily Macro Tracking Loop
- Morning temp item (“Coffee + Protein Powder”: 150 cal / 25 g protein).
- Lunch meal plan entry (“Chicken Bowl”): +450 cal / 45 g protein.
- Snack barcode scan adds a protein bar as consumed.
- Dinner meal (“Salmon + Veggies”): +380 cal / 40 g protein.
- Dashboard shows 1680/2200 cal and 165/180 g protein (92 % to goal).
-
Walmart Price Management Sprint
- After scanning 30 products, open Walmart Price Manager.
- Load 5 products × 4 search results, select best matches, mark “Not Walmart” when needed.
- Click “Update All”; repeat 6 batches to finish the set.
- Enable weekly “Auto Price Update” to keep totals current.
- Frontend: React + Vite + TypeScript SPA.
- Backend: Node.js + Express API.
- Database: PostgreSQL via
pg.
┌─────────────────────────────── VERCEL ───────────────────────────────┐
│ Landing page (static) | React SPA (Vite + Supabase SDK direct DB) │
│ └──────────────┬──────────────────────────────┘
│ Serverless functions: /api/walmart-scrape · /api/liquidtrack · │
│ /api/analyze-product │
└───────────────────────────────┬───────────────────────────────────────┘
│
┌────────────▼────────────┐
│ SUPABASE │
│ Postgres + RLS (per │
│ user_id), Auth, Store │
└────────────────────────┘
- Minimal serverless surface: keep only
/api/walmart-scrape,/api/liquidtrack,/api/analyze-product. - LiquidTrack device auth: users mint hashed API keys stored in
device_keys; Vercel function validates and inserts with correctuser_id. - Multi-tenancy via RLS: every table carries
user_id; policies enforceauth.uid() = user_id. - Free-tier friendly: Supabase free limits + Vercel free invocations, no always-on servers → $0 for portfolio load.
-
Phase 1 – Local Supabase Setup
-
✅ 1.1 Install CLI
npm install -g supabase supabase init supabase start
-
⬜ 1.2 Schema migration (
supabase/migrations/001_initial_schema.sql). Tables to recreate in order:Table Key columns Notes locationsid, user_id, name user_idrefsauth.usersquantity_unitsid, user_id, name, name_plural productsid, user_id, name, description, location_id, qu_id_stock/purchase/consume/price, min_stock_amount, default_best_before_days, calories/carbs/protein/fat_per_serving, num_servings, barcode, walmart_link, is_walmart, is_meal_product, is_placeholder, price Most complex table stockid, user_id, product_id, amount, best_before_date, location_id recipesid, user_id, name, description, base_servings, total_time, active_time, calories/carbs/protein/fat, product_id recipe_ingredientsid, user_id, recipe_id, product_id, amount, qu_id, note meal_planid, user_id, day, type, recipe_id, product_id, amount, qu_id, done, is_meal_prep, created_at shopping_listid, user_id, product_id, amount, note, done quantity_unit_conversionsid, user_id, product_id, from_qu_id, to_qu_id, factor stock_logid, user_id, product_id, amount, best_before_date, purchased_date, stock_id, transaction_type, timestamp grocy_configid, user_id, key, value User settings temp_itemsid, user_id, name, calories, protein, carbs, fat, day, created_at Macro tracking device_keysid, user_id, key_hash, name, created_at LiquidTrack liquid_eventsid, user_id, scale_id, timestamp, weight_before/after, consumed, is_refill, product_name, calories, protein, carbs, fat, created_at LiquidTrack -
⬜ 1.3 RLS policies (
supabase/migrations/002_rls_policies.sql):ALTER TABLE products ENABLE ROW LEVEL SECURITY; CREATE POLICY "Users can only access own data" ON products FOR ALL USING (auth.uid() = user_id); CREATE POLICY "Users manage own device keys" ON device_keys FOR ALL USING (auth.uid() = user_id); CREATE POLICY "Users read own liquid events" ON liquid_events FOR SELECT USING (auth.uid() = user_id);
-
⬜ 1.4 Indexes (
supabase/migrations/003_indexes.sql):CREATE INDEX idx_products_barcode ON products(barcode); CREATE INDEX idx_products_user_id ON products(user_id); CREATE INDEX idx_stock_product_id ON stock(product_id); CREATE INDEX idx_meal_plan_day ON meal_plan(day); CREATE INDEX idx_liquid_events_scale_timestamp ON liquid_events(scale_id, created_at);
-
-
Phase 2 – Frontend Supabase Client
- ✅ 2.1 Install dependencies:
cd apps/web && npm install @supabase/supabase-js. - ✅ 2.2 Client (
apps/web/src/lib/supabase.ts) usescreateClientwithVITE_SUPABASE_URL+VITE_SUPABASE_ANON_KEY. - ✅ 2.3
.env:VITE_SUPABASE_URL=http://192.168.0.226:54321 VITE_SUPABASE_ANON_KEY=<from supabase start output>
- ⬜ 2.4 Generate types:
supabase gen types typescript --local \ > apps/web/src/lib/database.types.ts
- ✅ 2.1 Install dependencies:
-
Phase 3 – Auth Integration
- Build
AuthContext(wrap provider, exposeuser,signIn,signUp,signOut, subscribe toonAuthStateChange). - Create
Login.tsx&Signup.tsx(email/password +supabase.auth.signInWithPassword). - Add
ProtectedRoute.tsxto gate existing routes and redirect unauthenticated users to/login.
- Build
-
Phase 4 – API Migration (Express → Supabase SDK)
- Map every Express route to Supabase queries (products CRUD, recipes, meal plan, shopping list, inventory, macros, locations, config).
- ✅
apps/web/src/lib/api-supabase.tsmirrors the legacy interface. - ⬜ Port complex flows that may require RPC/functions: recipe execution, shopping list → stock transfer, auto add below minimum stock.
-
Phase 5 – Serverless Functions
- ✅ Folder
apps/web/api/containswalmart-scrape.ts,liquidtrack.ts,analyze-product.ts. - Implementation pattern: verify Supabase JWT (or service-role key for
/api/liquidtrack), run worker, return JSON. - ⬜ Local verification via Vercel CLI:
npm i -g vercel cd apps/web vercel dev
- ✅ Folder
-
Phase 6 – Data Migration (personal data)
- ⬜ Export current Postgres:
pg_dump -h 192.168.0.239 -U postgres -d chefbyte --data-only > backup.sql - ⬜ Transform dataset: inject Supabase
user_ideverywhere, re-map foreign keys if IDs change. - ⬜ Import into Supabase local:
psql -h localhost -p 54322 -U postgres -d postgres < backup.sql
- ⬜ Export current Postgres:
-
Phase 7 – Testing Checklist
- Auth (sign up, login, logout, session persistence).
- Products (create/read/update + barcode lookup).
- Recipes (create with ingredients, macro updates).
- Meal plan (add entries, mark done, execute recipe).
- Shopping list (add items, move to stock).
- Macro day summary accuracy.
- LiquidTrack ingestion associates correct
user_id. - Walmart scraping returns results via serverless function.
-
Phase 8 – Cloud Deployment
- Create Supabase cloud project, run migrations, capture URL + anon key.
- Deploy to Vercel, set
VITE_SUPABASE_URL,VITE_SUPABASE_ANON_KEY,SUPABASE_SERVICE_ROLE_KEY. - Build landing page (static login CTA + docs).
- Migrate personal data (export → import with Supabase
user_id). - Verify full flow end to end.
- Request flow: ESP8266 scale →
POST /api/liquidtrackwith headerx-api-key: lt_xxx+ body{ scale_id, events[] }. Serverless function validates key indevice_keys, injectsuser_id, inserts intoliquid_events, returns{ success: true, count }. - Consumer setup:
- User opens Settings → LiquidTrack → “Generate Device Key”.
- App stores hashed key in
device_keys. - Firmware gets
URL=https://chefbyte.vercel.app/api/liquidtrack+API_KEY=lt_abc123xyz. - Device sends events; deleting the row revokes access immediately.
- Security: Keys hashed, RLS restricts reads (
auth.uid() = user_id), service-role key required for writes. - Tables:
device_keys(id, user_id, key_hash, name, created_at) andliquid_events(scale_id, timestamps, weight_before/after, consumed, is_refill, product_name, macros, created_at).
# Recommended local stack
npx supabase start # Runs Postgres + Auth at http://localhost:54321# .env.local
VITE_SUPABASE_URL=http://localhost:54321
VITE_SUPABASE_ANON_KEY=<local-anon-key>
# .env.production (Vercel)
VITE_SUPABASE_URL=https://<prod>.supabase.co
VITE_SUPABASE_ANON_KEY=<prod-anon>
SUPABASE_SERVICE_ROLE_KEY=<service-role>- Status cards: Missing Walmart Links, Missing Prices, Placeholder Items, Below Minimum Stock, Shopping Cart Value.
- Quick actions:
- 🔄 Automation Settings opens the automation modal (details below).
- Import Shopping List buys every non-placeholder item immediately.
- 🎯 Target Macros edits
goal_carbs,goal_protein,goal_fats(calories auto-calc). - 📝 Taste Profile stores dietary preferences/allergies.
- Meal Plan → Cart diff (next 7 days) that adds recipe ingredients + regular meal products, excludes meal prep outputs and
[MEAL]products, rounds to whole containers, warns when placeholders were capped at one unit.
- Recent New Items: inline edit names, expirations, locations for latest scans.
- Scripts:
update_recipe_macros.py– recompute recipe calories/protein/carbs/fats whenever ingredients change.add_below_min_to_shopping.py– adds items required to reach each product’smin_stock_amount.create_meal_products.py– generates[MEAL] Recipe Nameproducts, links viaproduct_id, sets macro userfields, one product per serving.
- Controls: toggle Auto-Run (every minute), choose scripts, hit “Run Now”, monitor real-time status (Idle/Running, last run, next run), view last 10 executions (status, timestamp, scripts, duration, trigger).
- Storage:
ui/data/automation_config.json(settings) &ui/data/automation_log.json(last 50 runs). - Usage examples: enable all scripts weekly via Auto-Run, or run “Meal Products” once without scheduling.
- Steps: open Scanner tab → pick mode (Purchase / Consume / Add to Shopping) → scan/enter barcode → system processes instantly → success toast → edit in “Recent New Items”.
- Global scanner detection: rapid digits (~50 ms apart, 6–24 chars) captured anywhere on page, protects nutrition fields, auto-focus + submit on Enter, buffer resets after 300 ms to separate human typing.
- Transaction Types:
- Purchase: Adds to stock. Keypad edits
servingsPerContainer(master data). Defaults to 'Containers'. - Consume: Removes from stock. Keypad edits consumed amount. Defaults to 'Servings' (if meal plan enabled) or 'Containers'. Auto-adds to meal plan if enabled.
- Add to Shopping: Adds to shopping list. Keypad edits quantity. Defaults to 'Containers'.
- Purchase: Adds to stock. Keypad edits
- Keypad Features:
- Overwrite Logic: First digit press on a selected item overwrites the value; subsequent presses append.
- Macro Loading: Selecting an item in Purchase mode loads its nutrition data into the editor.
- Nutrition Logic:
- Auto-Scaling: Editing
Caloriesautomatically scalesCarbs,Fats, andProteinproportionally. - Recalculation: Editing any macro (
Carbs,Fats,Protein) automatically recalculatesCaloriesusing the 4-4-9 rule.
- Auto-Scaling: Editing
- Unit Toggle: Switch between Servings/Containers in Consume mode.
- Visual States:
- Red Items: Newly scanned items appear red (
isRed) until clicked/acknowledged. - Filter: "New" filter shows only unacknowledged red items.
- Red Items: Newly scanned items appear red (
- Behind the scenes: tries to match existing barcode, otherwise queries Walmart, creates product with name/price/nutrition, links barcode for future scans.
- Example: scan
012345678901, app finds “Organic Milk”, creates product at $4.99 and default location.
- Day summary card: progress bars for Calories/Protein/Carbs/Fats with green/red cues, shows percentage of goal, includes date selector.
- Consumed items: every meal-plan entry marked “done” plus temp items; macros per item; delete temp entries.
- Planned items: preview macros for today’s plan; meal prep entries excluded until execution.
- Meal prep vs regular:
meal_prep = true→ Execute consumes ingredients and produces[MEAL]products for later consumption (not counted today).meal_prep = false→ Mark Done consumes immediately, counts toward macros; toggle slider converts to meal prep.
- Temp items: log off-inventory meals by name + macros.
- Recent days pagination: browse prior history, track trends.
- Target Macros editor: formula
(carbs×4) + (protein×4) + (fats×9)recalculates calories live and persists togrocy_config. - Taste Profile: free-form preferences powering planning filters.
- Example: log “Protein Shake” (200 cal / 30 g protein), mark “Chicken Breast” done (300 cal / 50 g protein), confirm dashboard hits 1500/2500 cal & 150/180 g protein before updating targets to 300 g carbs / 200 g protein / 80 g fats → 2720 cal.
- Filters: “Can Be Made”, protein-per-100-cal slider, carbs-per-100-cal slider, Active Time limit, Total Time limit.
- Cards show name, servings, per-serving + total macros, active/total time, macro-density percentiles, and “Add to Meal Plan”.
- Example: enable “Can Be Made”, protein 10–15 g/100 cal, max active 15 min → pick “Grilled Chicken Salad” (25 min total, 40 g protein, 350 cal), add to tomorrow, ingredients auto-reserved.
- Meal Plan → Cart Sync: runs 7-day diff; adds recipe ingredients + regular meal products, excludes meal-prep outputs and
[MEAL]products, rounds to full containers, flags placeholders capped at one unit. - Shopping cart links: generates “Product Name: Walmart URL” list for quick cart creation.
- Import Shopping List: purchases all non-placeholder items, updates stock, clears the list.
- Add Below Minimum Stock: scans catalog for deficits, subtracts items already on the list, queues remaining amounts.
- Manual management: agent tools add/remove/clear entries as needed.
- Example: run “Add Below Minimum Stock” (8 items), review list, “Get Cart Links”, order, then “Import Shopping List” after delivery.
- Missing links workflow: loads 5 products at a time, fetches 4 Walmart options each (with images + price), lets users pick best match or “Not Walmart”, bulk “Update All” stores choice and fetches next batch.
- Missing prices workflow: shows “Not Walmart” items lacking price; user enters values and bulk updates.
- Automatic price updates: “Start Price Update” fires 5 parallel workers to refresh prices on linked Walmart products, tracks progress, respects rate limits, strips tracking params, handles variations gracefully.
- Example: after scanning 20 new items, iterate batches to map every link, then keep weekly auto-update on for cart accuracy.
| Category | Tools | Purpose |
|---|---|---|
| Inventory | GROCY_GET_Inventory, GROCY_UPDATE_AddProductQuantity, GROCY_UPDATE_ConsumeProduct |
Read stock, purchase/add quantity, consume/remove quantity (with macro logging) |
| Products | GROCY_GET_Products, GROCY_ACTION_CreateProduct, GROCY_ACTION_CreatePlaceholder |
Inspect catalog, create real products, create planning placeholders |
| Shopping List | GROCY_GET_ShoppingList, GROCY_ACTION_AddToShoppingList, GROCY_ACTION_RemoveFromShoppingList, GROCY_ACTION_ClearShoppingList, GROCY_ACTION_AddBelowMinStockToShoppingList |
Read, add, remove, clear, or bulk-add below-minimum items |
| Meal Plan | GROCY_GET_MealPlan, GROCY_ACTION_AddMealToPlan, GROCY_ACTION_MarkMealDone, GROCY_ACTION_DeleteMealPlanEntry |
Inspect schedules, add entries (including meal_prep flag), mark done, delete |
| Recipes | GROCY_GET_Recipes, GROCY_GET_Recipe, GROCY_ACTION_CreateRecipe, GROCY_ACTION_UpdateRecipe, GROCY_ACTION_AddRecipeIngredient, GROCY_GET_CookableRecipes |
Manage recipes and ingredients, find cookable options |
| Macro Tracking | GROCY_GET_DayMacros, GROCY_ACTION_CreateTempItem, GROCY_ACTION_DeleteTempItem |
Review macro timeline, log/remove temp items |
| Price Management | GROCY_ACTION_SetProductPrice |
Update manual prices (especially non-Walmart items) |
- Inventory inquiry: “What’s in my inventory?” →
GROCY_GET_Inventorylists Milk (2 units, 3 days left), Eggs (12 units, 7 days), etc. - Shopping assistance: “Add milk to my shopping list” →
GROCY_ACTION_AddToShoppingListensures minimum stock is reached. - Recipe suggestions: “What recipes can I make right now?” →
GROCY_GET_CookableRecipesreplies with Protein Shake, Chicken Salad, etc. - Macro logging: “I ate a protein bar (200 cal/20 g protein)” →
GROCY_ACTION_CreateTempItem, confirms updated totals. - Meal planning: “Add recipe 5 to tomorrow” or “Add recipe 12 to Sunday as meal prep” →
GROCY_ACTION_AddMealToPlanwith/withoutmeal_prep=true.
goal_calories,goal_carbs,goal_protein,goal_fats– macro goals behind dashboard bars.taste_profile– free-form dietary preferences.day_start_hour– hour macro tracking resets (default 6 = 6 AM).- Edit via 🎯 Target Macros / 📝 Taste Profile modals.
- Keep automation enabled so recipe macros, shopping lists, and meal products update every minute.
- Define
min_stock_amountfor staples to unlock below-minimum automation. - Use placeholder products during planning when inventory isn’t purchased yet.
- Run/auto-run Walmart price updates weekly for accurate cart values.
- Mark meal-plan entries done immediately after eating to protect macro history.
- Review “Recent New Items” after bulk scanning to correct names/locations.
- Batch Walmart link processing (5 products at a time) and mark non-Walmart sources to skip future scrapes.
- Track Costco/farmers-market goods as “Not Walmart” so automation ignores them.
- Barcode scan fails: confirm Walmart carries the product or create it manually.
- Macros missing: ensure entries are marked “done” and temp items use today’s date.
- Walmart scraping errors: heavy traffic may trigger throttling; retries occur automatically, but mark unavailable items as “Not Walmart”.
- Shopping list import fails: placeholders can’t be purchased; verify quantity units and stock requirements.
- Logs: inspect
logs/chefbyte_ui.logfor UI/runtime issues.
- Prereqs: Node.js v18+, npm.
- Clone:
git clone https://github.com/yourusername/chefbyte.git cd chefbyte - Install:
npm install # root cd frontend && npm install cd ../ui && npm install
- Run dev server (preferred):
cd apps/web vercel dev- App:
http://localhost:3000 - Supabase:
http://localhost:54321(runnpx supabase startfirst)
- App:
- Initialize/start local services via commands in Phase 1.
- Regenerate types whenever schema changes:
supabase gen types typescript --local \ > apps/web/src/lib/database.types.ts
apps/web/api/walmart-scrape.ts– validates Supabase JWT, scrapes Walmart, returns product data.apps/web/api/liquidtrack.ts– validatesx-api-key, fetchesuser_idfromdevice_keys, inserts intoliquid_eventswith service-role key.apps/web/api/analyze-product.ts– authenticates user, fetches OpenFoodFacts, calls OpenAI to normalize metadata.- Test locally via
vercel dev.
- Export from legacy Postgres:
pg_dump -h 192.168.0.239 -U postgres -d chefbyte --data-only > backup.sql - Transform CSV/SQL (inject Supabase
user_id, fix foreign keys). - Import into Supabase local:
psql -h localhost -p 54322 -U postgres -d postgres < backup.sql - Repeat for production once Supabase cloud is provisioned.
- Auth (sign up/login/logout/persistence).
- Products CRUD + barcode.
- Recipes CRUD + macro recompute.
- Meal plan add/execute/done.
- Shopping list add/import.
- Macro dashboard accuracy.
- LiquidTrack ingestion.
- Walmart scraping success.
- Import/Export (JSON backup/restore).
- Supabase cloud project: run
001–003migrations, enable RLS. - Vercel deploy: connect repo, set
VITE_SUPABASE_URL,VITE_SUPABASE_ANON_KEY,SUPABASE_SERVICE_ROLE_KEY, plus any OpenAI/Walmart secrets. - Landing page: static marketing + login CTA.
- Data migration: export from local, map to production
user_id, import. - Validate serverless functions (Walmart, LiquidTrack, Analyze Product).
- Execute full testing checklist against production.
ui/data/automation_config.json– automation preferences.ui/data/automation_log.json– last 50 automation runs.
- Primary log file:
logs/chefbyte_ui.log. - Reference this CLAUDE guide, Supabase Studio, and Vercel dashboards for incident triage.
Last updated: November 2025