Skip to content

Track fitness goals, monitor progress, and stay motivated with a personalized dashboard... Created at https://coslynx.com

Notifications You must be signed in to change notification settings

coslynx/Fitness-Tracker-Social-Web-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

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

Repository files navigation

Fitness Tracker MVP

A web application for fitness enthusiasts to track progress, set goals, and connect with friends.

Developed with the software and tools below.

Framework: React Frontend: JavaScript, HTML, CSS Backend: Node.js Database: MongoDB
git-last-commit GitHub commit activity GitHub top language

πŸ“‘ Table of Contents

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

πŸ“ Overview

This repository contains a Minimum Viable Product (MVP) for a fitness tracking web application built with React, JavaScript, HTML, CSS, Node.js, and MongoDB. The Fitness Tracker MVP provides a user-friendly platform for fitness enthusiasts to set goals, track their progress, and connect with friends to stay motivated.

πŸ“¦ Features

Feature Description
πŸ” User Authentication Securely registers and authenticates users with email and password. Allows users to manage their profiles and track progress privately.
🎯 Goal Setting Enables users to set personalized fitness goals (e.g., weight loss, distance, calories burned) with specific targets and deadlines.
πŸ“ˆ Progress Tracking Tracks user activity data (e.g., workouts, steps, calories) and visually displays progress towards goals using charts and graphs.
πŸ‘₯ Social Sharing Facilitates sharing of fitness achievements and milestones with friends on the platform through a dedicated social feed.
πŸ’» Responsive Design Adapts the user interface seamlessly to different screen sizes (mobile, tablet, desktop) for optimal viewing on various devices.
🌐 API Endpoint A RESTful API is provided for communication between the frontend and backend, enabling data retrieval, updates, and other functionalities.
πŸ—ƒοΈ Data Storage All user data, goals, activity logs, and social connections are securely stored and managed within a MongoDB database.

πŸ“‚ Structure

fitness-tracker-mvp/
β”œβ”€β”€ .env
β”œβ”€β”€ startup.sh
β”œβ”€β”€ commands.json
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ components
β”‚   β”‚   β”œβ”€β”€ Button.jsx
β”‚   β”‚   β”œβ”€β”€ Modal.jsx
β”‚   β”‚   β”œβ”€β”€ Input.jsx
β”‚   β”‚   └── GoalForm.jsx
β”‚   β”œβ”€β”€ pages
β”‚   β”‚   β”œβ”€β”€ Home.jsx
β”‚   β”‚   β”œβ”€β”€ Dashboard.jsx
β”‚   β”‚   └── Goals.jsx
β”‚   β”œβ”€β”€ hooks
β”‚   β”‚   └── useAuth.js
β”‚   β”œβ”€β”€ context
β”‚   β”‚   └── AuthContext.js
β”‚   β”œβ”€β”€ services
β”‚   β”‚   β”œβ”€β”€ api.js
β”‚   β”‚   └── auth.js
β”‚   β”œβ”€β”€ utils
β”‚   β”‚   β”œβ”€β”€ helpers.js
β”‚   β”‚   └── validators.js
β”‚   └── styles
β”‚       └── global.css
β”œβ”€β”€ public
β”‚   β”œβ”€β”€ index.html
β”‚   └── favicon.ico
β”œβ”€β”€ package.json
└── webpack.config.js

πŸ’» Installation

πŸ”§ Prerequisites

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

πŸš€ Setup Instructions

  1. Clone the repository:
    git clone https://github.com/coslynx/Fitness-Tracker-Social-Web-App.git
    cd Fitness-Tracker-Social-Web-App
  2. Install dependencies:
    npm install
  3. Start the MongoDB database:
    mongod
  4. Configure environment variables:
    cp .env.example .env
    Update the .env file with the following:
    • REACT_APP_API_URL: The URL of your backend server (default: http://localhost:3000)
    • REACT_APP_MONGO_URI: The connection string for your MongoDB database (default: mongodb://localhost:27017/fitness-tracker)

πŸ—οΈ Usage

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

  1. Start the development server:
    npm run start
  2. Access the application in your browser:

🌐 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_URL=https://your-app-name.herokuapp.com
    heroku config:set REACT_APP_MONGO_URI=mongodb+srv://your-mongodb-username:your-mongodb-password@your-mongodb-cluster.mongodb.net/your-database-name?retryWrites=true&w=majority 
  5. Deploy the code:
    git push heroku main

πŸ”‘ Environment Variables

  • REACT_APP_API_URL: The URL of your backend server (e.g., https://your-app-name.herokuapp.com)
  • REACT_APP_MONGO_URI: The connection string for your MongoDB database (e.g., mongodb+srv://your-mongodb-username:your-mongodb-password@your-mongodb-cluster.mongodb.net/your-database-name?retryWrites=true&w=majority)

πŸ“œ API Documentation

πŸ” Endpoints

  • POST /api/auth/register
    • Description: Registers a new user.
    • Body: { "email": string, "password": string, "name": string }
    • Response: { "message": string, "token": string }
  • POST /api/auth/login
    • Description: Authenticates a user and returns a JWT token.
    • Body: { "email": string, "password": string }
    • Response: { "message": string, "token": string }
  • GET /api/users/:userId
    • Description: Retrieves user data (profile information, goals, recent activity).
    • Headers: Authorization: Bearer TOKEN
    • Response: { "name": string, "email": string, "goals": [{ "goalType": string, "targetValue": number, "deadline": date, "progressData": [{ "date": date, "value": number }] }], "recentActivity": [{ "type": string, "date": date }] }
  • POST /api/goals
    • Description: Creates a new fitness goal.
    • Headers: Authorization: Bearer TOKEN
    • Body: { "goalType": string, "targetValue": number, "deadline": date, "description": string }
    • Response: { "message": string, "goalId": string }
  • GET /api/users/:userId/goals
    • Description: Retrieves the user's goals.
    • Headers: Authorization: Bearer TOKEN
    • Response: { "goals": [{ "goalType": string, "targetValue": number, "deadline": date, "progressData": [{ "date": date, "value": number }] }] }

πŸ”’ Authentication

The Fitness Tracker MVP uses JWT (JSON Web Token) authentication for securing API endpoints.

  1. Register or Login to receive a JWT token.
  2. Include the token in the Authorization header for all protected API requests:
    Authorization: Bearer YOUR_JWT_TOKEN
    

πŸ“ Examples

# Register a new user
curl -X POST http://localhost:3000/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email": "john.doe@example.com", "password": "securePassword123", "name": "John Doe"}'

# Login a user
curl -X POST http://localhost:3000/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "john.doe@example.com", "password": "securePassword123"}'

# Set a new goal (requires a valid JWT token)
curl -X POST http://localhost:3000/api/goals \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{"goalType": "weightLoss", "targetValue": 10, "deadline": "2024-03-15", "description": "Lose 10 pounds by March 15th"}'

# Get user data (requires a valid JWT token)
curl -X GET http://localhost:3000/api/users/userId \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" 

# Get user's goals (requires a valid JWT token)
curl -X GET http://localhost:3000/api/users/userId/goals \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" 

πŸ“œ 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: Fitness-Tracker-Social-Web-App

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