# lahsineyounes/markdown-notes-app architecture

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

- Interactive diagram: https://gitdiagram.com/lahsineyounes/markdown-notes-app
- Repository: https://github.com/lahsineyounes/markdown-notes-app

## Overview

1. **Repo shape**
   - This is a single-module Android app under `app/`, built with Kotlin and Jetpack Compose.
   - The architecture is intentionally simple: UI, ViewModel, and Room persistence live in one codebase with no multi-module split and no backend service.

2. **User-facing subsystems**
   - The main screens are `HomeScreen` and `EditorScreen` in `ui/`.
   - `MainActivity` is the app entry point and hosts the Compose UI flow.
   - `ui/theme/` contains the app’s Material 3 theming layer, separated from feature logic.

3. **Presentation layer**
   - Compose screens render note lists, editing, preview, search, empty states, and dialogs.
   - UI is state-driven: screens observe state exposed by `NoteViewModel` and send user actions back up.
   - This keeps composables mostly declarative, with the ViewModel handling the actual app behavior.

4. **State and business logic**
   - `NoteViewModel` is the central coordinator between UI and data.
   - It likely owns the current note list, selected note, search query, and editor state, exposed through `StateFlow`.
   - All create/edit/delete/search operations are funneled through this layer, so the UI does not talk to Room directly.

5. **Persistence layer**
   - `data/NoteDao.kt` defines the database operations for notes.
   - `data/NoteDatabase.kt` is the Room database entry point and provides access to the DAO.
   - This is the offline-first boundary: notes are stored locally on-device in SQLite via Room.

6. **Domain model**
   - `model/Note.kt` is the shared note data structure passed between UI, ViewModel, and database code.
   - It is the main data contract for the app and likely contains fields such as id, title, markdown content, tags, and timestamps.
   - Because the app is small, there is no separate domain/use-case layer.

7. **Markdown handling**
   - The editor/preview flow is a core feature: notes are authored as Markdown and rendered live in the UI.
   - The README says Markwon is used for Markdown rendering, so the preview is an in-app presentation concern rather than a server-side feature.
   - This means the markdown text is stored plain in Room and only transformed at render time.

8. **Search and tagging behavior**
   - The app supports real-time search across title and content and tag-based organization.
   - These behaviors are likely implemented in the ViewModel/DAO boundary, with queries feeding the home list state.
   - Tags are part of the note metadata, not a separate subsystem.

9. **Sample/demo data**
   - `data/SampleNotes.kt` suggests the app can preload or display example notes when empty or during initial development.
   - This is not a separate runtime system, but it helps shape first-run behavior and testing/demo scenarios.

10. **Platform and app shell**
   - `AndroidManifest.xml` defines the Android entry configuration, while `res/` holds app resources such as colors, themes, launcher assets, and strings.
   - `proguard-rules.pro` and Gradle files show a standard Android build setup with release shrinking/obfuscation support.
   - The target is Android API 26+, so the app is device-local and follows standard Android lifecycle constraints.

11. **Testing boundary**
   - There are both unit tests and instrumented tests under `app/src/test` and `app/src/androidTest`.
   - This indicates separation between JVM-level logic tests and device/emulator UI or integration tests.
   - The test structure fits the app’s layered design: ViewModel/data logic can be exercised independently of Compose UI.

12. **Overall data flow**
   - The main flow is: user interacts with Compose screens → screens call ViewModel actions → ViewModel updates state and invokes Room DAO methods → Room persists/query notes locally → updated state is emitted back to the UI.
   - All important behavior stays on-device; there is no network, sync, or external API boundary in the current repo.

Main entry points: [`app/src/main/java/com/example/markdownnotesapp/NoteViewModel.kt`](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/NoteViewModel.kt) (NoteViewModel), [`app/src/main/java/com/example/markdownnotesapp/ui/HomeScreen.kt`](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/ui/HomeScreen.kt) (HomeScreen), [`app/src/main/java/com/example/markdownnotesapp/MainActivity.kt`](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/MainActivity.kt) (MainActivity), [`app/src/main/java/com/example/markdownnotesapp/data/NoteDao.kt`](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/data/NoteDao.kt) (NoteDao)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app_shell["App shell"]
  node_main_activity["MainActivity<br/>compose entry<br/>[MainActivity.kt]"]
end

subgraph group_presentation["Presentation"]
  node_home_screen["HomeScreen<br/>compose screen<br/>[HomeScreen.kt]"]
  node_editor_screen["EditorScreen<br/>compose screen<br/>[EditorScreen.kt]"]
  node_app_theme["Theme<br/>[Theme.kt]"]
end

subgraph group_state["State"]
  node_note_vm["NoteViewModel<br/>state holder<br/>[NoteViewModel.kt]"]
end

subgraph group_persistence["Persistence"]
  node_note_database[("NoteDatabase<br/>room db<br/>[NoteDatabase.kt]")]
  node_note_dao["NoteDao<br/>room dao<br/>[NoteDao.kt]"]
  node_sample_notes["SampleNotes<br/>seed data<br/>[SampleNotes.kt]"]
end

subgraph group_model["Model"]
  node_note_model["Note<br/>data model<br/>[Note.kt]"]
end

subgraph group_platform["Platform"]
  node_manifest["Manifest<br/>android config"]
  node_strings["Strings<br/>resources<br/>[strings.xml]"]
  node_themes_xml["Themes<br/>resources<br/>[themes.xml]"]
  node_colors_xml["Colors<br/>resources<br/>[colors.xml]"]
end

subgraph group_tests["Tests"]
  node_unit_test(("UnitTest<br/>jvm test<br/>[ExampleUnitTest.kt]"))
  node_instrumented_test(("AndroidTest<br/>instrumented test"))
end

node_main_activity -->|"hosts"| node_home_screen
node_main_activity -->|"creates"| node_note_vm
node_home_screen -->|"observes"| node_note_vm
node_editor_screen -->|"observes"| node_note_vm
node_home_screen -->|"navigates"| node_editor_screen
node_note_vm -->|"queries"| node_note_dao
node_note_vm -->|"uses"| node_note_database
node_note_database -->|"provides"| node_note_dao
node_note_dao -->|"persists"| node_note_model
node_sample_notes -->|"seeds"| node_note_model
node_note_vm -.->|"loads"| node_sample_notes
node_home_screen -->|"uses"| node_app_theme
node_editor_screen -->|"uses"| node_app_theme
node_manifest -->|"declares"| node_main_activity
node_themes_xml -.->|"backs"| node_app_theme
node_colors_xml -.->|"backs"| node_app_theme
node_unit_test -.->|"verifies"| node_note_vm
node_unit_test -.->|"verifies"| node_note_dao
node_instrumented_test -.->|"covers"| node_main_activity
node_instrumented_test -.->|"covers"| node_home_screen

click node_main_activity "https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/MainActivity.kt"
click node_home_screen "https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/ui/HomeScreen.kt"
click node_editor_screen "https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/ui/EditorScreen.kt"
click node_app_theme "https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/ui/theme/Theme.kt"
click node_note_vm "https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/NoteViewModel.kt"
click node_note_database "https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/data/NoteDatabase.kt"
click node_note_dao "https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/data/NoteDao.kt"
click node_sample_notes "https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/data/SampleNotes.kt"
click node_note_model "https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/model/Note.kt"
click node_manifest "https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/AndroidManifest.xml"
click node_strings "https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/res/values/strings.xml"
click node_themes_xml "https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/res/values/themes.xml"
click node_colors_xml "https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/res/values/colors.xml"
click node_unit_test "https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/test/java/com/example/markdownnotesapp/ExampleUnitTest.kt"
click node_instrumented_test "https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/androidTest/java/com/example/markdownnotesapp/ExampleInstrumentedTest.kt"

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_main_activity,node_unit_test,node_instrumented_test toneBlue
class node_home_screen,node_editor_screen,node_app_theme toneAmber
class node_note_vm toneMint
class node_note_database,node_note_dao,node_sample_notes toneRose
class node_note_model toneIndigo
class node_manifest,node_strings,node_themes_xml,node_colors_xml toneTeal
```

## Components

### App shell

Android entrypoint and process-level wiring

- [MainActivity](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/MainActivity.kt): compose entry · Android entrypoint that hosts the Compose UI flow · `app/src/main/java/com/example/markdownnotesapp/MainActivity.kt`

### Presentation

Compose screens and theme

- [HomeScreen](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/ui/HomeScreen.kt): compose screen · Main list and navigation surface for notes · `app/src/main/java/com/example/markdownnotesapp/ui/HomeScreen.kt`
- [EditorScreen](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/ui/EditorScreen.kt): compose screen · Note editing and live preview surface · `app/src/main/java/com/example/markdownnotesapp/ui/EditorScreen.kt`
- [Theme](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/ui/theme/Theme.kt): material 3 theme · App-wide colors, typography, and theme setup · `app/src/main/java/com/example/markdownnotesapp/ui/theme/Theme.kt`

### State

ViewModel and UI state coordination

- [NoteViewModel](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/NoteViewModel.kt): state holder · Coordinates UI actions, search, editor state, and data operations · `app/src/main/java/com/example/markdownnotesapp/NoteViewModel.kt`

### Persistence

Room database and DAO

- [NoteDatabase](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/data/NoteDatabase.kt): room db · Room database entry point for local note storage · `app/src/main/java/com/example/markdownnotesapp/data/NoteDatabase.kt`
- [NoteDao](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/data/NoteDao.kt): room dao · Database queries and write operations for notes · `app/src/main/java/com/example/markdownnotesapp/data/NoteDao.kt`
- [SampleNotes](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/data/SampleNotes.kt): seed data · Example notes used for empty-state or demo behavior · `app/src/main/java/com/example/markdownnotesapp/data/SampleNotes.kt`

### Model

Shared note data contract

- [Note](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/java/com/example/markdownnotesapp/model/Note.kt): data model · Shared note contract passed across UI, state, and persistence · `app/src/main/java/com/example/markdownnotesapp/model/Note.kt`

### Platform

Android manifest and app resources

- [Manifest](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/AndroidManifest.xml): android config · Application entry and Android component configuration · `app/src/main/AndroidManifest.xml`
- [Strings](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/res/values/strings.xml): resources · App text resources and labels · `app/src/main/res/values/strings.xml`
- [Themes](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/res/values/themes.xml): resources · Android theme resource definitions · `app/src/main/res/values/themes.xml`
- [Colors](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/main/res/values/colors.xml): resources · Shared color resource definitions · `app/src/main/res/values/colors.xml`

### Tests

Unit and instrumented test boundaries

- [UnitTest](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/test/java/com/example/markdownnotesapp/ExampleUnitTest.kt): jvm test · JVM-level logic test boundary · `app/src/test/java/com/example/markdownnotesapp/ExampleUnitTest.kt`
- [AndroidTest](https://github.com/lahsineyounes/markdown-notes-app/blob/main/app/src/androidTest/java/com/example/markdownnotesapp/ExampleInstrumentedTest.kt): instrumented test · Device or emulator integration test boundary · `app/src/androidTest/java/com/example/markdownnotesapp/ExampleInstrumentedTest.kt`

## Connections

- MainActivity → HomeScreen: hosts · Main activity launches the Compose UI flow
- MainActivity → NoteViewModel: creates · Activity provides the central ViewModel to the UI
- HomeScreen → NoteViewModel: observes · Home screen renders state and dispatches actions
- EditorScreen → NoteViewModel: observes · Editor screen reads state and sends edits upward
- HomeScreen → EditorScreen: navigates · Home view leads into note editing flow
- NoteViewModel → NoteDao: queries · ViewModel routes note reads and writes through Room
- NoteViewModel → NoteDatabase: uses · ViewModel depends on the local database boundary
- NoteDatabase → NoteDao: provides · Database exposes the DAO implementation
- NoteDao → Note: persists · DAO reads and writes the shared note entity
- SampleNotes → Note: seeds · Sample data uses the same note contract
- NoteViewModel → SampleNotes: loads · ViewModel can populate demo or empty-state content
- HomeScreen → Theme: uses · Compose screens consume the shared theme layer
- EditorScreen → Theme: uses · Editor screen uses the same material styling
- Manifest → MainActivity: declares · Android manifest registers the app entrypoint
- Themes → Theme: backs · XML theme resources support the Compose theme setup
- Colors → Theme: backs · Color resources feed the app theme
- UnitTest → NoteViewModel: verifies · Unit tests target state and logic boundaries
- UnitTest → NoteDao: verifies · JVM tests can cover repository-facing logic
- AndroidTest → MainActivity: covers · Instrumented tests exercise app startup and UI integration
- AndroidTest → HomeScreen: covers · UI tests can validate the Compose home flow
