# nutriapp/nurtiapp architecture

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

- Interactive diagram: https://gitdiagram.com/nutriapp/nurtiapp
- Repository: https://github.com/nutriapp/nurtiapp

## Overview

##### Project type and purpose
- NutriApp is a full-stack iOS mobile application (built in Swift/Xcode) that uses Parse as a Backend-as-a-Service to manage user accounts, plans, media uploads, and social interactions. Its purpose is to let users track nutrition, upload photos, set goals, and create a support network.

##### File structure
- Top-level:
- NutriApp.xcodeproj / .xcworkspace → the Xcode project and workspace
- NutriApp/…/*.swift → Swift source files (AppDelegate, ViewControllers, Models)
- Podfile / Pods/… → 3rd-party libraries (Parse SDK, Bolts, MBProgressHUD, IQKeyboardManagerSwift)
- MVC pattern:
- Models: User.swift, UserPlan.swift, userMedia.swift
- Views: Storyboards (Main.storyboard, LaunchScreen.storyboard), custom Cells (HomeCell.swift, ManageProgressCell.swift)
- Controllers: LoginViewController.swift, MainViewController.swift, PlanViewController.swift, etc.
- Networking & data storage all handled via the Parse SDK.

##### README for additional insights
- Confirms use of Parse user sign-up, plan schema, media uploads, comments, supporters.
- Sketches Parse data model: Users → Plan → FoodGroup; Media → Comments; Supporters relationship.
- Mentions push notifications, camera, calendar, future third-party APIs (Twitter, Yelp, Google Maps).

##### Detailed component breakdown
- AppDelegate.swift (app lifecycle + push registration)
- LoginViewController + Parse Authentication
- MainNavigationController / ContainerViewController
- PlanViewController / ProfileViewController / CalendarViewController
- Models: User, UserPlan, userMedia
- Parse SDK + Bolts (network & data operations)
- External Push Notification Service (APNs)
- Camera & Photo Picker (iOS native)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client-side Layers
    subgraph "Mobile Client (iOS App)" 
        direction TB
        subgraph "UI Layer" 
            direction TB
            MainSB["Main.storyboard"]:::frontend
            LaunchSB["LaunchScreen.storyboard"]:::frontend
            Assets["Assets.xcassets"]:::frontend
            HomeCell["HomeCell.swift"]:::frontend
            ManageProgressCell["ManageProgressCell.swift"]:::frontend
        end
        subgraph "Business Logic Layer" 
            direction TB
            AppDelegate["AppDelegate.swift"]:::frontend
            LoginVC["LoginViewController.swift"]:::frontend
            StartVC["StartViewController.swift"]:::frontend
            MainNav["MainNavigationController.swift"]:::frontend
            ContainerVC["ContainerViewController.swift"]:::frontend
            MenuVC["MenuViewController.swift"]:::frontend
            MainVC["MainViewController.swift"]:::frontend
            PlanVC["PlanViewController.swift"]:::frontend
            ProfileVC["ProfileViewController.swift"]:::frontend
            ProfileEditVC["ProfileEditViewController.swift"]:::frontend
            CalendarVC["CalendarViewController.swift"]:::frontend
            ManageProgressVC["ManageProgressViewController.swift"]:::frontend
            ManageSupportVC["ManageSupporterViewController.swift"]:::frontend
            SupportingVC["SupportingViewController.swift"]:::frontend
        end
        subgraph "Domain Models" 
            direction TB
            UserModel["User.swift"]:::frontend
            PlanModel["UserPlan.swift"]:::frontend
            MediaModel["userMedia.swift"]:::frontend
        end
        subgraph "Data & Networking Layer" 
            direction TB
            ParseSDK["Parse SDK"]:::data
            Bolts["Bolts"]:::data
        end
        subgraph "Third-Party UI Helpers" 
            direction TB
            IQKM["IQKeyboardManagerSwift"]:::data
            MBHUD["MBProgressHUD"]:::data
        end
        subgraph "Dependency Management" 
            direction TB
            PodfileNode["Podfile"]:::data
            PodfileLock["Podfile.lock"]:::data
        end
    end

    %% External Services & Hardware
    subgraph "External Services & Hardware"
        direction TB
        Camera["Camera / Photo Library"]:::hardware
        APNs["APNs (Push Notification Service)"]:::external
        ParseServer["Parse Server"]:::external
        subgraph "Parse Cloud Storage"
            direction TB
            CloudDB["MongoDB (Cloud DB)"]:::external
            CloudFiles["File Storage (S3)"]:::external
        end
    end

    %% Data Flows
    MainSB -->|uses| MainVC
    LaunchSB -->|launches| AppDelegate
    Assets -->|provides assets| UI_Layer[UI Layer]
    HomeCell -->|render in| MainVC
    ManageProgressCell -->|render in| ManageProgressVC

    AppDelegate -->|initializes| MainNav
    LoginVC -->|authenticates via| ParseSDK
    StartVC -->|navigates to| LoginVC
    MainNav -->|hosts| ContainerVC
    ContainerVC -->|switches to| MenuVC
    MenuVC -->|select screen| MainVC
    MainVC -->|loads plans via| ParseSDK
    PlanVC -->|CRUD plans via| ParseSDK
    ProfileVC -->|fetches user via| ParseSDK
    ProfileEditVC -->|updates user via| ParseSDK
    CalendarVC -->|fetches events via| ParseSDK
    ManageProgressVC -->|updates progress via| ParseSDK
    ManageSupportVC -->|manages supporters via| ParseSDK
    SupportingVC -->|views supporters via| ParseSDK

    UserModel -->|defines schema| ParseSDK
    PlanModel -->|defines schema| ParseSDK
    MediaModel -->|defines schema| ParseSDK

    ParseSDK -->|async calls managed by| Bolts
    Bolts -->|handles callbacks| Business_Logic_Layer[Business Logic Layer]
    IQKM -->|enhances keyboard handling in| UI_Layer
    MBHUD -->|provides HUD in| UI_Layer

    PodfileNode -->|defines pods| Pods[Pods/]
    PodfileLock -->|locks versions| Pods

    %% Hardware & Notifications
    MainVC -->|requests camera| Camera
    PlanVC -->|uploads photo| Camera
    Camera -->|returns image| ParseSDK

    AppDelegate -->|registers for| APNs
    APNs -->|sends push to| AppDelegate

    %% Parse Cloud flows
    ParseSDK -->|REST API calls| ParseServer
    ParseServer -->|stores data| CloudDB
    ParseServer -->|stores files| CloudFiles
    ParseServer -->|sends push via| APNs
    CloudDB -->|returns JSON| ParseSDK
    CloudFiles -->|returns URL| ParseSDK

    %% Click Events
    click MainSB "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/Base.lproj/Main.storyboard"
    click LaunchSB "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/Base.lproj/LaunchScreen.storyboard"
    click Assets "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/Assets.xcassets"
    click HomeCell "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/HomeCell.swift"
    click ManageProgressCell "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/ManageProgressCell.swift"
    click AppDelegate "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/AppDelegate.swift"
    click LoginVC "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/LoginViewController.swift"
    click StartVC "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/StartViewController.swift"
    click MainNav "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/MainNavigationController.swift"
    click ContainerVC "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/ContainerViewController.swift"
    click MenuVC "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/MenuViewController.swift"
    click MainVC "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/MainViewController.swift"
    click PlanVC "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/PlanViewController.swift"
    click ProfileVC "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/ProfileViewController.swift"
    click ProfileEditVC "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/ProfileEditViewController.swift"
    click CalendarVC "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/CalendarViewController.swift"
    click ManageProgressVC "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/ManageProgressViewController.swift"
    click ManageSupportVC "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/ManageSupporterViewController.swift"
    click SupportingVC "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/SupportingViewController.swift"
    click UserModel "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/User.swift"
    click PlanModel "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/UserPlan.swift"
    click MediaModel "https://github.com/nutriapp/nurtiapp/blob/master/NutriApp/userMedia.swift"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#004C99,stroke-width:1px
    classDef data fill:#E8F4D0,stroke:#668000,stroke-width:1px
    classDef external fill:#D0FFE8,stroke:#00994C,stroke-width:1px
    classDef hardware fill:#FFE8D0,stroke:#994C00,stroke-width:1px
```
