# maelchiotti/localmaterialnotes architecture

> Architecture diagram of the GitHub repository maelchiotti/localmaterialnotes, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/maelchiotti/localmaterialnotes
- Repository: https://github.com/maelchiotti/localmaterialnotes

## Overview

##### Main Components Identification

The system should be divided into these key layers:

a. Presentation Layer:
- Pages (notes, bin, editor, labels, settings)
- Common Widgets
- Navigation Components
- App Bars

b. Business Logic Layer:
- Providers (for state management)
- Services
- Actions (for notes and labels operations)

c. Data Layer:
- Models (Note and Label)
- Database Service
- File System (for import/export)

##### Component Relationships

**[UI Layer]**
- ↑↓
**[Provider Layer]**
- ↑↓
**[Service Layer]**
- ↑↓
**[Data Layer]**

##### Specific Implementation Details

a. UI Components (Blue):
- Shell Page (main container)
- Notes Page
- Editor Page
- Labels Page
- Settings Pages
- Bin Page

b. State Management (Green):
- Notes Provider
- Labels Provider
- Preferences Provider
- Bin Provider

c. Services (Yellow):
- Database Service
- Notes Service
- Labels Service

d. Data Models (Orange):
- Model
- Preferences

e. Utilities (Gray):
- Export/Import Utils
- Encryption Utils
- File Utils
- Theme Utils

Key interactions:
- User Interface → Providers (user actions)
- Providers → Services (business logic)
- Services → Database (persistence)
- Services → File System (import/export)

##### Special Features to Highlight

- Encryption System
- Import/Export Functionality
- Localization System
- Theme Management

##### External Integrations

Connections to:
- File System (for JSON/Markdown export)
- System Share Interface
- Quick Actions

##### Technical Details

- Database: Isar (local storage)
- State Management: Provider pattern
- UI Framework: Flutter/Material Design
- Platform: Android

##### Important Notes

- Local-only nature of the app
- Separation between UI and business logic
- Modular structure of the components
- Localization system architecture

This system design should reflect the Flutter-based architecture while emphasizing the local-first, secure nature of the application, making it easy for other developers to understand the system's structure and data flow.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef provider fill:#2ecc71,stroke:#27ae60,color:white
    classDef service fill:#f1c40f,stroke:#f39c12,color:black
    classDef model fill:#e67e22,stroke:#d35400,color:white
    classDef util fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef common fill:#9b59b6,stroke:#8e44ad,color:white

    %% UI Layer
    subgraph UI
        Pages["Pages Container"]
        NP["Notes Page"]:::ui
        BP["Bin Page"]:::ui
        EP["Editor Page"]:::ui
        LP["Labels Page"]:::ui
        SP["Settings Pages"]:::ui

        Nav["Navigation Components"]
        AB["App Bars"]:::ui
        SN["Side Navigation"]:::ui
        TN["Top Navigation"]:::ui

        CW["Common Widgets"]
        NW["Notes Widgets"]:::common
        LW["Labels Widgets"]:::common
        PH["Placeholders"]:::common
    end

    %% Provider Layer
    subgraph StateManagement
        NotesProv["Notes Provider"]:::provider
        LabelsProv["Labels Provider"]:::provider
        PrefProv["Preferences Provider"]:::provider
        BinProv["Bin Provider"]:::provider
    end

    %% Service Layer
    subgraph Services
        DB["Database Service"]:::service
        NS["Notes Service"]:::service
        LS["Labels Service"]:::service
    end

    %% Data Layer
    subgraph Data
        NM["Note Model"]:::model
        LM["Label Model"]:::model
    end

    %% Utilities
    subgraph Utils
        EIU["Export/Import Utils"]:::util
        EU["Encryption Utils"]:::util
        TU["Theme Utils"]:::util
        SU["Share Utils"]:::util
    end

    %% Actions
    subgraph Actions
        NA["Notes Actions"]:::common
        LA["Labels Actions"]:::common
    end

    %% Relationships
    Pages --> NP & BP & EP & LP & SP
    Nav --> AB & SN & TN
    CW --> NW & LW & PH
    
    NP & EP & BP --> NotesProv
    LP --> LabelsProv
    SP --> PrefProv
    BP --> BinProv
    
    NotesProv & BinProv --> NS
    LabelsProv --> LS
    NS & LS --> DB
    
    DB --> NM & LM
    
    NS --> EIU
    EIU --> EU
    SP --> TU
    NP & EP --> SU

    %% Click events
    click NP "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/pages/notes/notes_page.dart"
    click BP "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/pages/bin/bin_page.dart"
    click EP "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/pages/editor/editor_page.dart"
    click LP "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/pages/labels/labels_page.dart"
    click SP "https://github.com/maelchiotti/LocalMaterialNotes/tree/main/lib/pages/settings/"
    click AB "https://github.com/maelchiotti/LocalMaterialNotes/tree/main/lib/common/navigation/app_bars/"
    click SN "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/common/navigation/side_navigation.dart"
    click TN "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/common/navigation/top_navigation.dart"
    click NotesProv "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/providers/notes/notes_provider.dart"
    click LabelsProv "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/providers/labels/labels/labels_provider.dart"
    click PrefProv "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/providers/preferences/preferences_provider.dart"
    click BinProv "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/providers/bin/bin_provider.dart"
    click DB "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/services/database_service.dart"
    click NS "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/services/notes/notes_service.dart"
    click LS "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/services/labels/labels_service.dart"
    click NM "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/models/note/note.dart"
    click LM "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/models/label/label.dart"
    click EIU "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/utils/files_utils.dart"
    click EU "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/utils/encryption_utils.dart"
    click TU "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/utils/theme_utils.dart"
    click SU "https://github.com/maelchiotti/LocalMaterialNotes/blob/main/lib/utils/share_utils.dart"
    click NA "https://github.com/maelchiotti/LocalMaterialNotes/tree/main/lib/common/actions/notes/"
    click LA "https://github.com/maelchiotti/LocalMaterialNotes/tree/main/lib/common/actions/labels/"
    click NW "https://github.com/maelchiotti/LocalMaterialNotes/tree/main/lib/common/widgets/notes/"
    click LW "https://github.com/maelchiotti/LocalMaterialNotes/tree/main/lib/common/widgets/labels/"
    click PH "https://github.com/maelchiotti/LocalMaterialNotes/tree/main/lib/common/widgets/placeholders/"
```
