# kurokeita/quotable-flutter-app architecture

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

- Interactive diagram: https://gitdiagram.com/kurokeita/quotable-flutter-app
- Repository: https://github.com/kurokeita/quotable-flutter-app

## Overview

##### Main Components

a) Frontend Layer (Presentation):
- Views/Screens (found in lib/ui/views/)
- Home View
- Quote List View
- Quote of the Day View
- Startup View
- Components (lib/ui/components/)
- Layout components
- Quote-specific components (cards and tiles)
- Bottom Sheets
- Dialogs

b) Business Logic Layer:
- ViewModels (MVVM pattern is used with Stacked architecture)
- Services Layer (lib/services/)
- API Service
- Authentication Service
- Database Service
- Quote Service
- Author Service
- Preference Service

c) Data Layer:
- Models (lib/models/)
- Quote Model
- Author Model
- Repositories (lib/database/)
- Quote Repository
- Author Repository
- Base Repository

d) Platform-Specific Implementations:
- Android Implementation
- iOS Implementation
- Web Implementation

**┌─────────────────────────────────────────┐**
- Presentation Layer (UI)                 │
- Views                                 │
- Components                            │
- Bottom Sheets                         │
- Dialogs                               │
- ┬───────────────────────┘
- ↕
**┌─────────────────┴───────────────────────┐**
- Business Logic Layer                    │
- ViewModels                           │
- Services                             │
- ┬───────────────────────┘
- ↕
**┌─────────────────┴───────────────────────┐**
- Data Layer                              │
- Models                                │
- Repositories                          │
- ┘

##### Connection Types
- Double lines for data bindings between ViewModels and Views

##### Additional Elements

a) Navigation Flow:
- Relationships between views
- Bottom sheet and dialog triggers

b) Data Flow:
- API to Repository to Service to ViewModel to View

##### Notes for Implementation
- Version information
- Document all external dependencies

##### The service layer's role in managing business logic

Remember to maintain a balance between detail and clarity, focusing on the architectural decisions that make this quotes application unique while following Flutter and Stacked architecture best practices.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef logic fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#e67e22,stroke:#d35400,color:white
    classDef config fill:#95a5a6,stroke:#7f8c8d,color:white

    %% App Configuration
    subgraph Config
        AppSetup["App Setup"]
        Router["Router"]
        ServiceLocator["Service Locator"]
        DialogSetup["Dialog Setup"]
        BottomSheetSetup["Bottom Sheet Setup"]
    end

    %% UI Layer
    subgraph UI
        subgraph Views
            HomeView["Home View"]
            QuoteListView["Quote List View"]
            QuoteDayView["Quote of Day View"]
            StartupView["Startup View"]
        end

        subgraph Components
            QuoteComponents["Quote Components"]
            LayoutComponents["Layout Components"]
        end

        subgraph Dialogs
            DialogComponents["Dialog Components"]
        end

        subgraph BottomSheets
            BottomSheetComponents["Bottom Sheet Components"]
        end
    end

    %% Business Logic Layer
    subgraph Logic
        subgraph ViewModels
            HomeVM["Home ViewModel"]
            QuoteListVM["Quote List ViewModel"]
            QuoteDayVM["Quote of Day ViewModel"]
            StartupVM["Startup ViewModel"]
        end

        subgraph Services
            APIService["API Service"]
            AuthService["Authentication Service"]
            DBService["Database Service"]
            QuoteService["Quote Service"]
            AuthorService["Author Service"]
            PrefService["Preference Service"]
        end
    end

    %% Data Layer
    subgraph Data
        subgraph Models
            QuoteModel["Quote Model"]
            AuthorModel["Author Model"]
        end

        subgraph Repositories
            QuoteRepo["Quote Repository"]
            AuthorRepo["Author Repository"]
            BaseRepo["Base Repository"]
        end
    end

    %% Relationships
    HomeView --> HomeVM
    QuoteListView --> QuoteListVM
    QuoteDayView --> QuoteDayVM
    StartupView --> StartupVM

    ViewModels --> Services
    Services --> Repositories
    Repositories --> Models

    %% Click Events
    click HomeView "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/ui/views/home/home_view.dart"
    click QuoteListView "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/ui/views/quote_list/quote_list_view.dart"
    click QuoteDayView "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/ui/views/quote_of_the_day/quote_of_the_day_view.dart"
    click StartupView "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/ui/views/startup/startup_view.dart"
    
    click QuoteComponents "https://github.com/kurokeita/quotable-flutter-app/tree/main/lib/ui/components/quotes/"
    click LayoutComponents "https://github.com/kurokeita/quotable-flutter-app/tree/main/lib/ui/components/layout/"
    click DialogComponents "https://github.com/kurokeita/quotable-flutter-app/tree/main/lib/ui/dialogs/"
    click BottomSheetComponents "https://github.com/kurokeita/quotable-flutter-app/tree/main/lib/ui/bottom_sheets/"
    
    click HomeVM "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/ui/views/home/home_viewmodel.dart"
    click QuoteListVM "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/ui/views/quote_list/quote_list_viewmodel.dart"
    click QuoteDayVM "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/ui/views/quote_of_the_day/quote_of_the_day_viewmodel.dart"
    click StartupVM "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/ui/views/startup/startup_viewmodel.dart"
    
    click APIService "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/services/api_service.dart"
    click AuthService "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/services/authentication_service.dart"
    click DBService "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/services/database_service.dart"
    click QuoteService "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/services/quotes/quote_service.dart"
    click AuthorService "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/services/authors/author_service.dart"
    click PrefService "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/services/preferences/preference_service.dart"
    
    click QuoteModel "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/models/quote.model.dart"
    click AuthorModel "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/models/author.model.dart"
    click QuoteRepo "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/database/quote.repository.dart"
    click AuthorRepo "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/database/author.repository.dart"
    click BaseRepo "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/database/base.repository.dart"
    
    click AppSetup "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/app/app.dart"
    click Router "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/app/app.router.dart"
    click ServiceLocator "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/app/app.locator.dart"
    click DialogSetup "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/app/app.dialogs.dart"
    click BottomSheetSetup "https://github.com/kurokeita/quotable-flutter-app/blob/main/lib/app/app.bottomsheets.dart"

    %% Apply styles
    class HomeView,QuoteListView,QuoteDayView,StartupView,QuoteComponents,LayoutComponents,DialogComponents,BottomSheetComponents ui
    class HomeVM,QuoteListVM,QuoteDayVM,StartupVM,APIService,AuthService,DBService,QuoteService,AuthorService,PrefService logic
    class QuoteModel,AuthorModel,QuoteRepo,AuthorRepo,BaseRepo data
    class AppSetup,Router,ServiceLocator,DialogSetup,BottomSheetSetup config
```
