# shreyhan/smartmeals architecture

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

- Interactive diagram: https://gitdiagram.com/shreyhan/smartmeals
- Repository: https://github.com/shreyhan/smartmeals

## Overview

##### Project type and purpose
- SmartMeals is a client-side, iOS mobile application written in Swift/SwiftUI.
- Purpose: help users (college students or roommates) create weekly meal plans, generate grocery lists, track food budgets, and split costs.

##### File structure
- Top‐level Xcode project files (.xcodeproj, workspace settings, schemes) indicate a single monolithic iOS app.
- SmartMeals/ directory contains SwiftUI view files (AddRecipeView.swift, WeeklyMealPlanView.swift, etc.), a central DataModel.swift, and an App entry point (SmartMealsApp.swift).
- Entitlements file for Apple Sign-In.
- Two test targets (SmartMealsTests, SmartMealsUITests) for unit and UI tests.
- No backend folder, no network or server code—data persistence is local via SwiftData.

##### README for additional insights
- Confirms SwiftUI + SwiftData client‐only architecture.
- Data is stored locally—no external database or server communication.
- Uses Apple Sign In for user authentication.
- Key domain entities: User profiles, recipes, meal plans, grocery lists, budget entries, and cost splitting.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% App Entry
    subgraph "App Entry & Coordinator"
        AppEntry["SmartMealsApp (App Entry & Coordinator)"]:::app
    end

    %% UI Layer
    subgraph "UI Layer (SwiftUI Views)"
        ContentView["ContentView"]:::ui
        UserSignUpView["UserSignUpView"]:::ui
        UserFirstLoginView["UserFirstLogin"]:::ui
        UserProfileView["UserProfileView"]:::ui
        WeeklyMealPlanView["WeeklyMealPlanView"]:::ui
        GroceryListView["GroceryListView"]:::ui
        BudgetTrackingView["BudgetTrackingView"]:::ui
        RecipeView["RecipeView"]:::ui
        AddRecipeView["AddRecipeView"]:::ui
        CreateRecipeView["CreateRecipeView"]:::ui
        EditMealPlanView["EditMealPlanView"]:::ui
        IngredientView["IngredientView"]:::ui
    end

    %% Business Logic / Domain
    subgraph "Business Logic / Domain Layer"
        DataModel["DataModel.swift\n(Entities & CRUD)"]:::domain
    end

    %% Data Persistence
    DataStore["SwiftData Store"]:::persistence

    %% External Service
    subgraph "External Service"
        AppleSignIn["Apple Sign-In"]:::external
    end

    %% Assets
    subgraph "Assets"
        AssetsNode["Assets.xcassets"]:::assets
    end

    %% Tests
    subgraph "Tests"
        UnitTests["SmartMealsTests.swift"]:::tests
        UITests["UI Tests (SmartMealsUITests)"]:::tests
    end

    %% Connections
    AppEntry --> ContentView
    ContentView --> DataModel
    UserSignUpView --> AppleSignIn
    AppleSignIn --> DataModel
    UserFirstLoginView --> DataModel
    UserProfileView --> DataModel
    WeeklyMealPlanView --> DataModel
    GroceryListView --> DataModel
    BudgetTrackingView --> DataModel
    RecipeView --> DataModel
    AddRecipeView --> DataModel
    CreateRecipeView --> DataModel
    EditMealPlanView --> DataModel
    IngredientView --> DataModel

    DataModel --> DataStore
    DataStore --> DataModel

    AssetsNode --> ContentView
    AssetsNode --> RecipeView
    AssetsNode --> IngredientView

    UnitTests --> DataModel
    UITests --> ContentView
    UITests --> WeeklyMealPlanView
    UITests --> GroceryListView

    %% Click Events
    click AppEntry "https://github.com/shreyhan/smartmeals/blob/main/SmartMeals/SmartMealsApp.swift"
    click ContentView "https://github.com/shreyhan/smartmeals/blob/main/SmartMeals/ContentView.swift"
    click UserSignUpView "https://github.com/shreyhan/smartmeals/blob/main/SmartMeals/UserSignUpView.swift"
    click UserFirstLoginView "https://github.com/shreyhan/smartmeals/blob/main/SmartMeals/UserFirstLogin.swift"
    click UserProfileView "https://github.com/shreyhan/smartmeals/blob/main/SmartMeals/UserProfileView.swift"
    click WeeklyMealPlanView "https://github.com/shreyhan/smartmeals/blob/main/SmartMeals/WeeklyMealPlanView.swift"
    click GroceryListView "https://github.com/shreyhan/smartmeals/blob/main/SmartMeals/GroceryListView.swift"
    click BudgetTrackingView "https://github.com/shreyhan/smartmeals/blob/main/SmartMeals/BudgetTrackingView.swift"
    click RecipeView "https://github.com/shreyhan/smartmeals/blob/main/SmartMeals/RecipeView.swift"
    click AddRecipeView "https://github.com/shreyhan/smartmeals/blob/main/SmartMeals/AddRecipeView.swift"
    click CreateRecipeView "https://github.com/shreyhan/smartmeals/blob/main/SmartMeals/CreateRecipeView.swift"
    click EditMealPlanView "https://github.com/shreyhan/smartmeals/blob/main/SmartMeals/EditMealPlanView.swift"
    click IngredientView "https://github.com/shreyhan/smartmeals/blob/main/SmartMeals/IngredientView.swift"
    click DataModel "https://github.com/shreyhan/smartmeals/blob/main/SmartMeals/DataModel.swift"
    click AppleSignIn "https://github.com/shreyhan/smartmeals/blob/main/SmartMeals/SmartMeals.entitlements"
    click AssetsNode "https://github.com/shreyhan/smartmeals/blob/main/SmartMeals/Assets.xcassets"
    click UnitTests "https://github.com/shreyhan/smartmeals/blob/main/SmartMealsTests/SmartMealsTests.swift"
    click UITests "https://github.com/shreyhan/smartmeals/tree/main/SmartMealsUITests/"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0366D6;
    classDef domain fill:#DFF5D0,stroke:#028A0F;
    classDef persistence fill:#E0E0E0,stroke:#888888,stroke-dasharray: 5 5;
    classDef external fill:#FFF7C0,stroke:#CF9A00;
    classDef app fill:#FFD0D0,stroke:#D03636;
    classDef assets fill:#FFE0B2,stroke:#E65100;
    classDef tests fill:#F3E5F5,stroke:#6A1B9A,stroke-dasharray: 2 2;
```
