Skip to content

coslynx/fitlog-goal-track-share

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

fitness-tracker-mvp

Track fitness goals, share progress, and achieve a healthier lifestyle.

Developed with the software and tools below.

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

πŸ“‘ Table of Contents

  • πŸ“ Overview
  • πŸ“¦ Features
  • πŸ“‚ Structure
  • πŸ’» Installation
  • πŸ—οΈ Usage
  • 🌐 Hosting
  • πŸ“„ API Documentation
  • πŸ”‘ License
  • πŸ‘ Authors

πŸ“ Overview

This repository contains a Minimum Viable Product (MVP) for a fitness tracker web application, enabling users to set goals, track progress, and share their achievements. Built with React, Node.js, Express, and MongoDB, it provides user authentication, goal setting, and progress tracking features.

πŸ“¦ Features

Feature Description
πŸ”‘ User Authentication Secure user registration and login using bcryptjs and JSON Web Tokens (JWT).
🎯 Goal Setting Users can set fitness goals with target values and units.
πŸ“ˆ Progress Tracking Track progress towards goals by logging daily or weekly activities.
🀝 Social Sharing Users can share their achievements with friends via a social feed (future implementation).
πŸ“± Responsive Design The application is designed to be responsive and accessible across various devices.
πŸ›‘οΈ Secure API The backend API is secured with JWT authentication to protect user data.

πŸ“‚ Structure

β”œβ”€β”€ .env                     # Environment variables
β”œβ”€β”€ .gitignore                # Specifies intentionally untracked files that Git should ignore
β”œβ”€β”€ package.json              # Lists project dependencies and scripts
β”œβ”€β”€ README.md                 # Project documentation
β”œβ”€β”€ startup.sh                # Script to start the application
β”œβ”€β”€ commands.json             # JSON file with commands
β”œβ”€β”€ client                    # React frontend
β”‚   β”œβ”€β”€ public                # Public assets
β”‚   β”‚   └── index.html        # HTML entry point
β”‚   β”œβ”€β”€ src                   # React source code
β”‚   β”‚   β”œβ”€β”€ App.js            # Main application component
β”‚   β”‚   β”œβ”€β”€ index.js          # React DOM rendering
β”‚   β”‚   β”œβ”€β”€ components        # Reusable components
β”‚   β”‚   β”‚   β”œβ”€β”€ common        # Common components
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Button.jsx  # Reusable button component
β”‚   β”‚   β”‚   β”‚   └── Input.jsx   # Reusable input component
β”‚   β”‚   β”‚   β”œβ”€β”€ layout        # Layout components
β”‚   β”‚   β”‚   β”‚   └── Header.jsx  # Header component
β”‚   β”‚   β”‚   β”œβ”€β”€ auth          # Authentication components
β”‚   β”‚   β”‚   β”‚   └── AuthForm.jsx  # Authentication form
β”‚   β”‚   β”‚   └── goals         # Goal tracking components
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ GoalList.jsx  # Goal list component
β”‚   β”‚   β”‚   β”‚   └── GoalForm.jsx  # Goal form component
β”‚   β”‚   β”œβ”€β”€ pages             # Application pages
β”‚   β”‚   β”‚   β”œβ”€β”€ Home.jsx        # Home page component
β”‚   β”‚   β”‚   └── Dashboard.jsx   # Dashboard component
β”‚   β”‚   β”œβ”€β”€ context           # Context API
β”‚   β”‚   β”‚   └── AuthContext.js  # Authentication context
β”‚   β”‚   β”œβ”€β”€ services          # API services
β”‚   β”‚   β”‚   └── api.js        # API service
β”‚   β”‚   β”œβ”€β”€ utils             # Utility functions
β”‚   β”‚   β”‚   └── helpers.js    # Helper functions
β”‚   β”‚   └── styles            # Global styles
β”‚   β”‚       └── global.css    # Global CSS
β”œβ”€β”€ server                    # Node.js backend
β”‚   β”œβ”€β”€ models                # Mongoose models
β”‚   β”œβ”€β”€ routes                # API routes
β”‚   β”œβ”€β”€ controllers           # Route handlers
β”‚   └── server.js             # Main server file

πŸ’» Installation

Warning

πŸ”§ Prerequisites

  • Node.js v18.0.0 or higher
  • npm v6 or higher
  • MongoDB installed and running

πŸš€ Setup Instructions

  1. Clone the repository:
    git clone https://github.com/coslynx/fitness-tracker-mvp.git
    cd fitness-tracker-mvp
  2. Install server dependencies:
    cd server
    npm install
    cd ..
  3. Install client dependencies:
    cd client
    npm install
    cd ..
  4. Configure environment variables:
    cp .env.example .env
    # Edit .env to configure database connection and other settings

πŸ—οΈ Usage

πŸƒβ€β™‚οΈ Running the MVP

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

Tip

βš™οΈ Configuration

  • REACT_APP_API_BASE_URL: Base URL of the backend API (default: http://localhost:3001)
  • REACT_APP_AUTH_TOKEN_KEY: Key used to store the authentication token in localStorage (default: fitness_app_auth_token)

πŸ“š Examples

  • πŸ“ Registering a new user: Open the web application and navigate to the registration page.

  • πŸ“ Creating a fitness goal: Log in and use the goal creation form on the dashboard.

🌐 Hosting

πŸš€ Deployment Instructions

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 fitness-tracker-mvp-production
  4. Set up environment variables:
    heroku config:set NODE_ENV=production
    heroku config:set REACT_APP_API_BASE_URL=https://your-heroku-app.herokuapp.com
    heroku config:set MONGODB_URI=your_mongodb_connection_string
  5. Deploy the code:
    git push heroku main

πŸ”‘ Environment Variables

  • NODE_ENV: Set to production for production environment.
  • REACT_APP_API_BASE_URL: Base URL of the backend API.
  • MONGODB_URI: Connection string for the MongoDB database.
  • JWT_SECRET: Secret key for JWT token generation.

πŸ“„ 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: Login a user
    • Body: { "email": string, "password": string }
    • Response: { "id": string, "username": string, "email": string, "token": string }
  • GET /api/goals

    • Description: Get all goals for a user
    • Headers: Authorization: Bearer TOKEN
    • Response: [{ "id": string, "name": string, "description": string, "target": number, "unit": string, "current": number }]
  • POST /api/goals

    • Description: Create a new goal
    • Headers: Authorization: Bearer TOKEN
    • Body: { "name": string, "description": string, "target": number, "unit": string }
    • Response: { "id": string, "name": string, "description": string, "target": number, "unit": string, "current": number }

πŸ”’ Authentication

  1. Register a new user or login to receive a JWT token.
  2. Include the token in the Authorization header for all protected routes:
    Authorization: Bearer YOUR_JWT_TOKEN
    

πŸ“ Examples

# Register a new user
curl -X POST http://localhost:3001/api/auth/register \
     -H "Content-Type: application/json" \
     -d '{"username": "fitnessuser", "email": "user@example.com", "password": "securepass123"}'

# Response
{
  "id": "user123",
  "username": "fitnessuser",
  "email": "user@example.com",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

# Create a new goal
curl -X POST http://localhost:3001/api/goals \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_JWT_TOKEN" \
     -d '{"name": "Weight Loss", "description": "Lose 10kg", "target": 10, "unit": "kg"}'

# Response
{
  "id": "goal123",
  "name": "Weight Loss",
  "description": "Lose 10kg",
  "target": 10,
  "unit": "kg",
  "current": 0
}

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: fitlog-goal-track-share

πŸ“ž 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!