Website: https://smartdiet--8p02056r17.expo.app/ (To quickly access mobile view, use the shortcut Ctrl + Shift + M (Windows/Linux) or Cmd + Shift + M (Mac))
SmartDiet is a cross-platform (iOS & Android) React Native application that helps users track daily nutrition, water intake, sleep, and view weekly overviews. It leverages the CalorieNinjas nutrition API to fetch macronutrient data for meals, stores daily logs in AsyncStorage, and provides configurable goals based on user settings.
- Features
- Screens & Navigation
- Prerequisites
- Installation
- Configuration
- Running the App
- Project Structure
- Key Components
- License
- Log breakfast, lunch, supper, water intake (ml), and sleep (hrs)
- Fetch macronutrient data (protein, carbs, fat, fiber) via CalorieNinjas API
- Store daily records in AsyncStorage
- Compute progress vs. personalized goals (maintain, lose, gain weight)
- Visualize progress with circular progress indicators
- Weekly overview selector to browse past entries
- User settings screen to configure gender and weight goals
- Bottom tab navigation for quick access to Home, Sports, Feedback, Recipes, and Learn screens
- Native-style stack navigation for settings
- Home – Main logging interface with progress circles and weekly overview.
- Sports – Placeholder for sports-related content.
- Feedback – Screen to collect user feedback.
- Recipes – Recipe suggestions and browsing.
- Learn – Educational content about nutrition.
- UserSettings – Configure user gender and goals (accessed from any tab via the cog icon).
The bottom tab navigator (MainTabs) holds the first five screens. A native stack navigator wraps MainTabs and UserSettings, hiding the header on tabs and presenting settings modally.
- Node.js (>=14.x) & npm or Yarn
- React Native CLI (for running on real devices or emulators)
- Xcode (for iOS) or Android Studio (for Android)
- A free API key from CalorieNinjas
-
Clone the repo
git clone https://github.com/passimon/smartdiet.git cd smartdiet -
Install dependencies
npm install # or yarn install
-
Create a file named
secrets.jsat the project root (this is gitignored). -
Export your CalorieNinjas API key:
// secrets.js export const API_KEY = 'YOUR_CALORIENINJAS_API_KEY';
-
(Optional) You can also use a
.envfile andreact-native-dotenv.
- iOS Simulator
npx react-native run-ios
- Android Emulator / Device
npx react-native run-android
Ensure your emulator or device is running and connected.
/smartdiet-app
├─ /android
├─ /ios
├─ /assets
│ └─ placeholder-header1.png
├─ App.jsx
├─ HomeScreen.jsx
├─ SportScreen.jsx
├─ RecipeScreen.jsx
├─ LearnScreen.jsx
├─ FeedbackScreen.jsx
├─ UserSettings.jsx
├─ WeeklyOverview.jsx
├─ ProgressCircle.jsx
├─ secrets.js # (gitignored)
└─ package.json
- App.jsx – Root component, sets up navigation.
- HomeScreen.jsx – Core logging UI with data fetching, storage, and progress circles.
- WeeklyOverview.jsx – Date picker carousel for navigating past entries.
- ProgressCircle.jsx – Circular progress component using SVG or Canvas.
- UserSettings.jsx – Entry form to save gender and goal (e.g., lose, gain, maintain).
- Other Screens – Stubs/placeholders for Sports, Recipes, Learn, and Feedback.
Calculates target macros based on gender and goal multipliers.
Calls the CalorieNinjas API to retrieve macros for a given food query. Uses X-Api-Key header.
- Records saved under
nutritionRecordskey as an array of{ date, queries, nutrition }. - User settings under
userSettingskey.
Reloads settings and the selected date’s record whenever the Home screen regains focus.
- Bottom Tabs:
@react-navigation/bottom-tabs - Stack Navigator:
@react-navigation/native-stack - Icons:
react-native-vector-icons/MaterialCommunityIcons
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature/your-feature) - Open a pull request
This project is licensed under the MIT License.
