# slineyube/notes architecture

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

- Interactive diagram: https://gitdiagram.com/slineyube/notes
- Repository: https://github.com/slineyube/notes

## Overview

#### Purpose and Runtime
Native Android notes application built in Kotlin. It supports creating, editing, searching, deleting, pinning, and viewing notes with image content. The app runs as a single Android module (`app/build.gradle.kts`) and uses Jetpack Compose, Room, Hilt, coroutines/Flow, Android storage, and intents; no backend or remote service is indicated.

#### Application Bootstrap
`NotesApp.kt` is the application-level initialization point and `MainActivity.kt` hosts the Compose UI. Android component registration and platform capabilities are defined in `app/src/main/AndroidManifest.xml`. Hilt provides dependency construction from the app boundary into ViewModels, use cases, and persistence.

Paths:
- `app/src/main/java/com/chukmaldin/notes/NotesApp.kt`
- `app/src/main/java/com/chukmaldin/notes/presentation/MainActivity.kt`
- `app/src/main/AndroidManifest.xml`

#### Presentation and Navigation
The presentation layer is Compose-based and organized around three user workflows: note list, creation, and editing. `NavGraph.kt` determines screen transitions and argument/control flow. Each screen delegates state and actions to its workflow-specific ViewModel rather than directly accessing Room or storage.

Paths:
- `app/src/main/java/com/chukmaldin/notes/presentation/navigation/NavGraph.kt`
- `app/src/main/java/com/chukmaldin/notes/presentation/screens/notes/NotesViewModel.kt`
- `app/src/main/java/com/chukmaldin/notes/presentation/screens/creation/CreateNoteViewModel.kt`
- `app/src/main/java/com/chukmaldin/notes/presentation/screens/editing/EditNoteViewModel.kt`

#### Domain Boundary
The domain layer defines app-owned `Note` and `ContentItem` models plus the `NotesRepository` abstraction. Focused use cases encapsulate commands and queries: add/edit/delete, retrieve list/detail, search, and switch pinned status. Presentation depends on these contracts/use cases, insulating it from Room schema and file-management details.

Paths:
- `app/src/main/java/com/chukmaldin/notes/domain/NotesRepository.kt`
- `app/src/main/java/com/chukmaldin/notes/domain/Note.kt`
- `app/src/main/java/com/chukmaldin/notes/domain/GetAllNotesUseCase.kt`
- `app/src/main/java/com/chukmaldin/notes/domain/EditNoteUseCase.kt`

#### Persistent Notes Model
Room is the local source of truth. A note is persisted separately from its content items, with `NoteWithContentDbModel` representing their joined relationship. `NotesDao` owns database operations/query access, while `NotesDatabase` defines the Room database. Flow-based repository queries can propagate storage changes back through use cases and ViewModels to Compose state.

Paths:
- `app/src/main/java/com/chukmaldin/notes/data/NotesDatabase.kt`
- `app/src/main/java/com/chukmaldin/notes/data/NotesDao.kt`
- `app/src/main/java/com/chukmaldin/notes/data/NoteDbModel.kt`
- `app/src/main/java/com/chukmaldin/notes/data/ContentItemDbModel.kt`

#### Repository, Mapping, and Media Boundary
`NotesRepositoryImpl` implements the domain repository by coordinating DAO access, database/domain mapping, and image lifecycle work. `Mapper.kt` is the explicit model boundary between Room entities/relations and domain values. `ImageFileManager.kt` isolates Android internal/external storage behavior; image files are therefore outside Room while their note content references are managed through the repository flow.

Paths:
- `app/src/main/java/com/chukmaldin/notes/data/NotesRepositoryImpl.kt`
- `app/src/main/java/com/chukmaldin/notes/data/Mapper.kt`
- `app/src/main/java/com/chukmaldin/notes/data/ImageFileManager.kt`

#### Dependency and Data Flow
`DataModule.kt` is the composition boundary binding Room, repository implementation, and related data dependencies. Main flow: user action in Compose → ViewModel → domain use case → `NotesRepository` → repository implementation → Room and/or image storage; query updates return via Flow to ViewModel state and rendered screens. Image selection/import is mediated by Android intents and storage APIs rather than a network integration.

Paths:
- `app/src/main/java/com/chukmaldin/notes/di/DataModule.kt`
- `app/src/main/java/com/chukmaldin/notes/data/NotesRepositoryImpl.kt`
- `app/src/main/java/com/chukmaldin/notes/presentation/screens/notes/NotesScreen.kt`

Main entry points: [`app/src/main/java/com/chukmaldin/notes/data/NotesRepositoryImpl.kt`](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/data/NotesRepositoryImpl.kt) (NotesRepositoryImpl), [`app/src/main/java/com/chukmaldin/notes/presentation/screens/notes/NotesScreen.kt`](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/presentation/screens/notes/NotesScreen.kt) (Compose Screens), [`app/src/main/java/com/chukmaldin/notes/NotesApp.kt`](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/NotesApp.kt) (NotesApp), [`app/src/main/java/com/chukmaldin/notes/di/DataModule.kt`](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/di/DataModule.kt) (DataModule)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_android["Android App"]
  node_manifest["Android Manifest<br/>platform registration"]
  node_app["NotesApp<br/>application bootstrap<br/>[NotesApp.kt]"]
  node_activity["MainActivity<br/>Compose host<br/>[MainActivity.kt]"]
  node_di{{"DataModule<br/>Hilt module<br/>[DataModule.kt]"}}
  node_android_media["Android Intents &amp; Storage<br/>platform media APIs"]
end

subgraph group_presentation["Compose Presentation"]
  node_nav["NavGraph<br/>navigation<br/>[NavGraph.kt]"]
  node_screens["Compose Screens<br/>UI workflows<br/>[NotesScreen.kt]"]
  node_notes_vm["NotesViewModel<br/>list ViewModel<br/>[NotesViewModel.kt]"]
  node_create_vm["CreateNoteViewModel<br/>creation ViewModel"]
  node_edit_vm["EditNoteViewModel<br/>editing ViewModel"]
end

subgraph group_domain["Domain"]
  node_usecases["Note Use Cases<br/>commands and queries"]
  node_repository_contract{{"NotesRepository<br/>repository contract<br/>[NotesRepository.kt]"}}
  node_domain_models["Note &amp; ContentItem<br/>domain models<br/>[Note.kt]"]
end

subgraph group_data["Local Data &amp; Media"]
  node_repository_impl["NotesRepositoryImpl<br/>repository implementation"]
  node_mapper["Mapper<br/>[Mapper.kt]"]
  node_dao["NotesDao<br/>Room DAO<br/>[NotesDao.kt]"]
  node_database[("NotesDatabase<br/>Room database<br/>[NotesDatabase.kt]")]
  node_room_models["Room Note &amp; Content Models<br/>entities and relation<br/>[NoteDbModel.kt]"]
  node_image_manager["ImageFileManager<br/>media storage adapter"]
end

node_manifest -->|"registers"| node_app
node_app -->|"starts"| node_activity
node_app -->|"initializes Hilt"| node_di
node_activity -->|"hosts"| node_nav
node_nav -->|"navigates"| node_screens
node_screens -->|"list actions/state"| node_notes_vm
node_screens -->|"creation actions/state"| node_create_vm
node_screens -->|"editing actions/state"| node_edit_vm
node_notes_vm -->|"invokes"| node_usecases
node_create_vm -->|"invokes"| node_usecases
node_edit_vm -->|"invokes"| node_usecases
node_usecases -->|"depends on"| node_repository_contract
node_usecases -->|"uses"| node_domain_models
node_di -->|"binds"| node_repository_impl
node_di -->|"provides"| node_database
node_repository_impl -->|"implements"| node_repository_contract
node_repository_impl -->|"reads and writes"| node_dao
node_repository_impl -->|"maps through"| node_mapper
node_repository_impl -->|"manages images"| node_image_manager
node_dao -->|"accesses"| node_database
node_database -->|"stores"| node_room_models
node_mapper -->|"converts"| node_room_models
node_mapper -->|"converts"| node_domain_models
node_image_manager -->|"uses"| node_android_media
node_android_media -.->|"image selection result"| node_screens
node_repository_contract -.->|"Flow updates"| node_notes_vm

click node_manifest "https://github.com/slineyube/notes/blob/master/app/src/main/AndroidManifest.xml"
click node_app "https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/NotesApp.kt"
click node_activity "https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/presentation/MainActivity.kt"
click node_di "https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/di/DataModule.kt"
click node_nav "https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/presentation/navigation/NavGraph.kt"
click node_screens "https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/presentation/screens/notes/NotesScreen.kt"
click node_notes_vm "https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/presentation/screens/notes/NotesViewModel.kt"
click node_create_vm "https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/presentation/screens/creation/CreateNoteViewModel.kt"
click node_edit_vm "https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/presentation/screens/editing/EditNoteViewModel.kt"
click node_repository_contract "https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/domain/NotesRepository.kt"
click node_domain_models "https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/domain/Note.kt"
click node_repository_impl "https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/data/NotesRepositoryImpl.kt"
click node_mapper "https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/data/Mapper.kt"
click node_dao "https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/data/NotesDao.kt"
click node_database "https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/data/NotesDatabase.kt"
click node_room_models "https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/data/NoteDbModel.kt"
click node_image_manager "https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/data/ImageFileManager.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_manifest,node_app,node_activity,node_di,node_android_media toneBlue
class node_nav,node_screens,node_notes_vm,node_create_vm,node_edit_vm toneAmber
class node_usecases,node_repository_contract,node_domain_models toneMint
class node_repository_impl,node_mapper,node_dao,node_database,node_room_models,node_image_manager toneRose
```

## Components

### Android App

- [Android Manifest](https://github.com/slineyube/notes/blob/master/app/src/main/AndroidManifest.xml): platform registration · Declares Android components and capabilities. · `app/src/main/AndroidManifest.xml`
- [NotesApp](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/NotesApp.kt): application bootstrap · Initializes the application and Hilt boundary. · `app/src/main/java/com/chukmaldin/notes/NotesApp.kt`
- [MainActivity](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/presentation/MainActivity.kt): Compose host · `app/src/main/java/com/chukmaldin/notes/presentation/MainActivity.kt`
- [DataModule](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/di/DataModule.kt): Hilt module · Provides Room and repository dependencies. · `app/src/main/java/com/chukmaldin/notes/di/DataModule.kt`
- **Android Intents & Storage**: platform media APIs · Supplies image selection/import and file storage access.

### Compose Presentation

- [NavGraph](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/presentation/navigation/NavGraph.kt): navigation · Routes list, creation, and editing workflows. · `app/src/main/java/com/chukmaldin/notes/presentation/navigation/NavGraph.kt`
- [Compose Screens](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/presentation/screens/notes/NotesScreen.kt): UI workflows · List, creation, and editing screens render state and dispatch actions. · `app/src/main/java/com/chukmaldin/notes/presentation/screens/notes/NotesScreen.kt`
- [NotesViewModel](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/presentation/screens/notes/NotesViewModel.kt): list ViewModel · `app/src/main/java/com/chukmaldin/notes/presentation/screens/notes/NotesViewModel.kt`
- [CreateNoteViewModel](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/presentation/screens/creation/CreateNoteViewModel.kt): creation ViewModel · `app/src/main/java/com/chukmaldin/notes/presentation/screens/creation/CreateNoteViewModel.kt`
- [EditNoteViewModel](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/presentation/screens/editing/EditNoteViewModel.kt): editing ViewModel · `app/src/main/java/com/chukmaldin/notes/presentation/screens/editing/EditNoteViewModel.kt`

### Domain

- **Note Use Cases**: commands and queries · Adds, edits, deletes, lists, searches, retrieves, and pins notes.
- [NotesRepository](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/domain/NotesRepository.kt): repository contract · `app/src/main/java/com/chukmaldin/notes/domain/NotesRepository.kt`
- [Note & ContentItem](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/domain/Note.kt): domain models · `app/src/main/java/com/chukmaldin/notes/domain/Note.kt`

### Local Data & Media

- [NotesRepositoryImpl](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/data/NotesRepositoryImpl.kt): repository implementation · Coordinates persistence mapping and image lifecycle operations. · `app/src/main/java/com/chukmaldin/notes/data/NotesRepositoryImpl.kt`
- [Mapper](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/data/Mapper.kt): model mapper · Converts Room models and relations to domain values. · `app/src/main/java/com/chukmaldin/notes/data/Mapper.kt`
- [NotesDao](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/data/NotesDao.kt): Room DAO · Owns note and content-item queries and mutations. · `app/src/main/java/com/chukmaldin/notes/data/NotesDao.kt`
- [NotesDatabase](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/data/NotesDatabase.kt): Room database · Local source of truth for notes and content references. · `app/src/main/java/com/chukmaldin/notes/data/NotesDatabase.kt`
- [Room Note & Content Models](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/data/NoteDbModel.kt): entities and relation · Persists notes separately from content items and joins them for reads. · `app/src/main/java/com/chukmaldin/notes/data/NoteDbModel.kt`
- [ImageFileManager](https://github.com/slineyube/notes/blob/master/app/src/main/java/com/chukmaldin/notes/data/ImageFileManager.kt): media storage adapter · Manages image files outside Room using Android storage. · `app/src/main/java/com/chukmaldin/notes/data/ImageFileManager.kt`

## Connections

- Android Manifest → NotesApp: registers
- NotesApp → MainActivity: starts
- NotesApp → DataModule: initializes Hilt
- MainActivity → NavGraph: hosts
- NavGraph → Compose Screens: navigates
- Compose Screens → NotesViewModel: list actions/state
- Compose Screens → CreateNoteViewModel: creation actions/state
- Compose Screens → EditNoteViewModel: editing actions/state
- NotesViewModel → Note Use Cases: invokes
- CreateNoteViewModel → Note Use Cases: invokes
- EditNoteViewModel → Note Use Cases: invokes
- Note Use Cases → NotesRepository: depends on
- Note Use Cases → Note & ContentItem: uses
- DataModule → NotesRepositoryImpl: binds
- DataModule → NotesDatabase: provides
- NotesRepositoryImpl → NotesRepository: implements
- NotesRepositoryImpl → NotesDao: reads and writes
- NotesRepositoryImpl → Mapper: maps through
- NotesRepositoryImpl → ImageFileManager: manages images
- NotesDao → NotesDatabase: accesses
- NotesDatabase → Room Note & Content Models: stores
- Mapper → Room Note & Content Models: converts
- Mapper → Note & ContentItem: converts
- ImageFileManager → Android Intents & Storage: uses
- Android Intents & Storage → Compose Screens: image selection result
- NotesRepository → NotesViewModel: Flow updates · Storage changes propagate to rendered UI state.
