BabyFeed Sync

Health

Original Idea

Baby Feeding Tracker A mobile app that syncs between caregivers and exports pediatric-friendly summaries.

Product Requirements Document (PRD): BabyFeed Sync

1. Executive Summary

BabyFeed Sync is a high-performance, mobile-first health application designed to bridge the communication gap between multiple caregivers (parents, nannies, grandparents) and healthcare providers. By leveraging a local-first, event-sourced architecture and AI-driven predictive analytics, the app provides real-time synchronization of feeding, diapering, and sleep logs. The platform culminates in clinical-grade, PDF-formatted pediatric summaries that utilize validated growth percentile curves, ensuring parents arrive at checkups with actionable, data-backed insights.

2. Problem Statement

Caregivers of infants face significant "information fragmentation." When multiple people care for a child, critical data regarding intake amounts, hydration (diaper frequency), and sleep patterns are often lost in translation or stored in disparate physical logs. This leads to:

  1. Safety Risks: Potential overfeeding, underfeeding, or missed medication doses.
  2. Parental Anxiety: Lack of visibility into a baby's day while a parent is at work.
  3. Inaccurate Clinical Data: Pediatricians receive vague, anecdotal reports during checkups instead of precise, trend-based data.

3. Goals & Success Metrics

  • Zero Sync Conflicts: Achieve 100% data integrity across multiple devices using Hybrid Logical Clocks (HLC).
  • Caregiver Adoption: Target a Daily Active User (DAU) to Monthly Active User (MAU) ratio of >60% (High stickiness).
  • Clinical Utility: >40% of users generating at least one PDF export per month.
  • Performance: UI responsiveness of 60fps and local logging latency of <100ms.

4. User Personas

| Persona | Description | Key Need | | :--- | :--- | :--- | | The Primary Parent | Working or stay-at-home parent managing the "big picture." | Needs to see real-time status and long-term trends. | | The Professional Nanny | Paid caregiver managing daytime shifts. | Needs a frictionless, "one-handed" logging interface. | | The Pediatrician | Data consumer during 15-minute checkups. | Needs standardized, easy-to-read growth and intake summaries. |

5. User Stories

  • As a parent, I want to invite my nanny to my baby’s profile so we can both log activities in real-time.
  • As a caregiver, I want to start a breastfeeding timer on my phone and have the other parent see it running on theirs.
  • As a user in a basement/dead-zone, I want to log a feeding offline and have it sync automatically when I regain signal.
  • As a parent, I want to generate a PDF of the last 30 days of growth data to email to my doctor before our appointment.
  • As a parent, I want the app to predict when the next feeding is likely to happen so I can plan my errands.

6. Functional Requirements

6.1. Core Logging & Sync

  • Event-Sourced Logs: All activities (feeds, diapers, sleep) are saved as unique, immutable events to prevent "last-write-wins" conflicts.
  • Multi-Mode Feeding: Support for breastfeeding (L/R timers), bottle volume (ml/oz), and solid food descriptions.
  • Live Timers: Shared real-time timers for breastfeeding and sleep using server-time synchronization.

6.2. Clinical & Growth Tracking

  • Growth Metrics: Log weight, height, and head circumference.
  • Visual Percentiles: Integration with RCPCH Digital Growth Charts API to plot data against WHO standards.
  • PDF Engine: Generate high-fidelity reports using react-native-view-shot for chart snapshots.

6.3. AI & Insights

  • Predictive Windows: Use a TensorFlow.js LSTM model to predict the next likely feeding and sleep window based on the last 48 hours of data.
  • Trend Analysis: Identify "anomalies" (e.g., significant drop in wet diapers or sudden sleep regression).

6.4. Security & Compliance

  • COPPA 2.0 Hard Gate: Verified Parental Consent (VPC) via secure SMS handshake before data transmission.
  • E2EE Notes: End-to-end encryption for sensitive health-related text notes using AES-GCM.

7. Technical Requirements

7.1. Tech Stack (2026 Standards)

  • Frontend: React Native v0.81.5 (New Architecture/Fabric enabled).
  • State Management: TanStack Query v5+ with Firestore Persistence.
  • Backend: NestJS v11.1.12 (Node.js 20+ runtime).
  • Database: Google Firestore (Server) + Local SQLite (via Expo/RN persistence).
  • AI Engine: TensorFlow.js (@tensorflow/tfjs-node).
  • Subscription: RevenueCat SDK with react-native-purchases-ui.

7.2. Critical Integrations

  • iOS: Apple HealthKit (via react-native-health).
  • Android: Google Health Connect (via react-native-health-connect).
  • Payments: RevenueCat for "Premium Analytics" tier.
  • Mailing: SendGrid for PDF report delivery.

8. Data Model

8.1. Baby Profile (Collection)

  • babyId: UUID
  • name: String
  • birthDate: ISO8601
  • hlc_clock: Hybrid Logical Clock string
  • access_log: Array of UserIDs

8.2. LogEntry (Sub-collection: Event Sourced)

  • eventId: UUID
  • type: ENUM (Feeding, Diaper, Sleep, Growth)
  • payload: Object (Specific to type)
  • hlc_timestamp: String (For ordering)
  • createdBy: UserID
  • isEncrypted: Boolean

8.3. Subscription (Collection)

  • appUserId: Anonymous UUID
  • entitlement: ENUM (Basic, Premium)

9. API Specification (Key Endpoints)

| Endpoint | Method | Description | | :--- | :--- | :--- | | /v1/auth/vpc | POST | Initiate Verified Parental Consent via SMS. | | /v1/timer/start | POST | Updates Firestore with serverTimestamp for shared timer. | | /v1/predict/next | GET | Returns predicted timestamp for next feed/sleep. | | /v1/export/pdf | POST | Triggers NestJS to generate and mail a PDF summary. |

10. UI/UX Requirements

  • One-Handed Operation: Large touch targets for logging buttons (bottom-third of screen).
  • Night Mode: Low-blue-light theme for 3 AM logging sessions.
  • Live Activity: iOS Dynamic Island support for running feeding/sleep timers.
  • Chart Scrubbing: Interactive Skia-based charts (Victory Native XL) with haptic feedback on data points.

11. Non-Functional Requirements

  • Offline-First: App must allow full logging without internet; sync must trigger automatically upon reconnection.
  • Privacy: No PII (Personally Identifiable Information) sent to analytics; use anonymized UUIDs for RevenueCat and Sentry.
  • Latency: Shared timer drift between devices must be <1 second.

12. Out of Scope

  • Social media sharing or "Baby Wall" community features.
  • Marketplace/e-commerce for baby products.
  • Integration with video monitors (v2 candidate).

13. Risks & Mitigations

  • Risk: Data conflicts when two caregivers log simultaneously offline.
    • Mitigation: Implementation of Hybrid Logical Clocks (HLC) and Event Sourcing.
  • Risk: COPPA 2.0 Compliance failure.
    • Mitigation: Use of "Privacy-by-Design" architecture and automated SDK kill-switches for minors.

14. Implementation Tasks

Phase 1: Project Setup & Foundation

  • [ ] Initialize React Native v0.81.5 project with New Architecture enabled.
  • [ ] Set up NestJS v11.1.12 backend with TypeScript strict mode.
  • [ ] Configure Firebase v12.8.0 (Firestore, Auth, Functions).
  • [ ] Implement HLC (Hybrid Logical Clock) utility for timestamping.

Phase 2: Caregiver & Profile Management

  • [ ] Build Baby Profile creation flow.
  • [ ] Implement secure "Invite Caregiver" deep-linking system.
  • [ ] Setup COPPA 2.0 "Hard Gate" with SMS-based VPC.
  • [ ] Configure RBAC (Admin/Editor/Viewer) in Firestore Security Rules.

Phase 3: Event-Sourced Logging System

  • [ ] Create LogEntry schema for feeding (bottle/breast/solid).
  • [ ] Build Diaper and Sleep logging modules.
  • [ ] Implement TanStack Query v5 with Firestore offline persistence.
  • [ ] Develop shared real-time timer logic using FieldValue.serverTimestamp().

Phase 4: Health & Clinical Features

  • [ ] Integrate react-native-health (iOS) and react-native-health-connect (Android).
  • [ ] Implement RCPCH Digital Growth Charts API integration.
  • [ ] Build interactive Skia charts using Victory Native XL.
  • [ ] Develop PDF generation service using react-native-view-shot and Nutrient (PSPDFKit).

Phase 5: AI & Subscriptions

  • [ ] Build tfjs-node LSTM model service in NestJS for predictive windows.
  • [ ] Integrate RevenueCat SDK for Premium entitlement management.
  • [ ] Create RevenueCat Webhook listener for backend entitlement sync.
  • [ ] Implement push notifications for "Timer Over-run" and "Predicted Feed" alerts.

Phase 6: Security & Polish

  • [ ] Implement client-side E2EE for health notes using AES-GCM.
  • [ ] Conduct performance audit (target 60fps on animations).
  • [ ] Finalize "Night Mode" UI styling and accessibility labels.
  • [ ] Submit Health Apps Declaration to Google Play for Health Connect access.