# laurenweickert/whoop-postpartum-chat architecture

> Architecture diagram of the GitHub repository laurenweickert/whoop-postpartum-chat, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/laurenweickert/whoop-postpartum-chat
- Repository: https://github.com/laurenweickert/whoop-postpartum-chat

## Overview

##### Project type and purpose
- This is a full‐stack front‐end mobile application (“Whoop Postpartum Chat”) built with React Native and Expo.

##### File structure
- Top‐level directories:
- app/ – Expo Router screens and layouts (tab navigation, insights, profile).
- src/ – Web entry (Vite) with core components, store, and utilities.
- components/, hooks/, data/ – Shared React components, custom hooks, and mock data.
- Config/build files:
- vite.config.ts, tsconfig*.json, postcss.config.js, tailwind.config.js – build tool and styling setup.
- expo/ – device/type definitions and Expo CLI config.
- Key patterns:
- Tab‐based navigation with Expo Router.
- Zustand for state management.
- Custom utility modules for OpenAI calls and date formatting.

##### README for additional insights
- Tech stack clarifies major frameworks (Expo/React Native), state (Zustand), storage (AsyncStorage/SecureStore), UI (Tailwind CSS), APIs (OpenAI, Whoop).
- Features map directly to two functional domains: the Health Insights Dashboard and the AI Chat Assistant.

a. Main components
- Product: Whoop Postpartum Chat (mobile UI + navigation)
- Platform components: Expo framework, React Native runtime, Vite bundler, Tailwind CSS, Expo Router
- Service components:
– State Management Service (Zustand store)
– Local Storage Service (AsyncStorage / SecureStore)
– Mock Data Service (for development)
– Health Insights Logic
– Chat Assistant Logic
- Integration components (external): Whoop API, OpenAI API
b. Relationships & interactions
- Mobile UI → State Management Service (dependency at runtime)
- State Management → Local Storage (integration via file sync)
- Health Insights Logic → Mock Data Service (development‐time dependency)
- Health Insights Logic → date-fns (runtime dependency)
- Chat Assistant Logic → OpenAI API (API integration)
- Health Insights Logic → Whoop API (planned API integration)
c. Architectural patterns/design principles
- Single‐page/tab navigation pattern
- Separation of concerns: UI layer, state layer, service layer, integration layer
- Mock data abstraction for testing/development
d. Relevant technologies
- UI/Navigation: React Native, Expo Router, Tailwind CSS, Lucide React
- State/Storage: Zustand, AsyncStorage / SecureStore
- Build/Tooling: Vite, TypeScript, ESLint, PostCSS
- Utilities: date-fns, OpenAI SDK

##### Detail
- Break the application into as many logical components as possible (UI screens, state slices, services, integrations).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend (Product)"
        UI["Mobile UI & Navigation"]:::product
    end

    %% Platform Layer
    subgraph "Platform"
        Expo["Expo Framework"]:::platform
        ReactNative["React Native Runtime"]:::platform
        Vite["Vite Bundler"]:::platform
        Tailwind["Tailwind CSS"]:::platform
    end

    %% Services Layer
    subgraph "Services"
        Store["Zustand Store"]:::service
        LocalStorage["Local Storage (AsyncStorage/SecureStore)"]:::service
        MockData["Mock Data Service"]:::service
        HealthLogic["Health Insights Logic"]:::service
        ChatLogic["Chat Assistant Logic"]:::service
        WhoopConnect["WhoopConnect Component"]:::service
        TimeAgo["Date Formatting Utility"]:::service
        FrameworkReady["Framework Readiness Hook"]:::service
        UserProfile["User Profile UI Component"]:::service
    end

    %% Integrations Layer
    subgraph "Integrations"
        WhoopAPI["Whoop API"]:::integration
        OpenAI["OpenAI API"]:::integration
    end

    %% Connections
    UI -->|"Dependency:Runtime"| Store
    Store -->|"Integration:FileSync"| LocalStorage
    HealthLogic -->|"Dependency:Development"| MockData
    HealthLogic -->|"Dependency:Runtime"| TimeAgo
    ChatLogic -->|"Integration:APIIntegration"| OpenAI
    HealthLogic -->|"Integration:APIIntegration"| WhoopAPI
    UI -->|"Dependency:Runtime"| FrameworkReady
    UI -->|"Dependency:Runtime"| Expo
    UI -->|"Dependency:Runtime"| ReactNative
    Vite -->|"Dependency:Build-time"| UI
    Tailwind -->|"Dependency:Build-time"| UI
    HealthLogic -->|"ServiceProvision:DataSharing"| UI
    ChatLogic -->|"ServiceProvision:DataSharing"| UI
    HealthLogic -->|"Integration:APIIntegration"| WhoopConnect
    WhoopConnect -->|"Integration:APIIntegration"| WhoopAPI
    UserProfile -->|"ServiceProvision:SharedResources"| UI

    %% Click Events
    click UI "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/app/(tabs)/_layout.tsx"
    click FrameworkReady "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/hooks/useFrameworkReady.ts"
    click Store "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/src/store/useStore.ts"
    click LocalStorage "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/src/store/useStore.ts"
    click MockData "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/data/mockData.ts"
    click HealthLogic "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/components/PostpartumTimeline.tsx"
    click HealthLogic "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/components/Dial.tsx"
    click ChatLogic "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/src/components/ChatInterface.tsx"
    click ChatLogic "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/src/utils/openai.ts"
    click WhoopConnect "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/src/components/WhoopConnect.tsx"
    click TimeAgo "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/src/utils/timeAgo.ts"
    click UserProfile "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/src/components/UserProfile.ts"
    click Tailwind "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/tailwind.config.js"
    click Tailwind "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/postcss.config.js"
    click Vite "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/vite.config.ts"
    click Vite "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/src/main.tsx"
    click Vite "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/src/App.tsx"
    click Expo "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/.expo/devices.json"
    click Expo "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/.expo/types/router.d.ts"
    click Expo "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/expo-env.d.ts"
    click Expo "https://github.com/laurenweickert/whoop-postpartum-chat/blob/master/app.json"

    %% Styles
    classDef product fill:#D0E8FF,stroke:#0066CC,color:#000;
    classDef platform fill:#E0F7D4,stroke:#2E7D32,color:#000;
    classDef service fill:#F3E5F5,stroke:#6A1B9A,color:#000;
    classDef integration fill:#FFE0B2,stroke:#EF6C00,color:#000;
```
