# simonoppowa/opennutritracker architecture

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

- Interactive diagram: https://gitdiagram.com/simonoppowa/opennutritracker
- Repository: https://github.com/simonoppowa/opennutritracker

## Overview

OpenNutriTracker is a private, on-device nutrition and activity tracker. The main workflow is to set up a profile, derive calorie and macro goals, find or scan food, log meals, and review daily and longer-term nutrition. The graph also preserves documented capabilities for recipes, exercise, weight, water, fasting, portability, and theming. Most Flutter feature implementations were not sampled, so those links reflect README statements; the Android workout bridge is supported by the sampled native source.

Main entry points: [`lib/features/add_meal`](https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/add_meal) (Food search and scan), [`lib/features/diary`](https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/diary) (Food diary), [`lib/features/edit_meal`](https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/edit_meal) (Meal logging), [`lib/core/domain/usecase/import_workouts_usecase.dart`](https://github.com/simonoppowa/opennutritracker/blob/main/lib/core/domain/usecase/import_workouts_usecase.dart) (Workout import)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_goals["Goals and setup"]
  node_onboarding["Profile setup"]
  node_goalcalc["Goal calculations"]
  node_profile["Profile management"]
end

subgraph group_food["Food and diary"]
  node_foodsearch["Food search and scan"]
  node_fooddetail["Food details"]
  node_mealedit["Meal logging"]
  node_diary["Food diary"]
  node_recipes["Recipes"]
  node_home["Daily overview"]
  node_trends["Nutrition trends"]
end

subgraph group_wellness["Activity and wellness"]
  node_activity["Activities"]
  node_healthimport["Workout import"]
  node_weight["Weight history"]
  node_water["Water tracking"]
  node_fasting["Fasting timer"]
end

subgraph group_platform["Storage and platform"]
  node_healthbridge["Android health bridge<br/>[MainActivity.kt]"]
  node_healthreader["Health Connect reader"]
  node_portable["Import and export"]
  node_localstore[("Encrypted local data")]
  node_themes["Themes and units<br/>[app_theme.dart]"]
end

node_person(("User"))
node_off["Open Food Facts"]
node_usda["USDA FoodData"]
node_bls["German BLS"]

node_person -->|"sets up"| node_onboarding
node_onboarding -->|"provides profile"| node_goalcalc
node_goalcalc -->|"sets targets"| node_home
node_person -->|"finds or scans"| node_foodsearch
node_foodsearch -->|"searches"| node_off
node_foodsearch -->|"searches"| node_usda
node_foodsearch -->|"searches"| node_bls
node_foodsearch -->|"opens food"| node_fooddetail
node_fooddetail -.->|"logs food"| node_mealedit
node_person -->|"quick-adds"| node_mealedit
node_mealedit -->|"records meals"| node_diary
node_diary -->|"summarizes day"| node_home
node_diary -->|"feeds history"| node_trends
node_person -->|"creates recipes"| node_recipes
node_person -->|"logs activity"| node_activity
node_person -->|"imports workouts"| node_healthimport
node_healthimport -.->|"requests sessions"| node_healthbridge
node_healthbridge -->|"calls reader"| node_healthreader
node_healthreader -.->|"returns sessions"| node_healthimport
node_person -->|"logs weight"| node_weight
node_person -->|"logs water"| node_water
node_person -->|"starts timer"| node_fasting
node_person -->|"imports or exports"| node_portable
node_diary -->|"keeps diary"| node_localstore
node_person -->|"chooses theme"| node_themes

click node_onboarding "https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/onboarding"
click node_goalcalc "https://github.com/simonoppowa/opennutritracker/tree/main/lib/core/utils/calc"
click node_profile "https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/profile"
click node_foodsearch "https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/add_meal"
click node_fooddetail "https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/meal_detail"
click node_mealedit "https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/edit_meal"
click node_diary "https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/diary"
click node_recipes "https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/recipes"
click node_home "https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/home"
click node_trends "https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/trends"
click node_activity "https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/add_activity"
click node_healthimport "https://github.com/simonoppowa/opennutritracker/blob/main/lib/core/domain/usecase/import_workouts_usecase.dart"
click node_healthbridge "https://github.com/simonoppowa/opennutritracker/blob/main/android/app/src/main/kotlin/com/opennutritracker/ont/opennutritracker/MainActivity.kt"
click node_healthreader "https://github.com/simonoppowa/opennutritracker/blob/main/android/app/src/main/kotlin/com/opennutritracker/ont/opennutritracker/HealthConnectWorkoutReader.kt"
click node_weight "https://github.com/simonoppowa/opennutritracker/blob/main/lib/core/data/repository/weight_log_repository.dart"
click node_water "https://github.com/simonoppowa/opennutritracker/blob/main/lib/core/data/repository/water_intake_repository.dart"
click node_fasting "https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/fasting"
click node_portable "https://github.com/simonoppowa/opennutritracker/blob/main/lib/core/utils/csv_data_exporter.dart"
click node_localstore "https://github.com/simonoppowa/opennutritracker/blob/main/lib/core/utils/hive_db_provider.dart"
click node_themes "https://github.com/simonoppowa/opennutritracker/blob/main/lib/core/styles/app_theme.dart"

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_onboarding,node_goalcalc,node_profile,node_person toneBlue
class node_foodsearch,node_fooddetail,node_mealedit,node_diary,node_recipes,node_home,node_trends toneAmber
class node_activity,node_healthimport,node_weight,node_water,node_fasting toneMint
class node_healthbridge,node_healthreader,node_portable,node_localstore,node_themes toneRose
class node_off,node_usda,node_bls toneIndigo
```

## Components

### Goals and setup

- [Profile setup](https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/onboarding): `lib/features/onboarding`
- [Goal calculations](https://github.com/simonoppowa/opennutritracker/tree/main/lib/core/utils/calc): `lib/core/utils/calc`
- [Profile management](https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/profile): `lib/features/profile`

### Food and diary

- [Food search and scan](https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/add_meal): `lib/features/add_meal`
- [Food details](https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/meal_detail): `lib/features/meal_detail`
- [Meal logging](https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/edit_meal): `lib/features/edit_meal`
- [Food diary](https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/diary): `lib/features/diary`
- [Recipes](https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/recipes): `lib/features/recipes`
- [Daily overview](https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/home): `lib/features/home`
- [Nutrition trends](https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/trends): `lib/features/trends`

### Activity and wellness

- [Activities](https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/add_activity): `lib/features/add_activity`
- [Workout import](https://github.com/simonoppowa/opennutritracker/blob/main/lib/core/domain/usecase/import_workouts_usecase.dart): `lib/core/domain/usecase/import_workouts_usecase.dart`
- [Weight history](https://github.com/simonoppowa/opennutritracker/blob/main/lib/core/data/repository/weight_log_repository.dart): `lib/core/data/repository/weight_log_repository.dart`
- [Water tracking](https://github.com/simonoppowa/opennutritracker/blob/main/lib/core/data/repository/water_intake_repository.dart): `lib/core/data/repository/water_intake_repository.dart`
- [Fasting timer](https://github.com/simonoppowa/opennutritracker/tree/main/lib/features/fasting): `lib/features/fasting`

### Storage and platform

- [Android health bridge](https://github.com/simonoppowa/opennutritracker/blob/main/android/app/src/main/kotlin/com/opennutritracker/ont/opennutritracker/MainActivity.kt): `android/app/src/main/kotlin/com/opennutritracker/ont/opennutritracker/MainActivity.kt`
- [Health Connect reader](https://github.com/simonoppowa/opennutritracker/blob/main/android/app/src/main/kotlin/com/opennutritracker/ont/opennutritracker/HealthConnectWorkoutReader.kt): `android/app/src/main/kotlin/com/opennutritracker/ont/opennutritracker/HealthConnectWorkoutReader.kt`
- [Import and export](https://github.com/simonoppowa/opennutritracker/blob/main/lib/core/utils/csv_data_exporter.dart): `lib/core/utils/csv_data_exporter.dart`
- [Encrypted local data](https://github.com/simonoppowa/opennutritracker/blob/main/lib/core/utils/hive_db_provider.dart): `lib/core/utils/hive_db_provider.dart`
- [Themes and units](https://github.com/simonoppowa/opennutritracker/blob/main/lib/core/styles/app_theme.dart): `lib/core/styles/app_theme.dart`

### Other components

- **User**
- **Open Food Facts**
- **USDA FoodData**
- **German BLS**

## Connections

- User → Profile setup: sets up (evidence: `README.md`)
- Profile setup → Goal calculations: provides profile (evidence: `README.md`)
- Goal calculations → Daily overview: sets targets (evidence: `README.md`)
- User → Food search and scan: finds or scans (evidence: `README.md`)
- Food search and scan → Open Food Facts: searches (evidence: `README.md`)
- Food search and scan → USDA FoodData: searches (evidence: `README.md`)
- Food search and scan → German BLS: searches (evidence: `README.md`)
- Food search and scan → Food details: opens food (evidence: `README.md`)
- Food details → Meal logging: logs food
- User → Meal logging: quick-adds (evidence: `README.md`)
- Meal logging → Food diary: records meals (evidence: `README.md`)
- Food diary → Daily overview: summarizes day (evidence: `README.md`)
- Food diary → Nutrition trends: feeds history (evidence: `README.md`)
- User → Recipes: creates recipes (evidence: `README.md`)
- User → Activities: logs activity (evidence: `README.md`)
- User → Workout import: imports workouts (evidence: `README.md`)
- Workout import → Android health bridge: requests sessions
- Android health bridge → Health Connect reader: calls reader (evidence: `android/app/src/main/kotlin/com/opennutritracker/ont/opennutritracker/MainActivity.kt`)
- Health Connect reader → Workout import: returns sessions
- User → Weight history: logs weight (evidence: `README.md`)
- User → Water tracking: logs water (evidence: `README.md`)
- User → Fasting timer: starts timer (evidence: `README.md`)
- User → Import and export: imports or exports (evidence: `README.md`)
- Food diary → Encrypted local data: keeps diary (evidence: `README.md`)
- User → Themes and units: chooses theme (evidence: `README.md`)
