An open API service indexing awesome lists of open source software.

https://github.com/coslynx/fittrack-health-monitor

Track fitness goals monitor calories get food suggestions... Created at https://coslynx.com
https://github.com/coslynx/fittrack-health-monitor

api backend calorie-counter code-generation coslynx database developer-tools devops diet fitness-tracker food-suggestions frontend goal-setting health javascript machine-learning mvp nutrition web-app

Last synced: 3 months ago
JSON representation

Track fitness goals monitor calories get food suggestions... Created at https://coslynx.com

Awesome Lists containing this project

README

          




health-fit-goal-tracker


A simple web tool for tracking daily calorie intake, setting goals, and viewing food suggestions, using local browser storage.


Developed with the software and tools below.



React
JavaScript
Tailwind CSS
Vite
State Management
Testing


git-last-commit
GitHub commit activity
GitHub top language

## ๐Ÿ“‘ Table of Contents
- ๐Ÿ“ Overview
- ๐Ÿ“ฆ Features
- ๐Ÿ“‚ Structure
- ๐Ÿ’ป Installation
- ๐Ÿ—๏ธ Usage
- ๐ŸŒ Hosting
- ๐Ÿ“„ License
- ๐Ÿ‘ Authors

## ๐Ÿ“ Overview
The `health-fit-goal-tracker` is a lightweight, client-side Minimum Viable Product (MVP) designed for straightforward fitness tracking. It allows users to set a daily calorie goal, log food items with their calorie counts, monitor their progress throughout the day, and view simple food suggestions. All data (goals and daily logs) is stored locally in the user's browser using `localStorage`, making it a self-contained application without requiring backend infrastructure or user accounts for the MVP phase. Built with React, Vite, and Tailwind CSS for a modern, responsive user experience.

## ๐Ÿ“ฆ Features
| | Feature | Description |
|----|-----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|
| ๐ŸŽฏ | **Goal Management** | Users can set and view their daily calorie goal. The goal persists across browser sessions using `localStorage`. |
| ๐ŸŽ | **Calorie Logging** | Allows manual entry of food items and their calorie counts. Each entry is added to a daily log. |
| ๐Ÿ“Š | **Progress Calculation** | Automatically calculates total calories consumed from the log and displays progress towards the daily goal (consumed/remaining). |
| ๐Ÿฒ | **Food Suggestions** | Displays a static list of basic food suggestions loaded from a predefined data file. |
| ๐Ÿ’พ | **Client-Side Persistence** | Utilizes the browser's `localStorage` API via a custom hook (`useLocalStorage`) to store the user's goal and daily log data persistently. |
| โœจ | **UI/UX** | Clean, responsive user interface built with React components and styled using Tailwind CSS utility classes. |
| โš™๏ธ | **Architecture** | Simple, component-based frontend architecture powered by Vite. State managed globally using React Context API (`AppContext`). |
| ๐Ÿงช | **Testing** | Includes unit tests for core components (`GoalSetter`, `CalorieInput`) and context (`AppContext`) using Vitest and React Testing Library. |
| โšก๏ธ | **Performance** | Lightweight client-side application optimized for fast loading and interaction, leveraging Vite's efficient build process. |
| ๐Ÿ“ฆ | **Dependencies** | Core dependencies include React, `nanoid` for unique ID generation. Dev dependencies cover build tools, styling, linting, and testing. |

## ๐Ÿ“‚ Structure
```text
health-fit-goal-tracker/
โ”œโ”€โ”€ .env
โ”œโ”€โ”€ .eslintrc.cjs
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ .prettierrc.json
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ commands.json
โ”œโ”€โ”€ index.html
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ postcss.config.js
โ”œโ”€โ”€ public/
โ”‚ โ””โ”€โ”€ favicon.ico
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ App.jsx
โ”‚ โ”œโ”€โ”€ components/
โ”‚ โ”‚ โ”œโ”€โ”€ CalorieInput.jsx
โ”‚ โ”‚ โ”œโ”€โ”€ FoodSuggestions.jsx
โ”‚ โ”‚ โ”œโ”€โ”€ GoalSetter.jsx
โ”‚ โ”‚ โ”œโ”€โ”€ LogItem.jsx
โ”‚ โ”‚ โ”œโ”€โ”€ LogList.jsx
โ”‚ โ”‚ โ”œโ”€โ”€ ProgressDisplay.jsx
โ”‚ โ”‚ โ””โ”€โ”€ common/
โ”‚ โ”‚ โ”œโ”€โ”€ Button.jsx
โ”‚ โ”‚ โ””โ”€โ”€ Input.jsx
โ”‚ โ”œโ”€โ”€ context/
โ”‚ โ”‚ โ””โ”€โ”€ AppContext.jsx
โ”‚ โ”œโ”€โ”€ data/
โ”‚ โ”‚ โ””โ”€โ”€ suggestions.js
โ”‚ โ”œโ”€โ”€ hooks/
โ”‚ โ”‚ โ””โ”€โ”€ useLocalStorage.js
โ”‚ โ”œโ”€โ”€ index.css
โ”‚ โ”œโ”€โ”€ main.jsx
โ”‚ โ””โ”€โ”€ utils/
โ”‚ โ””โ”€โ”€ helpers.js
โ”œโ”€โ”€ startup.sh
โ”œโ”€โ”€ tailwind.config.js
โ”œโ”€โ”€ tests/
โ”‚ โ”œโ”€โ”€ components/
โ”‚ โ”‚ โ”œโ”€โ”€ CalorieInput.test.jsx
โ”‚ โ”‚ โ””โ”€โ”€ GoalSetter.test.jsx
โ”‚ โ””โ”€โ”€ context/
โ”‚ โ””โ”€โ”€ AppContext.test.jsx
โ””โ”€โ”€ vite.config.js
```

## ๐Ÿ’ป Installation
> [!WARNING]
> ### ๐Ÿ”ง Prerequisites
> - Node.js (v18.x or v20.x recommended)
> - npm (v9.x or later, usually included with Node.js)
> - A modern web browser supporting `localStorage`

### ๐Ÿš€ Setup Instructions
1. Clone the repository:
```bash
git clone https://github.com/coslynx/health-fit-goal-tracker.git
cd health-fit-goal-tracker
```
2. Install dependencies:
```bash
npm install
```
3. Configure environment variables (optional, defaults provided):
- This project uses a `.env` file primarily for the application title. You can create one based on the provided `.env` content or rely on defaults.
```bash
# Create a .env file if you want to customize variables
# Example .env content:
# VITE_APP_TITLE="My Custom Tracker Name"
```

## ๐Ÿ—๏ธ Usage
### ๐Ÿƒโ€โ™‚๏ธ Running the MVP
1. Start the development server:
```bash
npm run dev
```
> [!NOTE]
> This will typically start the server on `http://localhost:5173`. Check the terminal output for the exact URL.

2. Access the application in your web browser using the URL provided by Vite.

### ๐Ÿ› ๏ธ Available Scripts
- **`npm run dev`**: Starts the development server with Hot Module Replacement (HMR).
- **`npm run build`**: Creates a production-ready build in the `dist/` directory.
- **`npm run lint`**: Lints the codebase using ESLint based on the rules in `.eslintrc.cjs`.
- **`npm run preview`**: Starts a local server to preview the production build from `dist/`.
- **`npm run test`**: Runs the unit tests using Vitest.
- **`npm run format`**: Formats the code using Prettier based on rules in `.prettierrc.json`.

> [!TIP]
> ### โš™๏ธ Configuration
> - The main configuration point is the `.env` file for the application title (`VITE_APP_TITLE`).
> - `localStorage` keys used for persistence (`fitnessAppGoal`, `fitnessAppLog`) are defined within `src/context/AppContext.jsx`. Modifying these would require code changes.
> - Default goal (2000) and initial log (`[]`) are set within `AppContext.jsx`.

### ๐Ÿ“š Examples (User Workflow)
1. **Set Goal**: Use the "Set Your Daily Goal" section. Enter a positive number (e.g., 2200) and click "Set Goal". The "Current Goal" display will update.
2. **Log Food**: Use the "Log Food Item" section. Enter a food name (e.g., "Banana") and its calorie count (e.g., 105). Click "Add Log Entry".
3. **View Progress**: The "Progress Summary" section updates automatically, showing total consumed calories and remaining calories based on your goal and logged items.
4. **View Log**: The "Daily Log" section lists all items added during the session.
5. **View Suggestions**: The "Food Suggestions" section displays a static list of ideas.
6. **Persistence**: Close and reopen your browser tab. Your goal and logged items should still be present as they are saved in `localStorage`.

## ๐ŸŒ Hosting
> [!NOTE]
> This is a client-side application. It can be hosted on any static web hosting provider.

### ๐Ÿš€ Deployment Instructions
Platforms like Netlify, Vercel, or GitHub Pages are suitable. The general process is:

1. **Build the Application**:
```bash
npm run build
```
This command generates the optimized static assets in the `dist/` directory.

2. **Deploy the `dist` Directory**:
- **Netlify/Vercel**: Connect your Git repository and configure the build command (`npm run build`) and publish directory (`dist`). They will handle the build and deployment automatically.
- **GitHub Pages**: Configure GitHub Pages to serve from the `gh-pages` branch (after pushing the `dist` contents there) or directly from the `dist` folder if using GitHub Actions for deployment.
- **Other Static Hosts**: Upload the contents of the `dist` directory to your chosen hosting provider.

### ๐Ÿ”‘ Environment Variables
For deployment, only `VITE_APP_TITLE` is actively used by the code. Most hosting providers allow setting environment variables during the build process. If you need to customize the title for the deployed version:

- `VITE_APP_TITLE`: Sets the application title displayed in the header and potentially the browser tab title (configured in `index.html`).
Example: `VITE_APP_TITLE="My Deployed Health Tracker"`

## ๐Ÿ“œ API Documentation
> [!IMPORTANT]
> This Minimum Viable Product (MVP) is entirely **client-side**. It operates directly within the user's browser and uses `localStorage` for data persistence.
>
> **There is no backend API associated with this MVP.** All logic for goal setting, calorie logging, progress calculation, and data storage happens within the browser.

### ๐Ÿ”’ Authentication
No authentication is implemented as the application is client-side and stores data locally per browser.

## ๐Ÿ“„ License & Attribution

### ๐Ÿ“œ License
This Minimum Viable Product (MVP) is licensed under the [GNU AGPLv3](https://choosealicense.com/licenses/agpl-3.0/) license.

### ๐Ÿค– AI-Generated MVP
This MVP was entirely generated using artificial intelligence through [CosLynx.com](https://coslynx.com).

No human was directly involved in the coding process of the repository: health-fit-goal-tracker

### ๐Ÿ“ž Contact
For any questions or concerns regarding this AI-generated MVP, please contact CosLynx at:
- Website: [CosLynx.com](https://coslynx.com)
- Twitter: [@CosLynxAI](https://x.com/CosLynxAI)


๐ŸŒ CosLynx.com


Create Your Custom MVP in Minutes With CosLynxAI!