# brayanalmengor04/saborpty-app architecture

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

- Interactive diagram: https://gitdiagram.com/brayanalmengor04/saborpty-app
- Repository: https://github.com/brayanalmengor04/saborpty-app

## Overview

##### Project type and purpose
- This is a cross-platform mobile (and desktop/web) application built in Flutter/Dart.
- Purpose: “SaborPTY” is a recipe app for Panamanian dishes, built with a modular, feature-driven, clean-architecture approach.
- It uses Material Design 3 for UI, Riverpod/Provider/BLoC for state management, Hive & SharedPreferences for local persistence, and integrates (or is ready to integrate) with Firebase and a Laravel backend.

##### File structure
- Top-level targets: android/, ios/, web/, linux/, macos/, windows/ — each platform shell generated by Flutter.
- Core Flutter code under lib/:
- core/: global constants, errors, services, utils
- features/: feature modules (auth, category, home, recipes, favorites, suggestion) each following data/domain/presentation substructure
- shared/: reusable widgets, theme definitions, navigation (go_router)
- main.dart: app entry, routes initialization
- pubspec.*: dependencies declaration (Flutter, Riverpod, Hive, Firebase, etc.)
- Android/iOS/CMake files: native configuration and plugin registration.

##### README for additional insights
- The README explicitly outlines the clean-architecture layering (core, features, shared), the intended feature set (categories, search, favorites), and the tech stack (Flutter + Dart + Material Design 3 + Riverpod/Provider/BLoC + Hive + Firebase + Laravel).

##### Detailed breakdown of components
- Flutter Shell (per platform)
- Main entrypoint: main.dart → AppRouter (go_router)
- Shared layer: ThemeManager, NavigationService, reusable Widgets
- Feature “recipes”: Presentation (RecipeListScreen), ViewModel/BLoC, Domain (RecipesUseCases + Entities), Data (RecipeModel, RecipeDataSource)
- Remote: REST client (Laravel), Firebase module (if used)
- Error handling: core/errors
- Utility services: core/services (connectivity, notifications)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Platform Shells
    subgraph "Platform Shells" 
        direction TB
        Android["Android Runner"]:::external
        iOS["iOS Runner"]:::external
        Web["Web Runner"]:::external
        Linux["Linux Runner"]:::external
        MacOS["macOS Runner"]:::external
        Windows["Windows Runner"]:::external
    end
    click Android "https://github.com/brayanalmengor04/saborpty-app/tree/main/android/"
    click iOS "https://github.com/brayanalmengor04/saborpty-app/tree/main/ios/"
    click Web "https://github.com/brayanalmengor04/saborpty-app/tree/main/web/"
    click Linux "https://github.com/brayanalmengor04/saborpty-app/tree/main/linux/"
    click MacOS "https://github.com/brayanalmengor04/saborpty-app/tree/main/macos/"
    click Windows "https://github.com/brayanalmengor04/saborpty-app/tree/main/windows/"

    %% Entry Point & Routing
    Main["main.dart"]:::external
    click Main "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/main.dart"
    Router["AppRouter (go_router)"]:::shared
    click Router "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/shared/navegation/app_router.dart"

    Android -->|loads| Main
    iOS -->|loads| Main
    Web -->|loads| Main
    Linux -->|loads| Main
    MacOS -->|loads| Main
    Windows -->|loads| Main
    Main -->|initializes| Router

    %% Shared Layer
    subgraph "Shared Layer" 
        direction TB
        Themes["Shared Themes"]:::shared
        click Themes "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/shared/themes/archivo.txt"
        Widgets["Shared Widgets"]:::presentation
        RecipeCard["RecipeCard"]:::presentation
        click RecipeCard "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/shared/widgets/recipe_card.dart"
        CategoryCard["RecipeCategoryCard"]:::presentation
        click CategoryCard "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/shared/widgets/recipe_category_card.dart"
    end
    Router -->|uses| Themes
    Router -->|navigates to| Widgets
    Widgets --> RecipeCard
    Widgets --> CategoryCard

    %% Core Layer
    subgraph "Core Layer" 
        direction TB
        Constants["Core Constants"]:::core
        AppColors["app_colors.dart"]:::core
        click AppColors "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/core/constants/app_colors.dart"
        AppRoutes["app_routes.dart"]:::core
        click AppRoutes "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/core/constants/app_routes.dart"
        AppStyles["app_styles.dart"]:::core
        click AppStyles "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/core/constants/app_styles.dart"
    end
    Themes --> AppColors
    Router --> AppRoutes
    Themes --> AppStyles

    %% Features
    subgraph "Feature: Category" 
        direction TB
        CatScreen["CategoryListScreen"]:::presentation
        click CatScreen "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/category/presentation/categorylist_screen.dart"
        CatUseCase["GetCategoriesUseCase"]:::domain
        CatRepoIntf["CategoryRepository"]:::domain
        click CatRepoIntf "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/category/domain/repository/category_repository.dart"
        CatRepoImpl["CategoryRepositoryImpl"]:::data
        click CatRepoImpl "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/category/domain/repository/category_repository_impl.dart"
        CatDataSrc["CategoryDataSource"]:::data
        click CatDataSrc "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/category/data/datasources/category_data_source.dart"
        CatModel["CategoryModel"]:::data
        click CatModel "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/category/data/models/category_model.dart"
    end
    Router -->|route| CatScreen
    CatScreen -->|calls| CatUseCase
    CatUseCase -->|depends on| CatRepoIntf
    CatRepoImpl -->|implements| CatRepoIntf
    CatRepoImpl -->|uses| CatDataSrc
    CatDataSrc -->|returns| CatModel

    subgraph "Feature: Recipes" 
        direction TB
        RecScreen["RecipeListScreen"]:::presentation
        click RecScreen "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/recipes/presentation/recipelist_screen.dart"
        RecUseCase["GetRecipesUseCase"]:::domain
        RecRepoIntf["RecipesRepository"]:::domain
        click RecRepoIntf "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/recipes/domain/repository/recipes_repository.dart"
        RecRepoImpl["RecipesRepositoryImpl"]:::data
        click RecRepoImpl "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/recipes/domain/repository/recipes_repository_impl.dart"
        RecDataSrc["RecipeDataSource"]:::data
        click RecDataSrc "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/recipes/data/datasources/recipe_data_soruces.dart"
        RecModel["RecipeModel"]:::data
        click RecModel "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/recipes/data/models/RecipeModel.dart"
    end
    Router -->|route| RecScreen
    RecScreen -->|calls| RecUseCase
    RecUseCase -->|depends on| RecRepoIntf
    RecRepoImpl -->|implements| RecRepoIntf
    RecRepoImpl -->|uses| RecDataSrc
    RecDataSrc -->|returns| RecModel

    subgraph "Feature: Home"
        direction TB
        HomeScreen["HomeScreen"]:::presentation
        click HomeScreen "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/home/presentation/screen/home_screen.dart"
        HomeVM["HomeViewModel"]:::state
        click HomeVM "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/home/presentation/viewmodels/home_viewmodel.dart"
        HomeUseCase["HomeUseCases"]:::domain
    end
    Router -->|route| HomeScreen
    HomeScreen -->|binds to| HomeVM
    HomeVM -->|uses| HomeUseCase

    subgraph "Feature: Auth"
        direction TB
        AuthPresentation["Auth Presentation"]:::presentation
        click AuthPresentation "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/auth/presentation/archivo.txt"
        AuthDomain["Auth Domain"]:::domain
        click AuthDomain "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/auth/domain/archivo.txt"
        AuthData["Auth Data"]:::data
        click AuthData "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/auth/data/archivo.txt"
    end

    subgraph "Feature: Favorites"
        direction TB
        FavPresentation["Favorites Presentation"]:::presentation
        click FavPresentation "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/favorites/presentation/archivo.txt"
        FavDomain["Favorites Domain"]:::domain
        click FavDomain "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/favorites/domain/archivo.txt"
        FavData["Favorites Data"]:::data
        click FavData "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/favorites/data/archivo.txt"
    end

    subgraph "Feature: Suggestion"
        direction TB
        SugScreen["SuggestionScreen"]:::presentation
        click SugScreen "https://github.com/brayanalmengor04/saborpty-app/blob/main/lib/features/suggestion/presentation/suggestion_screen.dart"
    end

    %% State Management
    CatUseCase -->|injected by| HomeVM
    RecUseCase -->|injected by| HomeVM

    %% External Services & Persistence
    subgraph "External Services & Persistence"
        direction TB
        Hive["Hive Local Store"]:::external
        SharedPref["SharedPreferences"]:::external
        LaravelAPI["Laravel REST API"]:::external
        Firebase["Firebase Services"]:::external
    end
    CatDataSrc -->|local| Hive
    RecDataSrc -->|local| Hive
    CatDataSrc -->|remote| LaravelAPI
    RecDataSrc -->|remote| LaravelAPI
    HomeVM -->|persists settings| SharedPref
    RecDataSrc -->|auth & analytics| Firebase

    %% Styles
    classDef presentation fill:#9ae6b4,stroke:#2f855a,color:#1a202c
    classDef state fill:#f6e05e,stroke:#d69e2e,color:#1a202c
    classDef domain fill:#bee3f8,stroke:#3182ce,color:#1a202c
    classDef data fill:#fed7d7,stroke:#e53e3e,color:#1a202c
    classDef core fill:#e2e8f0,stroke:#4a5568,color:#1a202c
    classDef shared fill:#c6f6d5,stroke:#2f855a,color:#1a202c
    classDef external fill:#f0f0f0,stroke:#718096,color:#1a202c
```
