# dear-luca/cookitup architecture

> Architecture diagram of the GitHub repository dear-luca/cookitup, 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/dear-luca/cookitup
- Repository: https://github.com/dear-luca/cookitup

## Overview

##### Project type and purpose
- This is an Android mobile application named “CookItUp,” built with Kotlin, Jetpack Compose (inferred from Composable-style UI components), and MVVM architecture.
- It fetches recipes from an external Spoonacular API, persists them locally using Room, and presents them in various UI screens (search, list, detail, favourites, profile).

##### File structure
- Top-level “app” module contains all code.
- data/local: Room database setup (AppDatabase.kt), DAOs, and entity classes.
- data/remote: Retrofit (or similar) API client, DTOs, and API interface for Spoonacular.
- data/repository: Concrete implementations of domain repositories (ApiRepositoryImpl, DbRepositoryImpl).
- domain: Model definitions and repository interfaces (ApiRepository, DbRepository).
- ui: Composable screens + ViewModels, navigation graph, theming, and shared UI components (TopBar, BottomBar, RecipeItems, etc.).
- utils: Network utilities.
- AppModule.kt/CookItUpApplication.kt: Dependency injection setup (likely Koin or Hilt).
- Build scripts, proguard rules, testing directories, and resource folders are also present.

##### README for additional insights
- Currently only contains the project title. No further architectural notes.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Presentation Layer"
        SSR["SearchRecipesScreen"]:::presentation
        SVM["SearchRecipesViewModel"]:::presentation
        RLS["RecipesScreen"]:::presentation
        RVM["RecipesViewModel"]:::presentation
        RDS["RecipeDetailScreen"]:::presentation
        RDVM["RecipeDetailViewModel"]:::presentation
        FS["FavouritesScreen"]:::presentation
        FVM["FavouritesViewModel"]:::presentation
        PS["ProfileScreen"]:::presentation
        SCOMP["TopBar"]:::presentation
        BCOMP["BottomBar"]:::presentation
        RITCOMP["RecipeItems"]:::presentation
        RINFCOMP["RecipeInfo"]:::presentation
        NAV["NavigationGraph"]:::presentation
        ROUTES["Routes"]:::presentation
    end

    subgraph "Domain Layer"
        DM["Domain Models<br>Ingredient, Recipe, RecipeDetail, RecipeInstructions"]:::domain
        RI["ApiRepository Interface"]:::domain
        DI["DbRepository Interface"]:::domain
    end

    subgraph "Data Layer"
        subgraph "Remote Data Source"
            APIClient["ApiClient"]:::data
            APIConst["ApiConstants"]:::data
            APIInterface["SpoonacularApi"]:::data
            DTOs["MapperDto,<br>RecipeDto,RecipeDetailDto,<br>IngredientDto,RecipeInstructionsDto"]:::data
        end
        subgraph "Local Data Source"
            DB["AppDatabase"]:::data
            DAOs["RecipesDao,IngredientDao,<br>InstructionDao,CrossRefDao"]:::data
            Entities["RecipeEntity,IngredientEntity,<br>InstructionEntity,RecipeFull,<br>RecipeIngredientCrossRef,MapperEntity"]:::data
        end
        subgraph "Repository Implementations"
            ApiImpl["ApiRepositoryImpl"]:::data
            DbImpl["DbRepositoryImpl"]:::data
        end
    end

    subgraph "Infrastructure"
        DIUnit["AppModule"]:::infra
        AppClass["CookItUpApplication"]:::infra
        NetUtil["NetworkUtils"]:::infra
        Theme["Theme,Color,Type"]:::infra
    end

    External["Spoonacular API"]:::external
    DBSQLite["Room/SQLite"]:::external

    %% Flows
    SSR -->|"calls"| SVM
    RLS -->|"calls"| RVM
    RDS -->|"calls"| RDVM
    FS -->|"calls"| FVM
    SCOMP -.->|"used by"| SSR
    BCOMP -.->|"used by"| SSR
    RITCOMP -.->|"used by"| RLS
    RINFCOMP -.->|"used by"| RDS
    NAV -->|"manages"| SSR
    ROUTES -->|"defines"| NAV

    SVM -->|"depends on"| RI
    RVM -->|"depends on"| RI
    RDVM -->|"depends on"| RI
    FVM -->|"depends on"| DI

    RI -->|"implemented by"| ApiImpl
    DI -->|"implemented by"| DbImpl

    ApiImpl -->|"uses"| APIClient
    APIClient -->|"calls"| External
    APIConst -->|"provides constants to"| APIClient
    APIInterface -->|"defines endpoints for"| APIClient

    DbImpl -->|"uses"| DB
    DB -->|"provides DAOs to"| DbImpl
    DAOs -->|"CRUD on"| DBSQLite
    Entities -->|"mapped by"| DAOs

    DIUnit -->|"injects"| SVM & RVM & RDVM & FVM & ApiImpl & DbImpl
    AppClass -->|"initializes"| DIUnit
    NetUtil -->|"used by"| APIClient
    Theme -->|"styling for"| SSR & RLS & RDS & FS & PS

    %% Click Events
    click SSR "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/ui/screens/searchRecipes/SearchRecipesScreen.kt"
    click SVM "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/ui/screens/searchRecipes/SearchRecipesViewModel.kt"
    click RLS "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/ui/screens/recipes/RecipesScreen.kt"
    click RVM "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/ui/screens/recipes/RecipesViewModel.kt"
    click RDS "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/ui/screens/recipeDetail/RecipeDetailScreen.kt"
    click RDVM "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/ui/screens/recipeDetail/RecipeDetailViewModel.kt"
    click FS "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/ui/screens/favourites/FavouritesScreen.kt"
    click FVM "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/ui/screens/favourites/FavouritesViewModel.kt"
    click PS "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/ui/screens/profile/ProfileScreen.kt"
    click SCOMP "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/ui/screens/components/TopBar.kt"
    click BCOMP "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/ui/screens/components/BottomBar.kt"
    click RITCOMP "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/ui/screens/components/RecipeItems.kt"
    click RINFCOMP "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/ui/screens/components/RecipeInfo.kt"
    click NAV "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/ui/navigation/NavigationGraph.kt"
    click ROUTES "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/ui/navigation/Routes.kt"
    click DIUnit "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/AppModule.kt"
    click AppClass "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/CookItUpApplication.kt"
    click NetUtil "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/utils/NetworkUtils.kt"
    click RI "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/domain/repository/ApiRepository.kt"
    click DI "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/domain/repository/DbRepository.kt"
    click APIClient "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/data/remote/api/ApiClient.kt"
    click APIConst "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/data/remote/api/ApiConstants.kt"
    click APIInterface "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/data/remote/api/SpoonacularApi.kt"
    click DB "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/data/local/db/AppDatabase.kt"
    click ApiImpl "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/data/repository/ApiRepositoryImpl.kt"
    click DbImpl "https://github.com/dear-luca/cookitup/blob/main/app/src/main/java/com/example/cookitup/data/repository/DbRepositoryImpl.kt"

    %% Styles
    classDef presentation fill:#D6EAF8,stroke:#21618C,stroke-width:1px
    classDef domain fill:#D1F2EB,stroke:#117864,stroke-width:1px
    classDef data fill:#FDEBD0,stroke:#B9770E,stroke-width:1px
    classDef infra fill:#E5E8E8,stroke:#566573,stroke-width:1px
    classDef external fill:#F5B7B1,stroke:#C0392B,stroke-width:1px
```
