# himera19/book_reminder architecture

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

- Interactive diagram: https://gitdiagram.com/himera19/book_reminder
- Repository: https://github.com/himera19/book_reminder

## Overview

##### Main Components
- Mobile Platform Layer: Illustrate both Android and iOS platforms, as the project has dedicated folders (android/ and ios/) for each platform. These represent the native configurations and build pipelines.
- Presentation/UI Layer: Under the lib/pages and lib/presentation directories you have widgets, pages (e.g., book_list_page, book_detail_page, favorites_page) and common UI components. This is where the view and user interaction elements reside.
- Business Logic/State Management Layer: Represent the Provider-based state management (lib/presentation/providers) which includes providers like book_provider, favorite_provider, language_provider, and theme_provider. These control the application state and business logic.
- Data Access Layer: Show the data repository and services under lib/data (including book_repository.dart and notification_service.dart). This layer interacts with both external APIs (using HTTP) and local storage.
- Model Layer: Add a component for domain models (lib/models) that encapsulate book information (e.g., book_model.dart).
- Local Storage and External Services: Highlight the use of Hive for local storage and Flutter Local Notification for scheduling reminders. This shows integration with external systems.
- Localization and Theming: Include the localization (lib/l10n) and theme components provided in the UI and state management parts.

##### Out Relationships and Interactions
- Data layer with Model components since repositories transform data into business objects.
- Also, indicate interaction from the user interface to the Notification Service (for setting daily reminders) and localization services.

##### Architectural Patterns and Design Principles
- Separation of concerns by having distinct layers: UI, state management, business logic, and data.
- Use of Provider for dependency injection and state management, and how it decouples the UI from the data and business logic layers.
- That local persistence with Hive and the API querying system (using HTTP) are key integration points.
- Reactive programming model as a central design principle, given that UI elements react to state changes managed by providers.

##### Technologies and Frameworks
- Flutter (UI Framework for building responsive interfaces).
- Provider (State management).
- Hive (Local storage).
- Flutter Local Notification (For reminders).
- HTTP (Communication with external API).
- Flutter Localizations (Internationalization support with English and Turkish).
- Tools like Very Good Analysis (linting) and Mockito (testing) can be noted as supporting tools that ensure quality and reliability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Mobile Platform Layer
    subgraph "Mobile Platforms"
        A1("Android (Native Configuration)"):::mobile
        A2("iOS (Native Configuration)"):::mobile
    end

    %% Core Flutter Application
    subgraph "Core Flutter Application"
        %% Presentation / UI Layer
        subgraph "Presentation/UI Layer"
            UI1("UI - Pages"):::ui
            UI2("UI - Widgets"):::ui
        end

        %% Business Logic / State Management Layer
        subgraph "Business Logic/State Management"
            SM("State Management (Providers)"):::state
        end

        %% Data Access Layer
        subgraph "Data Access Layer"
            D1("Book Repository"):::data
            D2("Notification Service"):::data
        end

        %% Model Layer
        subgraph "Model Layer"
            M("Book Model"):::model
        end

        %% Localization & Theming
        subgraph "Localization & Theming"
            L1("Localization Resources"):::localization
            T1("Theming Widgets"):::localization
        end
    end

    %% External Services
    E1("HTTP (External API)"):::external
    E2("Hive (Local Storage)"):::external

    %% Connections from Mobile Platforms to Flutter Application
    A1 -->|"bootstraps"| UI1
    A2 -->|"bootstraps"| UI1

    %% UI Layer triggers State Management
    UI1 -->|"triggers_update"| SM
    UI2 -->|"triggers_update"| SM

    %% State Management calls Data Access
    SM -->|"fetches/saves"| D1
    SM -->|"schedules_reminder"| D2

    %% Data Repository transforms data to Model and communicates with external systems
    D1 -->|"transforms_to"| M
    D1 -->|"calls_API"| E1
    D1 -->|"reads/writes"| E2

    %% Notification Service updates state (bidirectional interaction)
    D2 -->|"notifies"| SM

    %% UI utilizes Localization & Theming
    UI1 -->|"applies"| L1
    UI2 -->|"applies"| T1

    %% Click Events
    click A1 "https://github.com/himera19/book_reminder/blob/master/android/app/src/main/kotlin/com/book/reminder/MainActivity.kt"
    click A2 "https://github.com/himera19/book_reminder/blob/master/ios/Runner/AppDelegate.swift"
    click UI1 "https://github.com/himera19/book_reminder/tree/master/lib/pages/"
    click UI2 "https://github.com/himera19/book_reminder/tree/master/lib/presentation/widgets/"
    click SM "https://github.com/himera19/book_reminder/tree/master/lib/presentation/providers/"
    click D1 "https://github.com/himera19/book_reminder/blob/master/lib/data/repositories/book_repository.dart"
    click D2 "https://github.com/himera19/book_reminder/blob/master/lib/data/services/notification_service.dart"
    click M "https://github.com/himera19/book_reminder/blob/master/lib/models/book_model.dart"
    click L1 "https://github.com/himera19/book_reminder/tree/master/lib/l10n/"
    click T1 "https://github.com/himera19/book_reminder/blob/master/lib/presentation/widgets/common_widgets/app_colors.dart"

    %% Styles
    classDef mobile fill:#ffd966,stroke:#333,stroke-width:2px;
    classDef ui fill:#cfe2f3,stroke:#333,stroke-width:2px;
    classDef state fill:#d9ead3,stroke:#333,stroke-width:2px;
    classDef data fill:#f4cccc,stroke:#333,stroke-width:2px;
    classDef model fill:#d0e0e3,stroke:#333,stroke-width:2px;
    classDef external fill:#ead1dc,stroke:#333,stroke-width:2px;
    classDef localization fill:#fff2cc,stroke:#333,stroke-width:2px;
```
