# dheirav/thirsttrap architecture

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

- Interactive diagram: https://gitdiagram.com/dheirav/thirsttrap
- Repository: https://github.com/dheirav/thirsttrap

## Overview

ThirstTrap is an offline Android plant diary whose central workflow records pot weights, estimates when a plant reaches its watering trigger, and helps the user log care in a plant timeline. The graph also preserves the documented weighing-round, reminders, offline species catalogue and optional name lookup, places/light readings, photos, and portable backup capabilities. Several feature implementations were not sampled; their presence is based on the README and tree, so uncertain internal links are omitted.

Main entry points: [`app/src/main/kotlin/dev/dheirav/thirsttrap/feature/plantdetail/PlantDetailScreen.kt`](https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/feature/plantdetail/PlantDetailScreen.kt) (Plant timeline), [`core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/PlantRepositoryImpl.kt`](https://github.com/dheirav/thirsttrap/blob/main/core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/PlantRepositoryImpl.kt) (Plant data access), [`app/src/main/kotlin/dev/dheirav/thirsttrap/MainActivity.kt`](https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/MainActivity.kt) (App navigation), [`app/src/main/kotlin/dev/dheirav/thirsttrap/feature/dashboard/DashboardScreen.kt`](https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/feature/dashboard/DashboardScreen.kt) (Plant dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App experience"]
  node_activity["App navigation<br/>[MainActivity.kt]"]
  node_dashboard["Plant dashboard<br/>[DashboardScreen.kt]"]
  node_plant_detail["Plant timeline"]
  node_weighing_round["Weighing round<br/>[WeighingScreen.kt]"]
  node_weight_screen["Weight guidance<br/>[WeightScreen.kt]"]
  node_care_logging["Care logging<br/>[LogEventScreen.kt]"]
end

subgraph group_model["Plant care model"]
  node_plant_repository["Plant repository<br/>[PlantRepository.kt]"]
  node_prediction["Drying prediction<br/>[Prediction.kt]"]
  node_weight_contract["Weight state"]
end

subgraph group_data["Persistence and backup"]
  node_plant_data["Plant data access"]
  node_weight_data["Weight data access"]
  node_plant_dao["Plant and event tables<br/>[PlantDao.kt]"]
  node_weight_dao["Weight readings table<br/>[WeightDao.kt]"]
  node_database[("Local Room database")]
end

subgraph group_extras["Supporting capabilities"]
  node_reminders["Adaptive reminders<br/>[ReminderWorker.kt]"]
  node_catalogue["Offline species guide"]
  node_species_lookup["Species name lookup"]
  node_places_light["Places and light<br/>[LocationsScreen.kt]"]
  node_photo_storage["Plant photos<br/>[PhotoStore.kt]"]
  node_backup["Backup import/export"]
end

node_user(("Plant owner"))
node_system_picker["System file picker"]
node_gbif["GBIF name service"]

node_user -->|"opens app"| node_activity
node_activity -->|"starts at"| node_dashboard
node_dashboard -->|"opens plant"| node_plant_detail
node_user -->|"weighs pots"| node_weighing_round
node_weighing_round -.->|"records readings"| node_weight_data
node_weight_screen -->|"reads weight state"| node_weight_contract
node_weight_data -->|"reads and writes"| node_weight_dao
node_weight_dao -.->|"stores readings"| node_database
node_weight_contract -->|"provides prediction"| node_prediction
node_user -->|"logs care"| node_care_logging
node_care_logging -.->|"records events"| node_plant_data
node_plant_detail -.->|"shows timeline"| node_plant_data
node_plant_data -->|"reads and writes"| node_plant_dao
node_plant_dao -.->|"stores plants"| node_database
node_reminders -->|"reads plant data"| node_plant_repository
node_user -->|"browses offline"| node_catalogue
node_species_lookup -->|"resolves names"| node_gbif
node_user -->|"records place light"| node_places_light
node_plant_detail -->|"displays photos"| node_photo_storage
node_user -->|"backs up diary"| node_backup
node_backup -->|"selects archive"| node_system_picker

click node_activity "https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/MainActivity.kt"
click node_dashboard "https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/feature/dashboard/DashboardScreen.kt"
click node_plant_detail "https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/feature/plantdetail/PlantDetailScreen.kt"
click node_weighing_round "https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/feature/weighing/WeighingScreen.kt"
click node_weight_screen "https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/feature/weight/WeightScreen.kt"
click node_care_logging "https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/feature/logevent/LogEventScreen.kt"
click node_plant_repository "https://github.com/dheirav/thirsttrap/blob/main/core/domain/src/main/kotlin/dev/dheirav/thirsttrap/domain/PlantRepository.kt"
click node_prediction "https://github.com/dheirav/thirsttrap/blob/main/core/domain/src/main/kotlin/dev/dheirav/thirsttrap/domain/Prediction.kt"
click node_weight_contract "https://github.com/dheirav/thirsttrap/blob/main/core/domain/src/main/kotlin/dev/dheirav/thirsttrap/domain/WeightRepository.kt"
click node_plant_data "https://github.com/dheirav/thirsttrap/blob/main/core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/PlantRepositoryImpl.kt"
click node_weight_data "https://github.com/dheirav/thirsttrap/blob/main/core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/WeightRepositoryImpl.kt"
click node_plant_dao "https://github.com/dheirav/thirsttrap/blob/main/core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/dao/PlantDao.kt"
click node_weight_dao "https://github.com/dheirav/thirsttrap/blob/main/core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/dao/WeightDao.kt"
click node_database "https://github.com/dheirav/thirsttrap/blob/main/core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/ThirstTrapDatabase.kt"
click node_reminders "https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/reminder/ReminderWorker.kt"
click node_catalogue "https://github.com/dheirav/thirsttrap/blob/main/core/domain/src/main/kotlin/dev/dheirav/thirsttrap/domain/SpeciesCatalogueBundled.kt"
click node_species_lookup "https://github.com/dheirav/thirsttrap/blob/main/core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/GbifSpeciesLookupService.kt"
click node_places_light "https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/feature/locations/LocationsScreen.kt"
click node_photo_storage "https://github.com/dheirav/thirsttrap/blob/main/core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/PhotoStore.kt"
click node_backup "https://github.com/dheirav/thirsttrap/blob/main/core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/ExportRepositoryImpl.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_activity,node_dashboard,node_plant_detail,node_weighing_round,node_weight_screen,node_care_logging toneBlue
class node_plant_repository,node_prediction,node_weight_contract toneAmber
class node_plant_data,node_weight_data,node_plant_dao,node_weight_dao,node_database toneMint
class node_reminders,node_catalogue,node_species_lookup,node_places_light,node_photo_storage,node_backup toneRose
class node_user,node_system_picker,node_gbif toneIndigo
```

## Components

### App experience

- [App navigation](https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/MainActivity.kt): `app/src/main/kotlin/dev/dheirav/thirsttrap/MainActivity.kt`
- [Plant dashboard](https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/feature/dashboard/DashboardScreen.kt): `app/src/main/kotlin/dev/dheirav/thirsttrap/feature/dashboard/DashboardScreen.kt`
- [Plant timeline](https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/feature/plantdetail/PlantDetailScreen.kt): `app/src/main/kotlin/dev/dheirav/thirsttrap/feature/plantdetail/PlantDetailScreen.kt`
- [Weighing round](https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/feature/weighing/WeighingScreen.kt): `app/src/main/kotlin/dev/dheirav/thirsttrap/feature/weighing/WeighingScreen.kt`
- [Weight guidance](https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/feature/weight/WeightScreen.kt): `app/src/main/kotlin/dev/dheirav/thirsttrap/feature/weight/WeightScreen.kt`
- [Care logging](https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/feature/logevent/LogEventScreen.kt): `app/src/main/kotlin/dev/dheirav/thirsttrap/feature/logevent/LogEventScreen.kt`

### Plant care model

- [Plant repository](https://github.com/dheirav/thirsttrap/blob/main/core/domain/src/main/kotlin/dev/dheirav/thirsttrap/domain/PlantRepository.kt): `core/domain/src/main/kotlin/dev/dheirav/thirsttrap/domain/PlantRepository.kt`
- [Drying prediction](https://github.com/dheirav/thirsttrap/blob/main/core/domain/src/main/kotlin/dev/dheirav/thirsttrap/domain/Prediction.kt): `core/domain/src/main/kotlin/dev/dheirav/thirsttrap/domain/Prediction.kt`
- [Weight state](https://github.com/dheirav/thirsttrap/blob/main/core/domain/src/main/kotlin/dev/dheirav/thirsttrap/domain/WeightRepository.kt): `core/domain/src/main/kotlin/dev/dheirav/thirsttrap/domain/WeightRepository.kt`

### Persistence and backup

- [Plant data access](https://github.com/dheirav/thirsttrap/blob/main/core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/PlantRepositoryImpl.kt): `core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/PlantRepositoryImpl.kt`
- [Weight data access](https://github.com/dheirav/thirsttrap/blob/main/core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/WeightRepositoryImpl.kt): `core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/WeightRepositoryImpl.kt`
- [Plant and event tables](https://github.com/dheirav/thirsttrap/blob/main/core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/dao/PlantDao.kt): `core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/dao/PlantDao.kt`
- [Weight readings table](https://github.com/dheirav/thirsttrap/blob/main/core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/dao/WeightDao.kt): `core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/dao/WeightDao.kt`
- [Local Room database](https://github.com/dheirav/thirsttrap/blob/main/core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/ThirstTrapDatabase.kt): `core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/ThirstTrapDatabase.kt`

### Supporting capabilities

- [Adaptive reminders](https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/reminder/ReminderWorker.kt): `app/src/main/kotlin/dev/dheirav/thirsttrap/reminder/ReminderWorker.kt`
- [Offline species guide](https://github.com/dheirav/thirsttrap/blob/main/core/domain/src/main/kotlin/dev/dheirav/thirsttrap/domain/SpeciesCatalogueBundled.kt): `core/domain/src/main/kotlin/dev/dheirav/thirsttrap/domain/SpeciesCatalogueBundled.kt`
- [Species name lookup](https://github.com/dheirav/thirsttrap/blob/main/core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/GbifSpeciesLookupService.kt): `core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/GbifSpeciesLookupService.kt`
- [Places and light](https://github.com/dheirav/thirsttrap/blob/main/app/src/main/kotlin/dev/dheirav/thirsttrap/feature/locations/LocationsScreen.kt): `app/src/main/kotlin/dev/dheirav/thirsttrap/feature/locations/LocationsScreen.kt`
- [Plant photos](https://github.com/dheirav/thirsttrap/blob/main/core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/PhotoStore.kt): `core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/PhotoStore.kt`
- [Backup import/export](https://github.com/dheirav/thirsttrap/blob/main/core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/ExportRepositoryImpl.kt): `core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/ExportRepositoryImpl.kt`

### Other components

- **Plant owner**
- **System file picker**
- **GBIF name service**

## Connections

- Plant owner → App navigation: opens app
- App navigation → Plant dashboard: starts at (evidence: `app/src/main/kotlin/dev/dheirav/thirsttrap/MainActivity.kt`)
- Plant dashboard → Plant timeline: opens plant (evidence: `app/src/main/kotlin/dev/dheirav/thirsttrap/MainActivity.kt`)
- Plant owner → Weighing round: weighs pots
- Weighing round → Weight data access: records readings
- Weight guidance → Weight state: reads weight state (evidence: `core/domain/src/main/kotlin/dev/dheirav/thirsttrap/domain/WeightRepository.kt`)
- Weight data access → Weight readings table: reads and writes (evidence: `core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/WeightRepositoryImpl.kt`)
- Weight readings table → Local Room database: stores readings
- Weight state → Drying prediction: provides prediction (evidence: `core/domain/src/main/kotlin/dev/dheirav/thirsttrap/domain/WeightRepository.kt`)
- Plant owner → Care logging: logs care
- Care logging → Plant data access: records events
- Plant timeline → Plant data access: shows timeline
- Plant data access → Plant and event tables: reads and writes (evidence: `core/data/src/main/kotlin/dev/dheirav/thirsttrap/data/PlantRepositoryImpl.kt`)
- Plant and event tables → Local Room database: stores plants
- Adaptive reminders → Plant repository: reads plant data (evidence: `app/src/main/kotlin/dev/dheirav/thirsttrap/reminder/ReminderWorker.kt`)
- Plant owner → Offline species guide: browses offline
- Species name lookup → GBIF name service: resolves names
- Plant owner → Places and light: records place light
- Plant timeline → Plant photos: displays photos (evidence: `app/src/main/kotlin/dev/dheirav/thirsttrap/feature/plantdetail/PlantDetailScreen.kt`)
- Plant owner → Backup import/export: backs up diary
- Backup import/export → System file picker: selects archive
