# markaniban10/calorie-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/markaniban10/calorie-tracker
- Repository: https://github.com/markaniban10/calorie-tracker

## Overview

Calorie Tracker is an offline-first nutrition and weight-tracking app. Users set a profile to calculate a calorie target, log foods and daily meals, and record weight; optional account features provide sign-in and cloud backup/restore. The graph reflects documented screen navigation and sampled module references. Some screen and storage implementations were not excerpted, so their internal calls are shown only where the source index or README supports them.

Main entry points: [`App.js`](https://github.com/markaniban10/calorie-tracker/blob/master/App.js) (App shell), [`src/storage/storage.js`](https://github.com/markaniban10/calorie-tracker/blob/master/src/storage/storage.js) (Offline storage), [`src/screens/TodayScreen.js`](https://github.com/markaniban10/calorie-tracker/blob/master/src/screens/TodayScreen.js) (Daily food log), [`src/cloud/AuthContext.js`](https://github.com/markaniban10/calorie-tracker/blob/master/src/cloud/AuthContext.js) (Auth and backup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App navigation"]
  node_app["App shell<br/>[App.js]"]
  node_drawer["Navigation drawer<br/>[Drawer.js]"]
  node_about["About<br/>[AboutScreen.js]"]
  node_contacts["Contacts<br/>[ContactsScreen.js]"]
  node_ui["Shared UI<br/>[ui.js]"]
  node_toast["Toast notifications<br/>[Toast.js]"]
end

subgraph group_tracking["Nutrition and weight tracking"]
  node_profile["Profile setup<br/>[ProfileScreen.js]"]
  node_today["Daily food log<br/>[TodayScreen.js]"]
  node_picker["Food picker<br/>[FoodPicker.js]"]
  node_foodform["Food form<br/>[FoodForm.js]"]
  node_myfoods["Custom foods<br/>[MyFoodsScreen.js]"]
  node_weight["Weight history<br/>[WeightScreen.js]"]
end

subgraph group_local["Local data and calculations"]
  node_storage[("Offline storage<br/>[storage.js]")]
  node_fooddata["Seed foods<br/>[foods.js]"]
  node_calc["Target calculations<br/>[calc.js]"]
end

subgraph group_account["Accounts and cloud"]
  node_accountscreen["Account settings<br/>[AccountScreen.js]"]
  node_login["Sign in<br/>[LoginScreen.js]"]
  node_auth["Auth and backup<br/>[AuthContext.js]"]
  node_firebase["Firebase client<br/>[firebase.js]"]
end

node_user(("App user"))
node_firebase_service[("Firebase services")]

node_user -->|"uses"| node_app
node_app -->|"shows"| node_today
node_app -->|"shows"| node_profile
node_app -->|"shows"| node_weight
node_app -->|"routes to"| node_about
node_app -->|"routes to"| node_contacts
node_app -->|"routes to"| node_accountscreen
node_app -->|"routes to"| node_login
node_app -->|"renders"| node_drawer
node_today -->|"renders"| node_picker
node_picker -->|"renders"| node_foodform
node_today -->|"reads and writes"| node_storage
node_picker -->|"manages foods"| node_storage
node_myfoods -->|"manages foods"| node_storage
node_myfoods -->|"renders"| node_foodform
node_weight -->|"records weights"| node_storage
node_profile -->|"calculates targets"| node_calc
node_today -->|"uses date key"| node_calc
node_weight -->|"uses date key"| node_calc
node_storage -->|"seeds from"| node_fooddata
node_login -->|"requests account actions"| node_auth
node_accountscreen -->|"uses account state"| node_auth
node_auth -->|"backs up local data"| node_storage
node_auth -->|"uses client"| node_firebase
node_firebase -->|"connects to"| node_firebase_service
node_app -->|"uses"| node_ui
node_app -->|"provides"| node_toast

click node_app "https://github.com/markaniban10/calorie-tracker/blob/master/App.js"
click node_drawer "https://github.com/markaniban10/calorie-tracker/blob/master/src/components/Drawer.js"
click node_profile "https://github.com/markaniban10/calorie-tracker/blob/master/src/screens/ProfileScreen.js"
click node_today "https://github.com/markaniban10/calorie-tracker/blob/master/src/screens/TodayScreen.js"
click node_picker "https://github.com/markaniban10/calorie-tracker/blob/master/src/components/FoodPicker.js"
click node_foodform "https://github.com/markaniban10/calorie-tracker/blob/master/src/components/FoodForm.js"
click node_myfoods "https://github.com/markaniban10/calorie-tracker/blob/master/src/screens/MyFoodsScreen.js"
click node_weight "https://github.com/markaniban10/calorie-tracker/blob/master/src/screens/WeightScreen.js"
click node_about "https://github.com/markaniban10/calorie-tracker/blob/master/src/screens/AboutScreen.js"
click node_contacts "https://github.com/markaniban10/calorie-tracker/blob/master/src/screens/ContactsScreen.js"
click node_accountscreen "https://github.com/markaniban10/calorie-tracker/blob/master/src/screens/AccountScreen.js"
click node_login "https://github.com/markaniban10/calorie-tracker/blob/master/src/screens/LoginScreen.js"
click node_storage "https://github.com/markaniban10/calorie-tracker/blob/master/src/storage/storage.js"
click node_fooddata "https://github.com/markaniban10/calorie-tracker/blob/master/src/data/foods.js"
click node_calc "https://github.com/markaniban10/calorie-tracker/blob/master/src/utils/calc.js"
click node_auth "https://github.com/markaniban10/calorie-tracker/blob/master/src/cloud/AuthContext.js"
click node_firebase "https://github.com/markaniban10/calorie-tracker/blob/master/src/cloud/firebase.js"
click node_ui "https://github.com/markaniban10/calorie-tracker/blob/master/src/components/ui.js"
click node_toast "https://github.com/markaniban10/calorie-tracker/blob/master/src/components/Toast.js"

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_app,node_drawer,node_about,node_contacts,node_ui,node_toast,node_user toneBlue
class node_profile,node_today,node_picker,node_foodform,node_myfoods,node_weight,node_firebase_service toneAmber
class node_storage,node_fooddata,node_calc toneMint
class node_accountscreen,node_login,node_auth,node_firebase toneRose
```

## Components

### App navigation

- [App shell](https://github.com/markaniban10/calorie-tracker/blob/master/App.js): `App.js`
- [Navigation drawer](https://github.com/markaniban10/calorie-tracker/blob/master/src/components/Drawer.js): `src/components/Drawer.js`
- [About](https://github.com/markaniban10/calorie-tracker/blob/master/src/screens/AboutScreen.js): `src/screens/AboutScreen.js`
- [Contacts](https://github.com/markaniban10/calorie-tracker/blob/master/src/screens/ContactsScreen.js): `src/screens/ContactsScreen.js`
- [Shared UI](https://github.com/markaniban10/calorie-tracker/blob/master/src/components/ui.js): `src/components/ui.js`
- [Toast notifications](https://github.com/markaniban10/calorie-tracker/blob/master/src/components/Toast.js): `src/components/Toast.js`

### Nutrition and weight tracking

- [Profile setup](https://github.com/markaniban10/calorie-tracker/blob/master/src/screens/ProfileScreen.js): `src/screens/ProfileScreen.js`
- [Daily food log](https://github.com/markaniban10/calorie-tracker/blob/master/src/screens/TodayScreen.js): `src/screens/TodayScreen.js`
- [Food picker](https://github.com/markaniban10/calorie-tracker/blob/master/src/components/FoodPicker.js): `src/components/FoodPicker.js`
- [Food form](https://github.com/markaniban10/calorie-tracker/blob/master/src/components/FoodForm.js): `src/components/FoodForm.js`
- [Custom foods](https://github.com/markaniban10/calorie-tracker/blob/master/src/screens/MyFoodsScreen.js): `src/screens/MyFoodsScreen.js`
- [Weight history](https://github.com/markaniban10/calorie-tracker/blob/master/src/screens/WeightScreen.js): `src/screens/WeightScreen.js`

### Local data and calculations

- [Offline storage](https://github.com/markaniban10/calorie-tracker/blob/master/src/storage/storage.js): `src/storage/storage.js`
- [Seed foods](https://github.com/markaniban10/calorie-tracker/blob/master/src/data/foods.js): `src/data/foods.js`
- [Target calculations](https://github.com/markaniban10/calorie-tracker/blob/master/src/utils/calc.js): `src/utils/calc.js`

### Accounts and cloud

- [Account settings](https://github.com/markaniban10/calorie-tracker/blob/master/src/screens/AccountScreen.js): `src/screens/AccountScreen.js`
- [Sign in](https://github.com/markaniban10/calorie-tracker/blob/master/src/screens/LoginScreen.js): `src/screens/LoginScreen.js`
- [Auth and backup](https://github.com/markaniban10/calorie-tracker/blob/master/src/cloud/AuthContext.js): `src/cloud/AuthContext.js`
- [Firebase client](https://github.com/markaniban10/calorie-tracker/blob/master/src/cloud/firebase.js): `src/cloud/firebase.js`

### Other components

- **App user**
- **Firebase services**

## Connections

- App user → App shell: uses (evidence: `App.js`)
- App shell → Daily food log: shows (evidence: `App.js`)
- App shell → Profile setup: shows (evidence: `App.js`)
- App shell → Weight history: shows (evidence: `App.js`)
- App shell → About: routes to (evidence: `App.js`)
- App shell → Contacts: routes to (evidence: `App.js`)
- App shell → Account settings: routes to (evidence: `App.js`)
- App shell → Sign in: routes to (evidence: `App.js`)
- App shell → Navigation drawer: renders (evidence: `App.js`)
- Daily food log → Food picker: renders (evidence: `src/screens/TodayScreen.js`)
- Food picker → Food form: renders (evidence: `src/components/FoodPicker.js`)
- Daily food log → Offline storage: reads and writes (evidence: `src/screens/TodayScreen.js`)
- Food picker → Offline storage: manages foods (evidence: `src/components/FoodPicker.js`)
- Custom foods → Offline storage: manages foods (evidence: `src/screens/MyFoodsScreen.js`)
- Custom foods → Food form: renders (evidence: `src/screens/MyFoodsScreen.js`)
- Weight history → Offline storage: records weights (evidence: `src/screens/WeightScreen.js`)
- Profile setup → Target calculations: calculates targets (evidence: `src/screens/ProfileScreen.js`)
- Daily food log → Target calculations: uses date key (evidence: `src/screens/TodayScreen.js`)
- Weight history → Target calculations: uses date key (evidence: `src/screens/WeightScreen.js`)
- Offline storage → Seed foods: seeds from (evidence: `src/storage/storage.js`)
- Sign in → Auth and backup: requests account actions (evidence: `src/screens/LoginScreen.js`)
- Account settings → Auth and backup: uses account state (evidence: `src/screens/AccountScreen.js`)
- Auth and backup → Offline storage: backs up local data (evidence: `src/cloud/AuthContext.js`)
- Auth and backup → Firebase client: uses client (evidence: `src/cloud/AuthContext.js`)
- Firebase client → Firebase services: connects to (evidence: `src/cloud/firebase.js`)
- App shell → Shared UI: uses (evidence: `App.js`)
- App shell → Toast notifications: provides (evidence: `App.js`)
