Instruction file imported from adsamcik/StarlitCoffee (
.github/instructions/persistence.instructions.md). Copyright stays with the author.
- Keep Room entities and DAOs under
data/db; keep repository wrappers underdata/repository. - DAOs should expose
Flowfor observable reads andsuspendfunctions for writes. - ViewModels depend on repositories rather than calling DAOs directly.
- When changing entities, update
AppDatabaseversion, add explicit migrations, and keep exported schemas inapp/schemas/. AppDatabase.getInstance(context)is the current manual singleton; do not introduce a second database creation path.UserPreferencesRepositoryowns DataStore preferences for onboarding, default method/filter/grinder, ratio, input direction, and quick-brew behavior.- Keep repository methods small and predictable; put domain calculations in
domain/orutil/, not in DAOs.