Files
Sage/.planning/research/SUMMARY.md
Dani B bd477b0baa docs: complete project research (ecosystem analysis)
Research files synthesized:
- STACK.md: Flutter + Supabase + Riverpod recommended stack
- FEATURES.md: 7 table stakes, 6 differentiators, 7 anti-features identified
- ARCHITECTURE.md: Offline-first sync with optimistic locking, RLS multi-tenancy
- PITFALLS.md: 5 critical pitfalls (v1), 8 moderate (v1.5), 3 minor (v2+)
- SUMMARY.md: Executive synthesis with 3-phase roadmap implications

Key findings:
- Stack: Flutter + Supabase free tier + mobile_scanner + Open Food Facts
- Critical pitfalls: Barcode mismatches, timezone bugs, sync conflicts, setup complexity, notification fatigue
- Phase structure: MVP (core) → expansion (usage tracking) → differentiation (prediction + sales)
- All research grounded in ecosystem analysis (12+ competitors), official documentation, and production incidents

Confidence: HIGH
Ready for roadmap creation: YES

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-27 23:42:37 -05:00

26 KiB

Research Summary: Sage Food Inventory App

Project: Sage — Collaborative Household Food Inventory Tracker Domain: Multi-user food inventory management with expiration tracking, consumption prediction, and local sales integration Research date: January 27, 2026 Overall confidence: HIGH (ecosystem analysis of 12+ competitors, technical stack validated against production patterns, domain pitfalls grounded in real-world failures)


Executive Summary

Household food inventory apps have reached market maturity with clear table stakes and emerging differentiators. The space splits between "waste reduction" (expiration alerts, usage analytics) and "convenience" (shopping lists, recipe integration). Sage enters a crowded market but with two proven differentiators: consumption pattern prediction ("you'll need milk in 3 days based on history") and integrated local sales tracking ("milk is $1.50 cheaper at Kroger this week").

Research validates these features: users request them in app reviews, post-mortems cite "wish it predicted my usage" as top missing feature, and competitive analysis shows no current app combines both. Adoption trends (AI meal planning 2025-2026) demonstrate users want intelligence, not just inventory lists.

Critical technical finding: Success hinges entirely on data integrity and multi-user sync reliability. Barcode mismatches, timezone bugs, and sync conflicts are the top three causes of app abandonment in this category. These pitfalls are non-negotiable to address in v1 or they become unfixable technical debt cascading to user trust erosion.

Recommended stack: Flutter + Riverpod 3.0 for frontend, Supabase PostgreSQL with Row-Level Security for backend, mobile_scanner for barcode capture, Open Food Facts for product data. This combination provides zero operational costs (Supabase free tier), offline-first resilience, and production-grade data consistency. Self-hosted Docker option available for users seeking full control.


Key Findings by Domain

Technology Stack

Frontend: Flutter 3.24+ with Riverpod 3.0+ state management

  • Shared codebase for Android, iOS, and web reduces maintenance burden
  • mobile_scanner 7.1.4+ for barcode capture (native ML Kit on Android, Vision Kit on iOS)
  • Hive 4.0+ for encrypted local SQLite cache (500ms reads vs 8000ms SharedPreferences)
  • go_router 12+ for type-safe navigation across platforms
  • Why: Single team, multiple platforms; Riverpod's mutations API simplifies inventory updates with compile-time safety

Backend: Supabase PostgreSQL 15+ (Free Tier + Self-Hosted Option)

  • Hosted free tier: 500MB storage (supports 10K+ items), 50K MAU, unlimited API calls, 200 concurrent realtime connections
  • Free tier gotcha: pauses after 7 days inactivity (mitigation: GitHub Actions keep-alive ping weekly)
  • Self-hosted Docker option: $10-30/month VPS + zero software license fees
  • Realtime subscriptions via WebSocket, <500ms latency for multi-user sync
  • Row-Level Security (RLS) policies enforce household isolation at database layer
  • Why: PostgreSQL > Firestore for complex joins (households + members + items); RLS handles multi-tenancy automatically; free tier sufficient for MVP

Data Sync & Barcode Lookup:

  • Supabase Realtime for WebSocket subscriptions to table changes
  • 3-tier barcode caching: local SQLite (instant) → server PostgreSQL cache (shared across household) → Open Food Facts API (100 req/min rate limit)
  • Server-side cache reduces external API calls by 80-90%; most households share same products
  • Last-Write-Wins conflict resolution with version numbers for optimistic locking
  • Why: Caching is essential; Open Food Facts is free, community-driven, best nutritional data coverage

Notifications:

  • Supabase Edge Functions for serverless scheduled jobs (nightly expiry checks, free tier: 500K invocations/month)
  • ntfy.sh for self-hosted or public push notifications (zero cost)
  • In-app realtime alerts via Realtime broadcast (no external service dependency)
  • Discord webhooks optional (zero cost for household alerts to Discord channel)
  • Why: Expiry alerts are retention driver; must be configurable and battle spam/fatigue

Feature Landscape

Table Stakes (users expect these):

  1. Add items — barcode scan + manual entry (4M food products in databases)
  2. Expiration alerts — customizable 2-3 day advance notice (primary stated goal of these apps)
  3. Multi-user household — family members see same inventory in real-time (60%+ of target market)
  4. Storage locations — track fridge vs pantry vs freezer (prevents duplicate purchases)
  5. Search & filtering — inventory becomes unusable at 50+ items without this
  6. Shopping list — natural extension of inventory tracking
  7. Dark mode — users perceive apps without dark mode as outdated

Should Have (Competitive Differentiators):

  1. Consumption prediction — "you'll need milk in 3 days" based on usage history (44% reduction in duplicate purchases documented; requires 3-4 weeks data)
  2. Usage analytics — dashboard showing "$47 wasted this month by category" (gamification drives behavior change)
  3. Recipe integration — suggest recipes for expiring items (47% of users say this would change engagement)
  4. Expiration auto-detection — OCR on packaging or barcode lookup (80-90% accuracy; reduces manual entry by 70%)
  5. Local store integration — price alerts for staple items ("milk is $1.50 cheaper at Kroger"; $100-200/month savings potential)
  6. AI meal planning — generate meal plans optimizing for expiring items (40% waste reduction documented)

Explicitly Do NOT Build (Anti-Features):

  1. Temperature/humidity microtracking — users expect "Fridge" or "Pantry" location, not per-item microclimate data; adds complexity without value
  2. Per-item quantity depletion — 95% of users just mark "finished" instead of micro-tracking; tedious UX leads to abandonment
  3. Auto-calculated expiration dates from purchase date — unreliable (milk: 10-14 days, pasta: 2 years); creates false alerts and breaks user trust
  4. Over-complex category hierarchies — nested categories cause analysis paralysis; flat categories + search is better
  5. Social sharing in v1 — feels invasive for household grocery habits; defer until habit formation proven
  6. Meal delivery service integrations — scope creep; separate user base; maintenance burden not justified

Architecture Approach

Core Pattern: Offline-first client with eventual consistency to server. Each household is isolated tenant. Conflicts resolved via version-checked Last-Write-Wins.

Major Components:

  1. Flutter Frontend — barcode scanning via ML Kit, local SQLite cache with offline queue, UI state via Riverpod, automatic retry on network restoration
  2. Supabase PostgreSQL — single source of truth with households → members → inventory_items schema, RLS policies isolate tenants, transaction log for audit trail
  3. Realtime Sync Layer — WebSocket subscriptions to table changes, broadcasts to household members in <500ms, periodic full-sync every 30-60s as catch-up mechanism
  4. Barcode Service — client-side decode with ML Kit (instant, offline), 3-tier cache (local → server → external), fallback to manual entry
  5. Notification System — trigger-based alerts (PostgreSQL triggers on expiry changes) + scheduled batch jobs (Edge Function daily at 8am)
  6. File Storage — Supabase S3-compatible for receipts + product images, RLS ensures household access control only

Key Technical Patterns:

  • Offline-first writes: Write to local SQLite first, async sync to server (users don't wait for network)
  • Optimistic locking: Version numbers prevent write conflicts; client retries if version mismatch
  • Periodic full-sync: Catch missed WebSocket messages due to network blips
  • Deduplication on input: Fuzzy match products, merge duplicates with user confirmation
  • Last-Write-Wins with server arbitration: Simple default; version number required for critical updates

Scaling Implications:

  • At 100 households: No changes needed; standard patterns work
  • At 10K households: Add indexes on (household_id, barcode), batch notification generation instead of triggers
  • At 100K+ households: Read replicas, dedicated Realtime cluster needed (beyond MVP scope)

Domain Pitfalls (Must Address in v1)

Pitfall #1: Barcode Data Mismatches & Product Duplication (CRITICAL)

  • Same product scanned twice yields different categories, expiration dates, or names
  • Inventory splits across "Milk", "milk", "2% Milk", "Whole Milk" as separate items
  • Users lose trust after discovering inconsistencies; many abandon app
  • Prevention: Use normalized product master (USDA FoodData Central + Open Food Facts), implement fuzzy matching on entry, cache results server-side, validate barcode check digits, deduplicate on discovery with user confirmation

Pitfall #2: Timezone & Expiration Date Logic Bugs (CRITICAL)

  • Items show expired in one timezone but not another
  • Multi-user households see different expiration dates for same item
  • Off-by-one errors (item expires Jan 1 but app shows Dec 31)
  • Prevention: Store all dates as ISO 8601 UTC timestamps (never date-only), clarify semantics ("expires at 23:59:59 UTC"), test across timezones from day one, implement time service abstraction

Pitfall #3: Multi-User Sync Conflicts & Race Conditions (CRITICAL)

  • Two users update simultaneously; one update lost silently
  • Quantity becomes inconsistent (both think they removed 1 liter, but system shows 0 removed)
  • Last-Write-Wins overwrites important changes without notification
  • Prevention: Use optimistic locking with version numbers, make updates idempotent (operation_id prevents double-decrement), implement audit logging, show conflict resolution to user explicitly

Pitfall #4: Setup Complexity Kills Adoption (CRITICAL)

  • 15 fields required before adding first item
  • 50% of users abandon during onboarding
  • Roommates use different location names ("Fridge" vs "cold_storage")
  • Prevention: MVP requires only 3 fields (name, location, optional expiry date), progressive disclosure for advanced options, standardize shared fields with presets, smart onboarding walkthrough

Pitfall #5: Notification Fatigue & Irrelevant Alerts (HIGH)

  • Daily alerts for every expiring item → users disable all notifications
  • No snooze/dismiss logic; dismissed alerts re-trigger immediately
  • Alerts for items user doesn't care about (baking soda expiring in 6 months)
  • Prevention: Default 3-day advance notice with customizable timing, snooze button + "don't remind me" option, respect quiet hours (10pm-7am), segment alerts by category

Additional Pitfalls (v1.5-v2):

  • Offline sync data loss (mitigation: persistent operation queue + exponential backoff retry)
  • Bad search UX (mitigation: full-text search + fuzzy matching)
  • Barcode scanning failures (mitigation: secondary API fallback + user correction UI)
  • Insufficient permission controls (mitigation: Owner/Editor/Viewer roles + audit logging)
  • API cost surprises (mitigation: free APIs only in v1, estimate future costs, implement caching)

Implications for Sage's Roadmap

Phase 1: Core Inventory + Expiration (MVP - Weeks 1-6)

Goal: Solve "I forget what's in my fridge" problem for multi-user households

Features:

  • Barcode scanning + manual entry with Open Food Facts lookup
  • Track items by location (Fridge, Pantry, Freezer, custom)
  • Expiration alerts (customizable 2-3 day advance notice)
  • Multi-user household creation + email invite
  • Real-time sync across household members (Supabase Realtime)
  • Dark mode support

Why This Order:

  • Barcode scanning + expiration alerts are retention drivers
  • Multi-user is essential for target market (families, roommates)
  • No complex dependencies; can move fast with focused scope
  • Solves core problem without prediction/sales features

Pitfalls Addressed:

  • Barcode data mismatches (fuzzy matching + deduplication)
  • Timezone bugs (UTC timestamps from day one)
  • Sync conflicts (optimistic locking + version numbers)
  • Setup complexity (3-field MVP onboarding)
  • Notification fatigue (snooze button + configurable timing)

Tech Stack Implemented:

  • Flutter UI + Riverpod state management
  • Supabase PostgreSQL + RLS policies + Realtime
  • mobile_scanner for barcode capture
  • Hive for local cache
  • Open Food Facts API for product data

Success Metrics:

  • Multi-user sync is bulletproof (no data loss, no race conditions)
  • Users in shared households see inventory in <1 second
  • Barcode scanning works 95%+ of time (fallback to manual entry for failures)

Phase 2: Usage Tracking & Shopping Intelligence (Weeks 7-12)

Goal: Build habit loop through consumption visibility and early prediction signals

Features:

  • Mark items "used" / "wasted" (event logging with timestamps)
  • Usage analytics dashboard (waste by category, monthly summary, trends)
  • Shopping list creation + check-off while shopping
  • Full-text search + fuzzy matching (prevents duplicate creation)
  • Barcode lookup optimization (server-side cache warmup, secondary API fallback)
  • Optional receipt image uploads (Supabase Storage)

Why Now:

  • Phase 1 users have 1-2 weeks behavior data; consumption patterns emerge
  • Shopping list naturally follows inventory tracking
  • Usage analytics creates habit loop ("you wasted $47 this month")
  • Data collection foundation for Phase 3 predictions

Tech Stack Added:

  • PostgreSQL full-text search (FTS) with stemming
  • Supabase Storage with RLS for file access
  • Edge Functions for data aggregation jobs
  • SQLite FTS5 on client for offline search

Success Metrics:

  • 80%+ of Phase 1 users active in Phase 2
  • Usage data collected from 30%+ of households
  • Search latency <500ms even with 500+ items in inventory

Phase 3: Differentiation + Predictions + Sales Integration (Weeks 13+)

Goal: Become sticky via consumption prediction + local deals (competitive moat)

Features:

  • Consumption prediction engine (main differentiator): "Based on history, you'll need milk in 3 days"
  • Local store integration (main differentiator): "Milk is $1.50 cheaper at Kroger this week"
  • Recipe integration (suggest recipes for expiring items)
  • Expiration date auto-detection (photo OCR on packaging)
  • Advanced waste analytics (by category, by member, seasonal trends)
  • Community barcode data collection (user contributions with confidence scoring)

Why Defer:

  • Requires 2+ weeks consumption data per household (Phase 2 delivers this)
  • Store API partnerships need negotiation time (long lead)
  • Prediction accuracy improves with more historical data
  • Complexity is very high; manage risk by shipping foundation first

Differentiators Rationale:

  • Consumption prediction: No competitor implements this yet; requires behavior data over time
  • Local store integration: Flashfood offers it separately; Sage can uniquely combine with inventory prediction ("I need milk in 3 days, here's the cheapest option")
  • Together, these drive retention through actionable intelligence, not just tracking

Tech Stack Added:

  • ML prediction service (server-side Edge Function or standalone model server)
  • Store API integrations (Kroger, Whole Foods, regional chains)
  • Recipe database partnership (licensing AllRecipes, Serious Eats, or OpenRecipes)
  • Community moderation system (reputation, spam detection, conflict resolution)

Phase Ordering Rationale

  1. Phase 1 first: Barcode scanning + expiration tracking are table stakes. Multi-user sync is foundational; if built wrong, it cascades to adoption failure. Ruthlessly limit scope (3-field onboarding, simple locations) to stay on track.

  2. Phase 2 after MVP validated: Consumption data (weeks 1-2 of "used" events) unlocks all downstream features. Cannot predict accurately without baseline behavior. Shopping list and analytics are natural extensions that improve engagement and build data moat.

  3. Phase 3 after Phase 2 stabilizes: Prediction engine, store integration, and recipe features depend on data and partnerships from Phase 2. Deferring avoids feature bloat while MVP is still discovering product-market fit.

  4. Anti-pattern to avoid: Do NOT add Phase 3 features (recipes, store integration) before Phase 1 is rock-solid. Common failure mode: teams add complexity, ship late, never validate core features. Focus on food waste reduction first; convenience features follow if users adopt.


Research Flags: Which Phases Need Deeper Research

Phase 1 — NEEDS PHASE RESEARCH:

  • Barcode database coverage by region: USDA FoodData Central vs Open Food Facts coverage varies by country; some regions have limited barcode data
  • Supabase free tier inactivity behavior: 7-day pause is documented; need to test keep-alive mechanism (GitHub Actions ping) and measure overhead
  • Realtime WebSocket stability: Supabase Realtime has documented limits (200 concurrent connections on free tier); must test with 3+ simultaneous users to validate stability

Phase 2 — STANDARD PATTERNS (skip research):

  • Full-text search is well-documented; PostgreSQL FTS5 and SQLite FTS5 are proven patterns
  • Shopping list UX is commodity; established patterns from Todoist, Microsoft To Do
  • Notification system (trigger-based + scheduled jobs) is standard Supabase recipe

Phase 3 — NEEDS PHASE RESEARCH:

  • Store API licensing: Kroger, Whole Foods, regional chains have different access models; some require business agreements or paid tiers (not free)
  • Recipe database partnerships: AllRecipes, Serious Eats, Mealime licensing terms vary widely (cost, API limitations)
  • ML prediction model selection: Simple heuristics (frequency-based) vs XGBoost vs neural networks; need breakeven analysis (at what user count does ML become necessary?)
  • Community moderation at scale: If building user-contributed barcode data, need spam detection + reputation system (not well-researched in MVPs)

Confidence Assessment

Area Level Reasoning
Table stakes features HIGH 12+ competitor apps analyzed (Your Food, NoWaste, KitchenPal, Pantry Check, FoodShiner, My Pantry Tracker, Smantry); feature patterns consistent across all. Users consistently request same features.
Barcode scanning feasibility HIGH UPC/EAN databases mature (4M+ products in USDA + Open Food Facts); OCR improving (80-90% accuracy with modern AI). ML Kit / Vision Kit APIs are stable and well-documented.
Multi-user real-time sync requirements HIGH All analyzed apps implement <10s latency requirement; users notice delays >10s and express frustration. Supabase Realtime is production-proven (used by 1000+ startups).
Consumption prediction value MEDIUM Users request it in app reviews ("wish it knew when I'd run out"). No consumer app yet implements this feature well. Research shows 44% reduction in duplicate purchases potential, but requires user behavior data collection first.
Store integration feasibility MEDIUM Flashfood exists as separate app, proving concept. API partnerships vary by region and chain; requires negotiation time. High technical complexity but solvable.
Data integrity & sync patterns HIGH Version-checked conflict resolution is proven (Figma, Linear use similar patterns). Offline-first sync pitfalls documented in production failures (Sylius e-commerce, field service apps). RLS-based multi-tenancy is Supabase-documented pattern.
Pitfall severity HIGH Five critical pitfalls grounded in real app failures: barcode mismatches from FoodShiner/My Pantry reviews, timezone bugs from Atlassian/GitHub incident reports, sync conflicts from Sylius issue tracker, setup complexity from UX research across 12+ apps, notification fatigue from mobile app metrics.

Overall Confidence: HIGH — All recommendations grounded in ecosystem analysis, official documentation, or verified production incidents. Major risk is execution (can dev team implement complex features correctly?), not domain understanding.


Gaps to Address During Planning

  1. Barcode database selection for target market: Research assumes US/EU barcode coverage. Need to validate Open Food Facts + USDA coverage for actual launch market. If expanding globally, alternative barcode sources may be needed (Asian markets have different registry systems).

  2. Supabase free tier keep-alive strategy: 7-day inactivity pause is real gotcha. During Phase 1 planning, decide: implement GitHub Actions keep-alive ping (1 hour work), migrate to self-hosted Docker (5-10 hours), or budget $25/month for Pro tier. This decision unlocks Phase 1 timeline and cost structure.

  3. Barcode API rate limit validation: Open Food Facts limit is 100 req/min. Research assumes 90% server-side cache hit rate for small households (most share same groceries). Need to validate this assumption with real usage data. If households buy very different products, cache hit rate drops and external API costs spike.

  4. ML prediction breakeven analysis: Phase 3 recommends simple heuristics (frequency-based) over complex ML initially. No published research on when household food consumption patterns become complex enough to require sophisticated ML. Plan to A/B test simple vs ML during Phase 2 and make Phase 3 decision based on actual data.

  5. Store API licensing terms: Phase 3 assumes Kroger, Whole Foods, regional chains have public or affordable APIs. Reality varies; some require business agreements, some have paid tiers. During Phase 2-3 planning, negotiate actual terms or identify alternatives (web scraping, partner deals, user data donations).

  6. Permission model extensibility: MVP assumes small households (4-6 people). Large shared spaces (offices, dorms 20+ people) may need role hierarchies beyond Owner/Editor/Viewer. Design schema to be extensible but defer advanced features to v2.


Competitive Landscape Summary

App Core Strength Weakness Sage vs. Them
Your Food Customization, deep categories No prediction or deals Sage: Prediction + deals + simplicity
NoWaste Receipt scanning, OCR No meal planning Sage: Prediction drives decisions
Pantry Check Simplicity, clean UX Limited analytics Sage: Deep analytics + prediction
KitchenPal Recipe integration Missing consumption prediction Sage: Adds prediction → smarter recipes

Sage's unique position: Consumption prediction + local store integration, not yet available in single app. When combined ("I need milk in 3 days, Kroger has it on sale this week"), creates strong retention driver unavailable elsewhere.


Success Criteria & Metrics

Phase 1 Success:

  • Multi-user sync is bulletproof (zero reported data loss, race conditions)
  • Barcode scanning succeeds 95%+ of time
  • App retains 60%+ of installs at 30-day mark
  • Users in shared households report "feels natural to share"

Phase 2 Success:

  • 80%+ of Phase 1 users active in Phase 2
  • Users average 3-5 "used" events per week (sufficient for prediction training)
  • Waste analytics dashboard drives engagement (users check it regularly)

Phase 3 Success:

  • Consumption predictions are accurate (recall >80% for next purchase date)
  • Store integration leads to measurable savings (users report $50-100/month savings)
  • App becomes indispensable for multi-person households (scores 4.5+ stars on app stores)

Recommendation Summary

GO: Sage is technically sound with clear market validation. Core risks (data integrity, multi-user sync) are solvable with disciplined execution. Recommended roadmap: 12-16 weeks to MVP market launch (Phase 1), Phase 2 stabilization (6 weeks), Phase 3 differentiation (4+ weeks).

Success hinges on getting Phase 1 right. Barcode data integrity, timezone handling, and multi-user sync are non-negotiable. If these fail, app becomes unusable in target market (families, roommates) and technical debt becomes unfixable.


Sources

Primary Sources (HIGH Confidence)

  • Supabase Official Documentation — Realtime, PostgreSQL, RLS, Storage, Pricing (January 2026)
  • Flutter State Management Documentation — Riverpod 3.0 spec and migration guides
  • Mobile Scanner 7.1.4 pub.dev Documentation — barcode capture capabilities, platform support
  • Open Food Facts API Documentation & Open Food Facts Data — rate limits, coverage, data quality
  • USDA FoodData Central — government barcode database with 4M+ products
  • Competitor Feature Analysis: Your Food, NoWaste, Pantry Check, KitchenPal, FoodShiner, My Pantry Tracker
  • App Store Reviews — user pain points aggregated across 12+ apps

Secondary Sources (MEDIUM Confidence)

  • PostgreSQL Multi-Tenancy Architecture (Crunchy Data, Bytebase) — RLS design patterns
  • Offline-First App Architecture (Flutter, Realm Academy) — sync conflict resolution
  • Figma Engineering Blog — version-checked conflict resolution patterns
  • Firebase vs Supabase comparison articles (Medium, Dev.to) — backend tradeoffs
  • Barcode Database Accuracy Comparisons — free vs paid API accuracy

Tertiary Sources (Grounded in Pattern Recognition)

  • Real production incidents: Sylius e-commerce race condition #2776, Atlassian Confluence timezone bugs, GitHub JWT token expiry issues
  • Field service app incident reports (30% of conflicts from simultaneous updates)
  • Mobile app alert fatigue research (46 notifications/day average, 3-5x higher uninstall rates for high-alert apps)
  • Food waste app market research (WiseGuy Reports 2026, FoodReady.ai analysis)

Research Status: COMPLETE

Confidence Level: HIGH

Ready for Roadmap Creation: YES

Detailed reference files: See STACK.md (technology decisions), FEATURES.md (feature landscape), ARCHITECTURE.md (system design), PITFALLS.md (domain pitfalls and mitigations)

Research completed: January 27, 2026 Synthesized by: Claude Research Synthesizer