# Phased Development & MVP Milestone Plan: GLP-1 Companion Platform
**Document Version:** 1.0.0
**Target Runtimes:** iOS, Android, Web, macOS, Windows
**Framework:** Flutter 3.x (Dart 3.x)
**Methodology:** Incremental Agile with Verifiable End-of-Phase Demonstrations
---
## 1. Executive Summary
This document outlines the sequential, milestone-driven execution strategy for building the cross-platform GLP-1 Companion. To minimize delivery risk and validate core UX assumptions early, the roadmap is divided into six autonomous phases. Each phase culminates in an isolated, independently testable **Minimum Viable Product (MVP)** capable of being demonstrated to stakeholders across all supported desktop, web, and mobile runtimes.
---
## 2. Phase-by-Phase Roadmap Matrix
| Phase | Core Deliverable & Scope | Minimum Viable Product (Demo Milestone) | Target Platforms |
|---|---|---|---|
| **Phase 1: Foundation & Identity** | • Multi-platform Flutter scaffolding & runner configs.
• Passwordless auth (Apple, Google, Microsoft OAuth & Magic Links).
• SQLCipher local database & Supabase RLS schema.
• Adaptive app shell (Cupertino/Material 3 responsive layout). | **MVP 1 Demo:** Launch on mobile, desktop, and web. Authenticate via Apple, Google, or Microsoft SSO without a password. Verify session persistence and responsive layout switching. | Android, iOS, Web, macOS, Windows |
| **Phase 2: GLP-1 Tracking & Dose Reminders** | • Medication profile (compound, dose, titration schedule).
• Injection logging with 12-quadrant anatomical site selection.
• Cross-platform scheduled local notifications.
• Pharmacokinetic serum level decay curve visualization. | **MVP 2 Demo:** Schedule a weekly dose regimen, trigger local push notifications, record an injection with dosage/site, and review dosage history and active serum levels. | Android, iOS, Web, macOS, Windows |
| **Phase 3: Nutrition, Health Sync & Weight** | • Food and hydration logger with daily protein target tracking.
• Unified `HealthGateway` (Apple HealthKit & Health Connect).
• Weight & exercise data ingestion with interactive trend graphs.
• Manual biometric fallback interface for Web and Desktop. | **MVP 3 Demo:** Log meals and water intake. Sync weight and workout history directly from Apple Health / Google Health Connect. Demonstrate manual entry fallback on Web/Desktop. | Android, iOS, Web, macOS, Windows |
| **Phase 4: Recipe Importer & Meal Planning** | • Headless recipe scraper (JSON-LD Schema.org parser).
• Recipe catalog with custom portion scaling and macro calculation.
• Weekly drag-and-drop meal planning calendar. | **MVP 4 Demo:** Paste a recipe URL from any mainstream culinary website; verify automatic extraction of ingredients, instructions, and protein counts. Assign meals to a weekly calendar. | Android, iOS, Web, macOS, Windows |
| **Phase 5: Pantry & Auto-Shopping Engine** | • Pantry inventory tracker with low-stock and expiration alerts.
• Delta engine comparing meal plan requirements to pantry stock.
• Consolidated interactive shopping list grouped by grocery aisle. | **MVP 5 Demo:** Generate a weekly meal plan, execute the delta algorithm against current pantry inventory, and produce an organized, checkable shopping list of only missing ingredients. | Android, iOS, Web, macOS, Windows |
| **Phase 6: Hardening, Polish & Extensibility** | • Desktop hotkeys, macOS menu bars, and web SEO/PWA polish.
• Plugin-based feature flag engine for post-launch modules.
• Multi-platform CI/CD release build automation. | **MVP 6 Demo:** Production-ready release candidates running natively on iOS, Android, macOS, Windows, and Web from a single unified codebase. | Android, iOS, Web, macOS, Windows |
---
## 3. Detailed Milestone Breakdowns
### Phase 1: Foundation, Multi-Platform Shell & Identity
#### Objectives
- Initialize platform-specific host runners for iOS, Android, Web, macOS, and Windows.
- Establish the feature-first Clean Architecture directory hierarchy and Riverpod state graph.
- Implement zero-knowledge local encrypted storage (SQLCipher + Drift) and secure OS vault bindings (`flutter_secure_storage`).
- Deliver passwordless authentication via Supabase GoTrue, supporting Apple SSO, Google OAuth, Microsoft Identity, and Email Magic Links.
#### Technical Tasks
1. Execute `flutter create` with explicit platform flags and package identifier.
2. Configure native entitlements:
- iOS / macOS: Associated Domains for universal links, Keychain Sharing.
- Android: Intent filters for deep link scheme handling (`app://glpcompanion`).
- Windows / Web: Redirect URL hooks and OAuth popup/redirect handlers.
3. Build the responsive `AdaptiveHomeScaffold` that toggles dynamically between a mobile bottom bar (`NavigationBar` / `CupertinoTabBar`) and desktop/web side navigation (`NavigationRail`).
4. Implement `core/security/crypto_manager.dart` to provision hardware-backed AES-256 database keys.
#### Verification Criteria (MVP 1 Demo)
- Successfully compile and run the application on Android, iOS, Web, macOS, and Windows.
- Authenticate a new user via Google, Apple, or Magic Link without entering a password.
- Kill and restart the application; verify session persistence and encrypted state recovery.
---
### Phase 2: GLP-1 Pharmacokinetics & Injection Management
#### Objectives
- Provide clinical-grade medication scheduling for Semaglutide, Tirzepatide, and Liraglutide.
- Implement an anatomical 12-quadrant injection rotation tracker to prevent lipohypertrophy.
- Deliver reliable, offline-capable local push notifications for injection days.
- Model active compound serum levels using single-compartment pharmacokinetic decay algorithms.
#### Technical Tasks
1. Construct the `medication` domain layer: entities (`MedicationRecord`, `DoseSchedule`, `InjectionSite`).
2. Build Drift SQLite tables for immutable injection logging.
3. Integrate `flutter_local_notifications` with platform-specific channel handling (Android notification channels, iOS alert permissions).
4. Implement the pharmacokinetic curve calculation:
$$C(t) = \sum_{i=1}^{n} D_i \cdot \left(\frac{1}{2}\right)^{\frac{t - t_i}{t_{1/2}}}$$
5. Build an interactive SVG/CustomPainter injection site selector allowing users to tap abdomen, thigh, or arm zones.
#### Verification Criteria (MVP 2 Demo)
- Define a 5 mg weekly Tirzepatide regimen scheduled for Mondays at 08:00.
- Trigger and observe a scheduled local reminder notification.
- Log an injection on the Right Upper Abdomen and observe the visual body map update to recommend a different quadrant for the subsequent dose.
- Verify the active serum graph accurately charts accumulation and elimination over a 30-day window.
---
### Phase 3: Lean Mass Nutrition, Hydration & Biometric Ingestion
#### Objectives
- Counteract lean muscle wasting and dehydration—common adverse effects of GLP-1 therapy—through daily protein target tracking and hydration volume tracking.
- Deliver the abstract `HealthGateway` boundary to ingest weight and workout metrics from native and remote sources.
#### Technical Tasks
1. Build the `nutrition` feature module: daily macro logs, grams-of-protein tracker, and fluid intake logger.
2. Implement platform implementations of `IHealthGateway`:
- Mobile: Ingest weight and active workout calories via `health` package (Apple HealthKit on iOS, Health Connect SDK on Android).
- Desktop & Web: Expose a clean manual entry modal and OAuth token hooks for third-party cloud REST services (MyFitnessPal, Withings).
3. Implement reactive weight and caloric balance trend charts with smoothing filters.
#### Verification Criteria (MVP 3 Demo)
- Log food items to reach a target of 100g of daily protein; verify macro breakdown displays accurately.
- Connect to Apple HealthKit / Google Health Connect in a simulated environment; import weight history and verify chart plotting.
- Run the Web build, open the biometric log, and manually add weight and exercise entries to confirm desktop/web feature parity.
---
### Phase 4: Web Recipe Ingestion & Weekly Meal Planning
#### Objectives
- Eliminate manual data entry by extracting recipes directly from culinary websites.
- Provide dynamic portion scaling and automatic per-serving protein/calorie calculation.
- Deliver a multi-platform drag-and-drop weekly meal planner.
#### Technical Tasks
1. Implement `RecipeScraperService` to parse `application/ld+json` Schema.org `Recipe` microdata from HTTP response bodies.
2. Implement regex/DOM fallback parsing using Dart `html` parser for non-structured sites.
3. Build a recipe catalog with search, filter, and customizable serving-size scaling.
4. Construct the weekly meal calendar view supporting drag-and-drop assignment of recipes to Breakfast, Lunch, Dinner, and Snack slots.
#### Verification Criteria (MVP 4 Demo)
- Paste a live recipe URL into the importer; verify accurate extraction of title, ingredients, step-by-step instructions, and protein content.
- Scale the recipe from 2 servings to 6 servings; verify all ingredient quantities recalculate proportionally.
- Assign the imported recipe to the weekly meal calendar across multiple days.
---
### Phase 5: Smart Pantry Inventory & Delta Shopping Engine
#### Objectives
- Track on-hand food inventory to minimize food waste and duplicate purchases.
- Implement the "Smart Delta" calculation engine: compare weekly meal plan requirements against pantry inventory to generate an optimized grocery list.
#### Technical Tasks
1. Construct the `pantry` domain module: item quantities, units of measurement, and expiration dates.
2. Implement the automated delta engine algorithm:
$$\text{Required Quantity} - \text{In-Stock Quantity} = \text{Delta Needed}$$
3. Categorize generated shopping items automatically into standard grocery aisles (Produce, Meat/Seafood, Dairy, Dry Goods).
4. Provide interactive, checkable shopping list items that automatically transition into pantry stock upon purchase confirmation.
#### Verification Criteria (MVP 5 Demo)
- Populate the pantry with baseline ingredients (e.g., 300g chicken breast, 2 eggs).
- Create a weekly meal plan requiring 800g chicken breast and 6 eggs.
- Run the automatic shopping list generator; confirm the resulting list requests exactly 500g chicken breast and 4 eggs.
- Check off an item on the shopping list and verify it automatically increments pantry stock.
---
## 4. Phase 6: Hardening, Extensibility & Release Engineering
#### Objectives
- Optimize UX ergonomics for desktop (keyboard shortcuts, multi-window support) and web (responsive breakpoints, browser history navigation).
- Establish the modular plugin architecture to allow subsequent features (e.g., CGM Bluetooth LE telemetry, Telehealth portals) to be registered without refactoring core code.
- Automate multi-platform CI/CD build and signing pipelines.
#### Technical Tasks
1. Register desktop hotkeys (`Cmd/Ctrl + N` for quick food entry, `Cmd/Ctrl + D` for quick dose log).
2. Configure GitHub Actions / Fastlane build matrix targeting iOS IPA, Android AAB, Web static bundle, macOS DMG, and Windows MSIX installers.
3. Finalize static analysis, security audits, and automated unit/widget/integration test suites across all layers.
#### Verification Criteria (MVP 6 Demo)
- Execute `flutter analyze` and `flutter test` with 100% pass rates and zero linter warnings.
- Demonstrate production release candidate artifacts running natively on all five target operating environments from the unified repository.