How lahsineyounes/markdown-notes-app works
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: NoteViewModel.kt NoteViewModel · HomeScreen.kt HomeScreen · MainActivity.kt MainActivity · NoteDao.kt NoteDao
Components 15
App shell
Android entrypoint and process-level wiring
- MainActivity · Android entrypoint that hosts the Compose UI flow
app/src/main/java/com/example/markdownnotesapp/MainActivity.kt
Presentation
Compose screens and theme
- HomeScreen · Main list and navigation surface for notes
app/src/main/java/com/example/markdownnotesapp/ui/HomeScreen.kt - EditorScreen · Note editing and live preview surface
app/src/main/java/com/example/markdownnotesapp/ui/EditorScreen.kt - 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 · Coordinates UI actions, search, editor state, and data operations
app/src/main/java/com/example/markdownnotesapp/NoteViewModel.kt
Persistence
Room database and DAO
- NoteDatabase · Room database entry point for local note storage
app/src/main/java/com/example/markdownnotesapp/data/NoteDatabase.kt - NoteDao · Database queries and write operations for notes
app/src/main/java/com/example/markdownnotesapp/data/NoteDao.kt - SampleNotes · 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 · 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 · Application entry and Android component configuration
app/src/main/AndroidManifest.xml - Strings · App text resources and labels
app/src/main/res/values/strings.xml - Themes · Android theme resource definitions
app/src/main/res/values/themes.xml - Colors · Shared color resource definitions
app/src/main/res/values/colors.xml
Tests
Unit and instrumented test boundaries
- UnitTest · JVM-level logic test boundary
app/src/test/java/com/example/markdownnotesapp/ExampleUnitTest.kt - AndroidTest · Device or emulator integration test boundary
app/src/androidTest/java/com/example/markdownnotesapp/ExampleInstrumentedTest.kt
Connections 20
- 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