Skip to content

coslynx/Fit-Track-Goal-Hub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fit-Track-Goal-Monitor

Fit-Track-Goal-Monitor

Web application that allows users to track their fitness goals, monitor progress, and share achievements with friends.

Developed with the software and tools below.

React JavaScript, HTML, CSS Node.js Custom, Gemini, OpenAI
git-last-commit GitHub commit activity GitHub top language

📑 Table of Contents

  • 📍 Overview
  • 📦 Features
  • 📂 Structure
  • 💻 Installation
  • 🏗️ Usage
  • 🌐 Hosting
  • 📄 License
  • 👏 Authors

📍 Overview

The Fit-Track-Goal-Monitor is a web application that allows fitness enthusiasts to easily set, track, and monitor their fitness goals. Users can authenticate, create personalized goals, log their progress, and share their achievements with friends. The application is built using React for the frontend, Node.js for the backend, and integrates custom, Gemini, and OpenAI-based language models for enhanced user experiences.

📦 Features

Feature Description
⚙️ Architecture The codebase follows a modular architectural pattern with separate directories for components, pages, hooks, services, and utilities, ensuring easier maintenance and scalability.
📄 Documentation The repository includes a comprehensive README file that provides an overview of the application, installation instructions, usage examples, API documentation, and deployment guidelines.
🔗 Dependencies The codebase relies on various external libraries and packages such as React, Node.js, Axios, Mongoose, Chakra UI, and React Hook Form, which are essential for building the user interface, handling API requests, and managing state.
🧩 Modularity The modular structure allows for easier maintenance and reusability of the code, with separate components for authentication, goal management, progress tracking, and social sharing.
🧪 Testing The project includes unit tests for key components and services, ensuring the reliability and robustness of the codebase.
⚡️ Performance The application is designed with performance in mind, using techniques like code splitting, memoization, and optimized database queries to ensure a smooth user experience.
🔐 Security The application implements security measures such as input validation, password hashing, and JWT-based authentication to protect user data and prevent vulnerabilities.
🔀 Version Control The project utilizes Git for version control and includes GitHub Actions workflows for automated build and deployment processes.
🔌 Integrations The application interacts with the browser's APIs for features like user authentication and social sharing, and includes integrations with external services like Gemini and OpenAI for advanced language processing capabilities.
📶 Scalability The system is designed to handle increased user load and data volume, utilizing caching strategies and a scalable backend architecture to ensure the application can grow alongside its user base.

📂 Structure

└─ src
   └─ components
      └─ Button.jsx
      └─ Input.jsx
      └─ Modal.jsx
      └─ Header.jsx
      └─ Footer.jsx
      └─ LoginForm.jsx
      └─ SignupForm.jsx
      └─ GoalList.jsx
      └─ GoalForm.jsx
      └─ GoalCard.jsx
      └─ DashboardStats.jsx
   └─ pages
      └─ Home.jsx
      └─ Dashboard.jsx
      └─ Goals.jsx
      └─ Profile.jsx
   └─ hooks
      └─ useAuth.js
      └─ useGoals.js
   └─ context
      └─ AuthContext.js
      └─ GoalsContext.js
   └─ services
      └─ authService.js
      └─ goalsService.js
   └─ utils
      └─ formatters.js
      └─ validators.js
   └─ styles
      └─ global.css
      └─ theme.js

└─ api
   └─ index.js
   └─ routes
      └─ auth.js
      └─ goals.js
   └─ controllers
      └─ authController.js
      └─ goalsController.js
   └─ models
      └─ User.js
      └─ Goal.js
   └─ middleware
      └─ auth.js
      └─ error.js
   └─ config
      └─ db.js

└─ public
   └─ index.html
   └─ favicon.ico

└─ tests
   └─ components
      └─ GoalForm.test.jsx
   └─ services
      └─ goalsService.test.js

└─ .env
└─ startup.sh
└─ commands.json
└─ package.json
└─ README.md

💻 Installation

Warning

🔧 Prerequisites

  • Node.js v14+
  • npm 6+
  • MongoDB 4.4+

🚀 Setup Instructions

  1. Clone the repository:
    git clone https://github.com/coslynx/Fit-Track-Goal-Monitor.git
    cd Fit-Track-Goal-Monitor
  2. Install dependencies:
    npm install
  3. Set up the database:
    cp .env.example .env
    # Fill in the required environment variables, e.g., MONGODB_URI
  4. Start the development server:
    npm run dev

🏗️ Usage

🏃‍♂️ Running the Application

  1. Start the development server:
    npm run dev
  2. Access the application:

Tip

⚙️ Configuration

  • The application uses environment variables for configuration, such as the MongoDB connection string and JWT secret.
  • You can modify these variables in the .env file to match your local setup.

📚 Examples

User Registration

curl -X POST http://localhost:3000/api/auth/register \
     -H "Content-Type: application/json" \
     -d '{"username": "newuser", "email": "[email protected]", "password": "securepass123"}'

Setting a Fitness Goal

curl -X POST http://localhost:3000/api/goals \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_JWT_TOKEN" \
     -d '{"title": "Weight Loss", "description": "Lose 10 lbs by the end of the year", "targetDate": "2023-12-31", "progress": 0, "status": "active"}'

Logging Progress

curl -X POST http://localhost:3000/api/progress \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_JWT_TOKEN" \
     -d '{"goalId": "goal_id_here", "value": 2, "date": "2023-06-15"}'

🌐 Hosting

🚀 Deployment Instructions

Fit-Track-Goal-Monitor can be deployed to various cloud platforms. Here's an example of deploying to Heroku:

  1. Install the Heroku CLI:
    npm install -g heroku
  2. Login to Heroku:
    heroku login
  3. Create a new Heroku app:
    heroku create Fit-Track-Goal-Monitor-production
  4. Set up environment variables:
    heroku config:set NODE_ENV=production
    heroku config:set MONGODB_URI=your_mongodb_uri_here
    heroku config:set JWT_SECRET=your_jwt_secret_here
  5. Deploy the code:
    git push heroku main
  6. Run database migrations (if applicable):
    heroku run npm run migrate

🔑 Environment Variables

  • MONGODB_URI: Connection string for the MongoDB database Example: mongodb+srv://username:[email protected]/database
  • JWT_SECRET: Secret key for JWT token generation Example: your-256-bit-secret

📜 API Documentation

🔍 Endpoints

  • POST /api/auth/register

    • Description: Register a new user
    • Body: { "username": string, "email": string, "password": string }
    • Response: { "id": string, "username": string, "email": string, "token": string }
  • POST /api/auth/login

    • Description: Log in an existing user
    • Body: { "email": string, "password": string }
    • Response: { "token": string, "user": { "id": string, "email": string } }
  • POST /api/goals

    • Description: Create a new fitness goal
    • Headers: Authorization: Bearer TOKEN
    • Body: { "title": string, "description": string, "targetDate": date, "progress": number, "status": string }
    • Response: { "id": string, "title": string, "description": string, "targetDate": date, "progress": number, "status": string }
  • GET /api/goals

    • Description: Fetch all fitness goals for the authenticated user
    • Headers: Authorization: Bearer TOKEN
    • Response: [{ "id": string, "title": string, "description": string, "targetDate": date, "progress": number, "status": string }]
  • PUT /api/goals/{goalId}

    • Description: Update an existing fitness goal
    • Headers: Authorization: Bearer TOKEN
    • Body: { "title": string, "description": string, "targetDate": date, "progress": number, "status": string }
    • Response: { "id": string, "title": string, "description": string, "targetDate": date, "progress": number, "status": string }
  • DELETE /api/goals/{goalId}

    • Description: Delete a specific fitness goal
    • Headers: Authorization: Bearer TOKEN
    • Response: { "message": "Goal deleted successfully" }

🔒 Authentication

  1. Register a new user or log in to receive a JWT token.
  2. Include the token in the Authorization header for all protected routes:
    Authorization: Bearer YOUR_JWT_TOKEN
    
  3. The token will expire after 1 hour. You can request a new token by logging in again.

📝 Examples

# Register a new user
curl -X POST http://localhost:3000/api/auth/register \
     -H "Content-Type: application/json" \
     -d '{"username": "fitnessuser", "email": "[email protected]", "password": "securepass123"}'

# Response
{
  "id": "user123",
  "username": "fitnessuser",
  "email": "[email protected]",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

# Create a new goal
curl -X POST http://localhost:3000/api/goals \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_JWT_TOKEN" \
     -d '{"title": "Weight Loss", "description": "Lose 10 lbs by the end of the year", "targetDate": "2023-12-31", "progress": 0, "status": "active"}'

# Response
{
  "id": "goal123",
  "title": "Weight Loss",
  "description": "Lose 10 lbs by the end of the year",
  "targetDate": "2023-12-31",
  "progress": 0,
  "status": "active"
}

Note

📜 License & Attribution

📄 License

This Minimum Viable Product (MVP) is licensed under the GNU AGPLv3 license.

🤖 AI-Generated MVP

This MVP was entirely generated using artificial intelligence through CosLynx.com.

No human was directly involved in the coding process of the repository: Fit-Track-Goal-Monitor

📞 Contact

For any questions or concerns regarding this AI-generated MVP, please contact CosLynx at:

🌐 CosLynx.com

Create Your Custom MVP in Minutes With CosLynxAI!