# johnong55/reminote architecture

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

- Interactive diagram: https://gitdiagram.com/johnong55/reminote
- Repository: https://github.com/johnong55/reminote

## Overview

##### Project type and purpose
- REMINOTE is a cross-platform (Android, iOS, Web, Windows, macOS, Linux) Flutter application for note-taking and reminders.
- It supports offline-first functionality (using Isar local DB) with automatic sync to Firebase (Auth & Realtime/Firestore).

##### High-level file-structure analysis
- Platform directories (android/, ios/, web/, linux/, macos/, windows/) contain native wrappers & build scripts.
- lib/ is the heart of the app:
- lib/Page: UI screens and navigation
- lib/components: reusable widgets & dialogs
- lib/providers: state-management classes (Provider pattern)
- lib/services: business logic, orchestration (AuthService, NoteService, sync_service, etc.)
- lib/Offline_Repository & lib/Online_Repository: data access layers (Repository pattern)
- lib/API/firebase_api.dart: low-level Firebase calls
- lib/models: data models for offline (Isar) and online (Firebase)
- lib/utils & lib/config: helpers, constants, theming

a. Presentation Layer
- Screens & Widgets (lib/Page + lib/components)
- State-management (lib/providers)
b. Domain/Service Layer
- Services (AuthService, NoteService, HabitService, SyncService, etc.)
c. Data Layer
- Repositories:
- Offline (Isar)
- Online (Firebase)
- Low-level API (firebase_api.dart)
d. Data Stores & External Services
- Local DB: Isar
- Remote: Firebase Authentication, Firebase Realtime/Firestore
e. Platform Hosts
- Flutter engine on each platform (Android/iOS/Web/etc.)

##### Component relationships & interactions
- UI widgets dispatch user actions → Providers
- Providers call Services to perform business operations
- Services delegate to Repositories
- Offline Repository reads/writes local DB
- Online Repository performs Firebase calls via firebase_api
- SyncService monitors network & syncs local changes to Firebase
- Repositories return model objects back up to Services → Providers → UI

##### Important architectural patterns & principles
- Layered architecture separating Presentation, Domain, Data
- Repository pattern for data-source abstraction (Offline vs Online)
- Provider pattern for state management in Flutter
- Offline-first sync strategy (SyncService)

##### Technologies & frameworks
- Flutter & Dart
- Provider (state management)
- Isar (local persistence)
- Firebase (Auth, Realtime DB / Firestore)
- Lottie (animations)

##### Essential elements checklist
- Clear, self-descriptive labels on every component
- A note on the SyncService’s role in offline/online reconciliation

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Platform Hosts
    subgraph "Platform Hosts"
        direction TB
        Android["Android"]:::external
        iOS["iOS"]:::external
        Web["Web"]:::external
        Linux["Linux"]:::external
        macOS["macOS"]:::external
        Windows["Windows"]:::external
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        UIScreens["UI Screens"]:::ui
        Widgets["Reusable Widgets & Dialogs"]:::ui
        Providers["State Management (Providers)"]:::state
    end

    %% Domain/Service Layer
    subgraph "Domain/Service Layer"
        direction TB
        AuthService["AuthService"]:::service
        NoteService["NoteService"]:::service
        HabitService["HabitService"]:::service
        CompletionService["CompletionService"]:::service
        StreakService["StreakService"]:::service
        SyncService["SyncService"]:::serviceSpecial
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        OfflineRepo["Offline Repository"]:::repo
        OnlineRepo["Online Repository"]:::repo
        FirebaseAPI["Low-level Firebase API"]:::repo
        ModelsOffline["Data Models (Offline)"]:::model
        ModelsOnline["Data Models (Online)"]:::model
        Utils["Utilities & Helpers"]:::helper
        Config["Configuration & Theming"]:::helper
    end

    %% Data Stores & External Services
    subgraph "Data Stores & External Services"
        direction TB
        IsarDB["Isar Local DB"]:::external
        FirebaseAuth["Firebase Auth"]:::external
        FirebaseDB["Firebase Realtime/Firestore"]:::external
    end

    %% Relationships
    Android -->|hosts Flutter| UIScreens
    iOS -->|hosts Flutter| UIScreens
    Web -->|hosts Flutter| UIScreens
    Linux -->|hosts Flutter| UIScreens
    macOS -->|hosts Flutter| UIScreens
    Windows -->|hosts Flutter| UIScreens

    UIScreens -->|"dispatch actions"| Providers
    Widgets -->|"dispatch actions"| Providers
    Providers -->|"invoke"| AuthService
    Providers -->|"invoke"| NoteService
    Providers -->|"invoke"| HabitService
    Providers -->|"invoke"| CompletionService
    Providers -->|"invoke"| StreakService
    Providers -->|"subscribe"| SyncService

    AuthService -->|"authenticate"| OnlineRepo
    NoteService -->|"read/write"| OfflineRepo
    NoteService -->|"read/write"| OnlineRepo
    HabitService -->|"read/write"| OfflineRepo
    HabitService -->|"read/write"| OnlineRepo
    CompletionService -->|"update"| OfflineRepo
    CompletionService -->|"update"| OnlineRepo
    StreakService -->|"calculate"| OfflineRepo

    OfflineRepo -->|"read/write"| IsarDB
    OnlineRepo -->|"call API"| FirebaseAPI
    FirebaseAPI -->|"perform operations"| FirebaseAuth
    FirebaseAPI -->|"perform operations"| FirebaseDB

    SyncService -->|"sync changes"| OfflineRepo
    SyncService -->|"sync changes"| OnlineRepo
    SyncService -->|"bi-directional sync"| IsarDB
    SyncService -->|"bi-directional sync"| FirebaseDB

    ModelsOffline --> OfflineRepo
    ModelsOnline --> OnlineRepo
    Utils --> AuthService
    Utils --> NoteService
    Config --> UIScreens

    %% Click Events
    click UIScreens "https://github.com/johnong55/reminote/tree/main/lib/Page"
    click Widgets "https://github.com/johnong55/reminote/tree/main/lib/components"
    click Providers "https://github.com/johnong55/reminote/tree/main/lib/providers"
    click AuthService "https://github.com/johnong55/reminote/blob/main/lib/services/Auth_service.dart"
    click NoteService "https://github.com/johnong55/reminote/blob/main/lib/services/NoteService.dart"
    click HabitService "https://github.com/johnong55/reminote/blob/main/lib/services/HabitService.dart"
    click CompletionService "https://github.com/johnong55/reminote/blob/main/lib/services/CompletionService.dart"
    click StreakService "https://github.com/johnong55/reminote/blob/main/lib/services/StreakService.dart"
    click SyncService "https://github.com/johnong55/reminote/blob/main/lib/services/sync_service.dart"
    click OfflineRepo "https://github.com/johnong55/reminote/tree/main/lib/Offline_Repository"
    click OnlineRepo "https://github.com/johnong55/reminote/tree/main/lib/Online_Repository"
    click FirebaseAPI "https://github.com/johnong55/reminote/blob/main/lib/API/firebase_api.dart"
    click ModelsOffline "https://github.com/johnong55/reminote/tree/main/lib/models/Offine"
    click ModelsOnline "https://github.com/johnong55/reminote/tree/main/lib/models/Online"
    click Utils "https://github.com/johnong55/reminote/tree/main/lib/utils"
    click Config "https://github.com/johnong55/reminote/tree/main/lib/config"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0366D6,color:#0366D6
    classDef state fill:#E6FFEA,stroke:#28A745,color:#28A745
    classDef service fill:#FFF4D0,stroke:#D69E00,color:#D69E00
    classDef serviceSpecial fill:#FFE4E1,stroke:#D73A49,color:#D73A49
    classDef repo fill:#F3E8FF,stroke:#6F42C1,color:#6F42C1
    classDef model fill:#E2E8F0,stroke:#1A1A1A,color:#1A1A1A
    classDef helper fill:#F0FFF4,stroke:#22863A,color:#22863A
    classDef external fill:#FFEFEF,stroke:#CB2431,color:#CB2431
```
