# petchauisui/mnote-flutter architecture

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

- Interactive diagram: https://gitdiagram.com/petchauisui/mnote-flutter
- Repository: https://github.com/petchauisui/mnote-flutter

## Overview

Mnote is a Flutter Markdown note workspace. Its main user flow is sign-in, opening or creating a note, editing and previewing it, then saving locally; cloud sync and the AI assistant are additional capabilities. The README documents these behaviors, but the sampled Dart excerpts are absent, so most product relationships below cite the README rather than inspected implementation. The sampled native code only confirms platform setup and an iOS stylus bridge.

Main entry points: [`lib/features/workspace/presentation/markdown_workspace_page.dart`](https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/workspace/presentation/markdown_workspace_page.dart) (Markdown workspace), [`lib/features/workspace/data/local_document_repository.dart`](https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/workspace/data/local_document_repository.dart) (Document repository), [`lib/app/mnote_app.dart`](https://github.com/petchauisui/mnote-flutter/blob/main/lib/app/mnote_app.dart) (App shell), [`lib/features/auth/presentation/auth_page.dart`](https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/auth/presentation/auth_page.dart) (Sign-in screens)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App and access"]
  node_app["App shell<br/>[mnote_app.dart]"]
  node_authui["Sign-in screens<br/>[auth_page.dart]"]
  node_authrepo["Firebase authentication"]
end

subgraph group_workspace["Notes workspace"]
  node_library["Note library"]
  node_workspaceui["Markdown workspace"]
  node_editor["Markdown editor"]
  node_preview["Markdown preview"]
  node_diagrams["Mermaid diagrams"]
  node_ink["Ink annotations<br/>[ink_session.dart]"]
end

subgraph group_cloud["Sync and storage"]
  node_localrepo["Document repository"]
  node_database[("Local library database")]
  node_files["Device document files"]
  node_syncrepo["Sync repository"]
  node_firestore["Firestore and Storage"]
end

subgraph group_assistant["AI assistant"]
  node_aiui["Assistant chat"]
  node_ai["Firebase AI assistant"]
end

node_user(("Note user"))
node_firebase{{"Firebase services"}}

node_user -->|"opens app"| node_app
node_app -->|"requires sign-in"| node_authui
node_authui -->|"authenticates with"| node_authrepo
node_authrepo -->|"uses Firebase Auth"| node_firebase
node_user -->|"opens library"| node_library
node_library -->|"opens or creates"| node_workspaceui
node_workspaceui -->|"edits Markdown"| node_editor
node_workspaceui -->|"renders preview"| node_preview
node_preview -->|"renders Mermaid"| node_diagrams
node_workspaceui -->|"adds annotations"| node_ink
node_workspaceui -->|"saves documents"| node_localrepo
node_localrepo -.->|"persists library"| node_database
node_localrepo -->|"reads and writes files"| node_files
node_localrepo -->|"syncs local-first"| node_syncrepo
node_syncrepo -->|"stores cloud data"| node_firestore
node_firestore -->|"uses Firestore and Storage"| node_firebase
node_user -->|"asks questions"| node_aiui
node_aiui -.->|"sends prompts"| node_ai
node_ai -->|"uses Firebase AI"| node_firebase

click node_app "https://github.com/petchauisui/mnote-flutter/blob/main/lib/app/mnote_app.dart"
click node_authui "https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/auth/presentation/auth_page.dart"
click node_authrepo "https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/auth/data/firebase_auth_repository.dart"
click node_library "https://github.com/petchauisui/mnote-flutter/blob/main/lib/screens/note_list_screen.dart"
click node_workspaceui "https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/workspace/presentation/markdown_workspace_page.dart"
click node_editor "https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/workspace/presentation/markdown_live_editor.dart"
click node_preview "https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/workspace/presentation/document_page_render.dart"
click node_diagrams "https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/workspace/presentation/mermaid/mermaid_diagram_view.dart"
click node_ink "https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/workspace/presentation/ink_session.dart"
click node_localrepo "https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/workspace/data/local_document_repository.dart"
click node_database "https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/workspace/data/database/library_database.dart"
click node_files "https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/workspace/data/device_document_storage.dart"
click node_syncrepo "https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/sync/data/synced_document_repository.dart"
click node_firestore "https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/sync/data/firestore_library_store.dart"
click node_aiui "https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/assistant/presentation/assistant_chat_panel.dart"
click node_ai "https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/assistant/data/firebase_ai_assistant.dart"

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_app,node_authui,node_authrepo,node_user toneBlue
class node_library,node_workspaceui,node_editor,node_preview,node_diagrams,node_ink toneAmber
class node_localrepo,node_database,node_files,node_syncrepo,node_firestore toneMint
class node_aiui,node_ai toneRose
class node_firebase toneIndigo
```

## Components

### App and access

- [App shell](https://github.com/petchauisui/mnote-flutter/blob/main/lib/app/mnote_app.dart): `lib/app/mnote_app.dart`
- [Sign-in screens](https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/auth/presentation/auth_page.dart): `lib/features/auth/presentation/auth_page.dart`
- [Firebase authentication](https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/auth/data/firebase_auth_repository.dart): `lib/features/auth/data/firebase_auth_repository.dart`

### Notes workspace

- [Note library](https://github.com/petchauisui/mnote-flutter/blob/main/lib/screens/note_list_screen.dart): `lib/screens/note_list_screen.dart`
- [Markdown workspace](https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/workspace/presentation/markdown_workspace_page.dart): `lib/features/workspace/presentation/markdown_workspace_page.dart`
- [Markdown editor](https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/workspace/presentation/markdown_live_editor.dart): `lib/features/workspace/presentation/markdown_live_editor.dart`
- [Markdown preview](https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/workspace/presentation/document_page_render.dart): `lib/features/workspace/presentation/document_page_render.dart`
- [Mermaid diagrams](https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/workspace/presentation/mermaid/mermaid_diagram_view.dart): `lib/features/workspace/presentation/mermaid/mermaid_diagram_view.dart`
- [Ink annotations](https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/workspace/presentation/ink_session.dart): `lib/features/workspace/presentation/ink_session.dart`

### Sync and storage

- [Document repository](https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/workspace/data/local_document_repository.dart): `lib/features/workspace/data/local_document_repository.dart`
- [Local library database](https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/workspace/data/database/library_database.dart): `lib/features/workspace/data/database/library_database.dart`
- [Device document files](https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/workspace/data/device_document_storage.dart): `lib/features/workspace/data/device_document_storage.dart`
- [Sync repository](https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/sync/data/synced_document_repository.dart): `lib/features/sync/data/synced_document_repository.dart`
- [Firestore and Storage](https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/sync/data/firestore_library_store.dart): `lib/features/sync/data/firestore_library_store.dart`

### AI assistant

- [Assistant chat](https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/assistant/presentation/assistant_chat_panel.dart): `lib/features/assistant/presentation/assistant_chat_panel.dart`
- [Firebase AI assistant](https://github.com/petchauisui/mnote-flutter/blob/main/lib/features/assistant/data/firebase_ai_assistant.dart): `lib/features/assistant/data/firebase_ai_assistant.dart`

### Other components

- **Note user**
- **Firebase services**

## Connections

- Note user → App shell: opens app (evidence: `README.md`)
- App shell → Sign-in screens: requires sign-in (evidence: `README.md`)
- Sign-in screens → Firebase authentication: authenticates with (evidence: `README.md`)
- Firebase authentication → Firebase services: uses Firebase Auth (evidence: `README.md`)
- Note user → Note library: opens library (evidence: `README.md`)
- Note library → Markdown workspace: opens or creates (evidence: `README.md`)
- Markdown workspace → Markdown editor: edits Markdown (evidence: `README.md`)
- Markdown workspace → Markdown preview: renders preview (evidence: `README.md`)
- Markdown preview → Mermaid diagrams: renders Mermaid (evidence: `README.md`)
- Markdown workspace → Ink annotations: adds annotations (evidence: `README.md`)
- Markdown workspace → Document repository: saves documents (evidence: `README.md`)
- Document repository → Local library database: persists library
- Document repository → Device document files: reads and writes files (evidence: `README.md`)
- Document repository → Sync repository: syncs local-first (evidence: `README.md`)
- Sync repository → Firestore and Storage: stores cloud data (evidence: `README.md`)
- Firestore and Storage → Firebase services: uses Firestore and Storage (evidence: `README.md`)
- Note user → Assistant chat: asks questions (evidence: `README.md`)
- Assistant chat → Firebase AI assistant: sends prompts
- Firebase AI assistant → Firebase services: uses Firebase AI (evidence: `README.md`)
