# farazsd/recipe_food architecture

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

- Interactive diagram: https://gitdiagram.com/farazsd/recipe_food
- Repository: https://github.com/farazsd/recipe_food

## Overview

##### Project type and purpose
- This is a cross-platform Flutter application named “food_finder.”
- Its primary goal is to let users search for recipes by ingredients and view recipe details (including favorites).
- It runs on Android, iOS, Web, Windows, macOS, and Linux.

##### File structure
- Top-level Flutter folders (android, ios, linux, macos, windows, web) contain platform-specific build and native integration code.
- The lib directory holds the Dart application:
- lib/main.dart – app entry point
- lib/screens – UI pages (home, recipe details, favorites)
- lib/provider – state management (searchIngredientsProvider, recipeDetailsProvider)
- lib/repo – repository layer, centralizing data access
- lib/helpers – low-level API and local DB helpers
- lib/models – data transfer and domain models
- lib/utils/apis.dart – endpoint definitions
- test/widget_test.dart – basic widget-level test placeholder

##### README for additional insights
- README is a boilerplate Flutter starter.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Platforms Layer
    subgraph "Platforms"
        direction TB
        Android["Android"]:::platform
        iOS["iOS"]:::platform
        Web["Web"]:::platform
        Linux["Linux"]:::platform
        macOS["macOS"]:::platform
        Windows["Windows"]:::platform
    end

    Android -->|runs on| FlutterEngine
    iOS -->|runs on| FlutterEngine
    Web -->|runs on| FlutterEngine
    Linux -->|runs on| FlutterEngine
    macOS -->|runs on| FlutterEngine
    Windows -->|runs on| FlutterEngine

    FlutterEngine["Flutter Engine\nPlatform Channels"]:::platform

    FlutterEngine -->|entrypoint| Main["main.dart"]:::presentation

    %% Application Layer
    subgraph "lib"
        direction TB

        Main["App Entry Point\n(main.dart)"]:::presentation

        subgraph "Presentation Layer"
            direction TB
            Home["HomeScreen"]:::presentation
            Details["RecipeDetailsScreen"]:::presentation
            Favorites["FavoritesScreen"]:::presentation
        end

        subgraph "State Management"
            direction TB
            SIP["SearchIngredientsProvider"]:::logic
            RDP["RecipeDetailsProvider"]:::logic
        end

        Repo["Repository"]:::logic

        subgraph "Data Sources"
            direction TB
            APIH["Remote API Helpers"]:::data
            DBH["Local DB Helpers"]:::data
        end

        subgraph "Models"
            direction TB
            SIM["SearchByIngredientsModel"]:::data
            RDM["RecipesDetailsModel"]:::data
        end

        Utils["API Endpoints\n(apis.dart)"]:::data
    end

    %% UI to Provider
    Main -->|initializes| Home
    Home -->|"searchRecipes(query)"| SIP
    Details -->|"getRecipeDetails(id)"| RDP
    Favorites -->|"loadFavorites()"| SIP

    %% Provider to Repo
    SIP -->|"fetchByIngredients()"| Repo
    RDP -->|"fetchRecipeDetails()"| Repo

    %% Repo to Data Sources & Models
    Repo -->|uses| APIH
    Repo -->|uses| DBH
    APIH -->|calls endpoints| Utils
    APIH -->|returns JSON| SIM
    APIH -->|returns JSON| RDM
    DBH -->|reads/writes| SIM
    DBH -->|reads/writes| RDM

    %% Data flow back to UI
    SIM -->|data| Repo
    RDM -->|data| Repo
    Repo -->|provides data| SIP
    Repo -->|provides data| RDP
    SIP -->|state update| Home
    RDP -->|state update| Details

    %% Click Events
    click Home "https://github.com/farazsd/recipe_food/blob/master/lib/screens/home/home_screen.dart"
    click Details "https://github.com/farazsd/recipe_food/blob/master/lib/screens/recipe_details/recipes_details.dart"
    click Favorites "https://github.com/farazsd/recipe_food/blob/master/lib/screens/recipe_details/favoritesScreen.dart"
    click SIP "https://github.com/farazsd/recipe_food/blob/master/lib/provider/searchIngredientsProvider.dart"
    click RDP "https://github.com/farazsd/recipe_food/blob/master/lib/provider/recipeDetailsProvider.dart"
    click Repo "https://github.com/farazsd/recipe_food/blob/master/lib/repo/repo.dart"
    click APIH "https://github.com/farazsd/recipe_food/blob/master/lib/helpers/api_helpers.dart"
    click DBH "https://github.com/farazsd/recipe_food/blob/master/lib/helpers/dbHelpers.dart"
    click SIM "https://github.com/farazsd/recipe_food/blob/master/lib/models/searchByIngredientsModel.dart"
    click RDM "https://github.com/farazsd/recipe_food/blob/master/lib/models/recipes_details_model.dart"
    click Utils "https://github.com/farazsd/recipe_food/blob/master/lib/utils/apis.dart"
    click Main "https://github.com/farazsd/recipe_food/blob/master/lib/main.dart"
    click Android "https://github.com/farazsd/recipe_food/blob/master/android/app/src/main/kotlin/com/example/food_finder/MainActivity.kt"
    click iOS "https://github.com/farazsd/recipe_food/blob/master/ios/Runner/AppDelegate.swift"
    click Web "https://github.com/farazsd/recipe_food/blob/master/web/index.html"
    click Linux "https://github.com/farazsd/recipe_food/blob/master/linux/main.cc"
    click macOS "https://github.com/farazsd/recipe_food/blob/master/macos/Runner/AppDelegate.swift"
    click Windows "https://github.com/farazsd/recipe_food/blob/master/windows/runner/main.cpp"

    %% Styles
    classDef presentation fill:#AEDFF7,stroke:#0366D6,color:#033E8C
    classDef logic fill:#FFE6A7,stroke:#CC9A06,color:#8C5800
    classDef data fill:#D4F5D4,stroke:#2E8B57,color:#205C3B
    classDef external fill:#F5D4D4,stroke:#8B0000,color:#550000
    classDef platform fill:#E2E2E2,stroke:#888888,color:#444444
```
