# demizo/daily_you architecture

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

- Interactive diagram: https://gitdiagram.com/demizo/daily_you
- Repository: https://github.com/demizo/daily_you

## Overview

1. **Project shape**
   - Daily You is a **Flutter** cross-platform journaling app, targeting **Android, iOS, macOS, Linux, Windows**, with Android-specific native plugins and desktop packaging scripts.
   - The app is designed as **offline-first** and **local-data-only**: there is no backend service, account system, or cloud sync path in the repository.

2. **Top-level runtime boundary**
   - `lib/main.dart` bootstraps the Flutter app.
   - The app is then split into a small set of core services, a local persistence layer, state providers, and feature pages/widgets.
   - Platform-specific code exists mainly to bridge Flutter with device/file-system capabilities, especially on Android.

3. **Presentation layer**
   - User-facing screens live under `lib/pages/`:
     - journal flow: home, entry detail, edit entry, gallery, image view, launch page
     - analytics: statistics page
     - settings: appearance, backup/restore, flashback, language, notification, security, storage, templates, about
   - The UI is composed from reusable pieces in `lib/widgets/` such as entry cards, markdown editors/toolbars, mood pickers, charts, template selectors, and settings controls.

4. **State management boundary**
   - `lib/providers/` contains the app’s state orchestration:
     - `entries_provider.dart`
     - `entry_images_provider.dart`
     - `templates_provider.dart`
   - These providers sit between the UI and persistence/services, exposing journal data, image data, and template data to pages and widgets.

5. **Domain model**
   - Core data structures are in `lib/models/`:
     - `entry.dart`
     - `image.dart`
     - `template.dart`
     - `flashback.dart`
   - These models represent the journal domain: entries, attached images, reusable templates, and “flashback” content used by reminder/recall features.

6. **Local persistence layer**
   - `lib/database/` is the app’s main data boundary:
     - `app_database.dart` is the database entry point
     - DAOs manage specific entities: `entry_dao.dart`, `entry_image_dao.dart`, `template_dao.dart`
     - `image_storage.dart` handles image persistence separate from structured entry records
   - The architecture implies a split between **structured database records** and **file-backed binary image storage**.

7. **File and import/export flow**
   - Data portability is handled in `lib/utils/`:
     - `backup_restore_utils.dart`
     - `export_utils.dart`
     - `import_utils.dart`
     - `zip_utils.dart`
     - `file_layer.dart`
     - `saf_transfer.dart`
   - This suggests a pipeline where local journal data can be packaged, exported, imported, and restored, with file-system access abstracted to support device storage rules.

8. **Platform/device services**
   - Several top-level services coordinate device behavior:
     - `notification_manager.dart` for reminders
     - `flashback_manager.dart` for resurfacing past memories
     - `time_manager.dart` for date/time semantics
     - `device_info_service.dart` for platform-specific capabilities
     - `launch_intent.dart` for startup/context routing
     - `config_provider.dart` and `theme_mode_provider.dart` for app-wide settings
   - These act as app services rather than UI components.

9. **Native Android integration**
   - Android has custom Kotlin code in `android/app/src/main/kotlin/...`:
     - `MainActivity.kt`
     - `MediaScannerPlugin.kt`
     - `SafTransferPlugin.kt`
   - This is the main native boundary, likely used to support media visibility/scanning and Android Storage Access Framework file transfer behavior.

10. **Desktop/mobile platform shells**
   - iOS, macOS, Linux, and Windows folders are standard Flutter runners and packaging shells.
   - Desktop support includes native app entry points and generated plugin registrants, but the functional app logic remains in shared Dart code.

11. **Localization and regionalization**
   - The app is heavily localized:
     - source translations in `lib/l10n/*.arb`
     - generated localization code in `lib/l10n/generated/`
     - localized store metadata in `fastlane/metadata/android/`
   - UI text is therefore routed through the generated localization layer rather than hardcoded strings.

12. **Settings and user control**
   - The settings area is a major architectural surface, not an afterthought.
   - It exposes controls for appearance, language, notifications, security, storage location, templates, and backup/restore, reinforcing the app’s privacy/data-ownership model.

13. **Charts and insights**
   - Statistics and mood visualization are first-class features.
   - Chart widgets under `lib/widgets/` summarize mood over day/month and totals, while `lib/pages/statistics_page.dart` presents the aggregated view.
   - This indicates a read-heavy analytics path over the same local entry data.

14. **Build, release, and packaging pipeline**
   - Release automation is present via:
     - GitHub Actions in `.github/workflows/fastlane.yml`
     - Fastlane metadata in `fastlane/`
     - release scripts like `build_release.sh` and `prepare_release.sh`
     - Nix development environment via `flake.nix`
   - Packaging targets include Android app bundles/APKs, desktop artifacts, and likely AppImage/Snap outputs, but all are driven from the same Flutter source tree.

15. **Key architectural diagram boundaries**
   - The cleanest diagram should show:
     - **Flutter UI layer** → **state providers/services** → **local database + file storage**
     - side services for **notifications**, **backup/import/export**, **localization**, and **platform plugins**
     - platform shells around the shared Dart core
   - The central design principle is: **all user data stays on-device, and every major feature reads from or writes to local storage**.

Main entry points: [`lib/providers/entries_provider.dart`](https://github.com/demizo/daily_you/blob/master/lib/providers/entries_provider.dart) (Entries), [`lib/utils/backup_restore_utils.dart`](https://github.com/demizo/daily_you/blob/master/lib/utils/backup_restore_utils.dart) (Backup flow), [`lib/main.dart`](https://github.com/demizo/daily_you/blob/master/lib/main.dart) (Main), [`lib/pages/settings_page.dart`](https://github.com/demizo/daily_you/blob/master/lib/pages/settings_page.dart) (Settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Core app"]
  node_lib_main["Main<br/>Flutter bootstrap<br/>[main.dart]"]
  node_responsive_layout["Responsive UI<br/>App shell"]
  node_localizations["Localizations<br/>i18n layer"]
end

subgraph group_ui["Feature UI"]
  node_launch_page["Launch<br/>Startup page<br/>[launch_page.dart]"]
  node_home_page["Home<br/>Journal page<br/>[home_page.dart]"]
  node_entry_detail_page["Entry detail<br/>Journal page"]
  node_edit_entry_page["Edit entry<br/>Editor page"]
  node_gallery_page["Gallery<br/>Media page<br/>[gallery_page.dart]"]
  node_statistics_page["Statistics<br/>Insights page"]
  node_settings_page["Settings<br/>Control page<br/>[settings_page.dart]"]
end

subgraph group_state["State & services"]
  node_entries_provider["Entries<br/>State provider"]
  node_entry_images_provider["Images<br/>State provider"]
  node_templates_provider["Templates<br/>State provider"]
  node_notification_manager["Notifications<br/>App service"]
  node_flashback_manager["Flashback<br/>App service"]
end

subgraph group_data["Local data"]
  node_app_database[("Database<br/>Local DB<br/>[app_database.dart]")]
  node_image_storage[("Image store<br/>File storage<br/>[image_storage.dart]")]
  node_backup_utils["Backup flow<br/>Transfer pipeline"]
  node_file_layer["File layer<br/>File abstraction<br/>[file_layer.dart]"]
end

subgraph group_platform["Platform shell"]
  node_android_bridge["Android bridge<br/>Native plugins<br/>[MainActivity.kt]"]
  node_desktop_runner["Desktop runner<br/>Runner shell<br/>[main.cpp]"]
end

node_lib_main -->|"boots shell"| node_responsive_layout
node_lib_main -->|"starts at"| node_launch_page
node_lib_main -->|"loads text"| node_localizations
node_responsive_layout -->|"hosts"| node_home_page
node_home_page -->|"reads entries"| node_entries_provider
node_entry_detail_page -->|"reads entry"| node_entries_provider
node_edit_entry_page -->|"writes entries"| node_entries_provider
node_gallery_page -->|"reads images"| node_entry_images_provider
node_edit_entry_page -->|"edits images"| node_entry_images_provider
node_statistics_page -->|"aggregates data"| node_entries_provider
node_settings_page -->|"manages templates"| node_templates_provider
node_settings_page -->|"configures reminders"| node_notification_manager
node_settings_page -->|"backup/restore"| node_backup_utils
node_entries_provider -->|"persists records"| node_app_database
node_templates_provider -->|"persists templates"| node_app_database
node_entry_images_provider -->|"loads assets"| node_image_storage
node_backup_utils -->|"uses files"| node_file_layer
node_backup_utils -->|"exports db"| node_app_database
node_backup_utils -->|"exports media"| node_image_storage
node_flashback_manager -->|"recalls entries"| node_entries_provider
node_notification_manager -->|"formats text"| node_localizations
node_android_bridge -->|"bridges storage"| node_file_layer
node_desktop_runner -->|"launches app"| node_lib_main

click node_lib_main "https://github.com/demizo/daily_you/blob/master/lib/main.dart"
click node_responsive_layout "https://github.com/demizo/daily_you/blob/master/lib/layouts/responsive_layout.dart"
click node_launch_page "https://github.com/demizo/daily_you/blob/master/lib/pages/launch_page.dart"
click node_home_page "https://github.com/demizo/daily_you/blob/master/lib/pages/home_page.dart"
click node_entry_detail_page "https://github.com/demizo/daily_you/blob/master/lib/pages/entry_detail_page.dart"
click node_edit_entry_page "https://github.com/demizo/daily_you/blob/master/lib/pages/edit_entry_page.dart"
click node_gallery_page "https://github.com/demizo/daily_you/blob/master/lib/pages/gallery_page.dart"
click node_statistics_page "https://github.com/demizo/daily_you/blob/master/lib/pages/statistics_page.dart"
click node_settings_page "https://github.com/demizo/daily_you/blob/master/lib/pages/settings_page.dart"
click node_entries_provider "https://github.com/demizo/daily_you/blob/master/lib/providers/entries_provider.dart"
click node_entry_images_provider "https://github.com/demizo/daily_you/blob/master/lib/providers/entry_images_provider.dart"
click node_templates_provider "https://github.com/demizo/daily_you/blob/master/lib/providers/templates_provider.dart"
click node_notification_manager "https://github.com/demizo/daily_you/blob/master/lib/notification_manager.dart"
click node_flashback_manager "https://github.com/demizo/daily_you/blob/master/lib/flashback_manager.dart"
click node_app_database "https://github.com/demizo/daily_you/blob/master/lib/database/app_database.dart"
click node_image_storage "https://github.com/demizo/daily_you/blob/master/lib/database/image_storage.dart"
click node_backup_utils "https://github.com/demizo/daily_you/blob/master/lib/utils/backup_restore_utils.dart"
click node_file_layer "https://github.com/demizo/daily_you/blob/master/lib/utils/file_layer.dart"
click node_localizations "https://github.com/demizo/daily_you/blob/master/lib/l10n/generated/app_localizations.dart"
click node_android_bridge "https://github.com/demizo/daily_you/blob/master/android/app/src/main/kotlin/com/example/daily_you/MainActivity.kt"
click node_desktop_runner "https://github.com/demizo/daily_you/blob/master/windows/runner/main.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_lib_main,node_responsive_layout,node_localizations toneBlue
class node_launch_page,node_home_page,node_entry_detail_page,node_edit_entry_page,node_gallery_page,node_statistics_page,node_settings_page toneAmber
class node_entries_provider,node_entry_images_provider,node_templates_provider,node_notification_manager,node_flashback_manager toneMint
class node_app_database,node_image_storage,node_backup_utils,node_file_layer toneRose
class node_android_bridge,node_desktop_runner toneIndigo
```

## Components

### Core app

Flutter bootstrap, shared shell, and app-wide configuration

- [Main](https://github.com/demizo/daily_you/blob/master/lib/main.dart): Flutter bootstrap · App entry point that initializes the shared Flutter runtime · `lib/main.dart`
- [Responsive UI](https://github.com/demizo/daily_you/blob/master/lib/layouts/responsive_layout.dart): App shell · Shared layout scaffold for mobile and desktop form factors · `lib/layouts/responsive_layout.dart`
- [Localizations](https://github.com/demizo/daily_you/blob/master/lib/l10n/generated/app_localizations.dart): i18n layer · Generated localized strings used throughout the UI · `lib/l10n/generated/app_localizations.dart`

### Feature UI

User-facing pages and reusable presentation components

- [Launch](https://github.com/demizo/daily_you/blob/master/lib/pages/launch_page.dart): Startup page · Initial routing and startup context handling · `lib/pages/launch_page.dart`
- [Home](https://github.com/demizo/daily_you/blob/master/lib/pages/home_page.dart): Journal page · Primary entry feed and navigation hub · `lib/pages/home_page.dart`
- [Entry detail](https://github.com/demizo/daily_you/blob/master/lib/pages/entry_detail_page.dart): Journal page · Reads and presents a single journal entry · `lib/pages/entry_detail_page.dart`
- [Edit entry](https://github.com/demizo/daily_you/blob/master/lib/pages/edit_entry_page.dart): Editor page · Creates and updates journal entries and attachments · `lib/pages/edit_entry_page.dart`
- [Gallery](https://github.com/demizo/daily_you/blob/master/lib/pages/gallery_page.dart): Media page · Browse attached journal images · `lib/pages/gallery_page.dart`
- [Statistics](https://github.com/demizo/daily_you/blob/master/lib/pages/statistics_page.dart): Insights page · Aggregated mood and activity analytics · `lib/pages/statistics_page.dart`
- [Settings](https://github.com/demizo/daily_you/blob/master/lib/pages/settings_page.dart): Control page · Entry point for app preferences and data management · `lib/pages/settings_page.dart`

### State & services

Providers and app services that coordinate reads, writes, and device behavior

- [Entries](https://github.com/demizo/daily_you/blob/master/lib/providers/entries_provider.dart): State provider · Orchestrates journal entry data between UI and persistence · `lib/providers/entries_provider.dart`
- [Images](https://github.com/demizo/daily_you/blob/master/lib/providers/entry_images_provider.dart): State provider · Coordinates attached image metadata and loading · `lib/providers/entry_images_provider.dart`
- [Templates](https://github.com/demizo/daily_you/blob/master/lib/providers/templates_provider.dart): State provider · Exposes reusable journal templates to the UI · `lib/providers/templates_provider.dart`
- [Notifications](https://github.com/demizo/daily_you/blob/master/lib/notification_manager.dart): App service · Schedules reminder behavior and notification delivery · `lib/notification_manager.dart`
- [Flashback](https://github.com/demizo/daily_you/blob/master/lib/flashback_manager.dart): App service · Surfaces past memories and recall prompts · `lib/flashback_manager.dart`

### Local data

Database, file-backed storage, and import/export flows

- [Database](https://github.com/demizo/daily_you/blob/master/lib/database/app_database.dart): Local DB · Structured persistence entry point for journal records · `lib/database/app_database.dart`
- [Image store](https://github.com/demizo/daily_you/blob/master/lib/database/image_storage.dart): File storage · Separates binary image persistence from structured records · `lib/database/image_storage.dart`
- [Backup flow](https://github.com/demizo/daily_you/blob/master/lib/utils/backup_restore_utils.dart): Transfer pipeline · Packages, exports, imports, and restores local data · `lib/utils/backup_restore_utils.dart`
- [File layer](https://github.com/demizo/daily_you/blob/master/lib/utils/file_layer.dart): File abstraction · Abstracts file-system access for device rules and storage locations · `lib/utils/file_layer.dart`

### Platform shell

Native and runner integration for mobile and desktop targets

- [Android bridge](https://github.com/demizo/daily_you/blob/master/android/app/src/main/kotlin/com/example/daily_you/MainActivity.kt): Native plugins · Custom Kotlin plugins for media scanning and SAF transfers · `android/app/src/main/kotlin/com/example/daily_you/MainActivity.kt`
- [Desktop runner](https://github.com/demizo/daily_you/blob/master/windows/runner/main.cpp): Runner shell · Platform launcher and generated desktop integration · `windows/runner/main.cpp`

## Connections

- Main → Responsive UI: boots shell · Initializes the app shell and responsive presentation
- Main → Launch: starts at · Routes first into the launch flow
- Main → Localizations: loads text · Uses generated locale resources for UI strings
- Responsive UI → Home: hosts · Renders the main journal home experience
- Home → Entries: reads entries · Consumes journal data through state providers
- Entry detail → Entries: reads entry · Loads a selected entry through shared state
- Edit entry → Entries: writes entries · Creates and updates journal content
- Gallery → Images: reads images · Browses attachment state and image records
- Edit entry → Images: edits images · Manages attachments during entry editing
- Statistics → Entries: aggregates data · Builds charts from local entry history
- Settings → Templates: manages templates · Exposes template settings and reuse flows
- Settings → Notifications: configures reminders · Adjusts notification behavior from settings
- Settings → Backup flow: backup/restore · Drives import, export, and restore actions
- Entries → Database: persists records · Reads and writes structured journal data
- Templates → Database: persists templates · Stores template definitions locally
- Images → Image store: loads assets · Retrieves attached image data from file-backed storage
- Backup flow → File layer: uses files · Packages data through the storage abstraction
- Backup flow → Database: exports db · Serializes local structured data for backup and restore
- Backup flow → Image store: exports media · Includes binary attachments in portability flows
- Flashback → Entries: recalls entries · Surfaces past journal content for flashback features
- Notifications → Localizations: formats text · Uses localized content for reminder messaging
- Android bridge → File layer: bridges storage · Connects Android native behavior to file-transfer flows
- Desktop runner → Main: launches app · Desktop shell hands control to the shared Flutter entry point
