Skip to content

Set fitness goals, track progress, share achievements, and connect with others online... Created at https://coslynx.com

Notifications You must be signed in to change notification settings

coslynx/Fitness-Tracker-React-Node-MVP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Fitness Tracker Web App - MVP

A comprehensive fitness tracker web application built with React, Node.js, and MongoDB for goal setting, progress tracking, and a supportive community.

Developed with the software and tools below.

Framework - React - blue Frontend - Javascript, Html, Css - red Backend - Node.js - blue Database - MongoDB - green
git-last-commit GitHub commit activity GitHub top language

πŸ“‘ Table of Contents

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

πŸ“ Overview

This repository houses the Fitness Tracker web application - a powerful and user-friendly platform built with React, Node.js, and MongoDB. Designed to empower fitness enthusiasts of all levels, the Fitness Tracker provides a robust environment for setting personalized goals, tracking progress, and connecting with a supportive community.

πŸ“¦ Features

Feature Description
πŸ” Secure Authentication Users can create accounts and securely log in using email/password or social media integration (Google, Facebook), safeguarding personal data and enhancing user experience.
🎯 Personalized Goal Setting Set individual fitness goals, including weight, exercise frequency, distance, or specific milestones, providing a clear roadmap for progress.
πŸ“ˆ Comprehensive Progress Tracking Log workouts, meals, and activities. The app calculates and displays progress toward goals in visually appealing charts and graphs for motivation and accountability.
🀝 Social Sharing and Community Building Connect with friends, share progress, and achievements, fostering a sense of community, encouraging healthy competition, and providing support.
🌐 Responsive Design The application is fully responsive, adapting seamlessly to various devices (mobile, tablet, desktop) for a user-friendly experience across all screens.
⚑️ Performance Optimized for speed and responsiveness for a seamless user experience.
πŸ”„ Scalability Designed to handle a growing user base and increasing data volume.
πŸ”’ Security Robust security measures including data encryption and secure authentication to ensure user trust and confidence.

πŸ“‚ Structure

fitness-tracker/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ web/
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”‚   β”œβ”€β”€ styles/
β”‚   β”‚   β”‚   └── utils/
β”‚   β”‚   β”œβ”€β”€ next.config.js
β”‚   β”‚   β”œβ”€β”€ package.json
β”‚   β”‚   └── tsconfig.json
β”‚   └── admin/
β”‚       └── src/
β”‚           └── pages/
β”‚               β”œβ”€β”€ login/
β”‚               └── dashboard/
β”œβ”€β”€ packages/
β”‚   └── ui/
β”‚       └── src/
β”‚           └── components/
β”‚               └── Button/
└── .eslintrc.js

πŸ’» Installation

πŸ”§ Prerequisites

  • Node.js v16+
  • npm 6+
  • MongoDB 5+
  • Git 2.x+

πŸš€ Setup Instructions

  1. Clone the repository:
    git clone https://github.com/coslynx/Fitness-Tracker-React-Node-MVP.git
    cd Fitness-Tracker-React-Node-MVP
  2. Install dependencies:
    npm install
  3. Set up MongoDB:
    • Install MongoDB if you haven't already.
    • Start the MongoDB server.
    • Create a database named "fitness_tracker".
  4. Configure environment variables:
    • Create a .env file in the root directory:
      cp .env.example .env
    • Update the following variables in the .env file:
      # MongoDB Connection Details
      MONGODB_URI=mongodb://localhost:27017/fitness_tracker 
      
      # JWT Secret Key
      JWT_SECRET=averylongandrandomsecretkeythatisverydifficulttoguess 
      
      # Next.js API URL
      NEXT_PUBLIC_API_URL=http://localhost:3000/api
      

πŸ—οΈ Usage

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

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

βš™οΈ Configuration

  • The .env file is used to configure environment-specific settings.
  • See the comments in .env for details on each variable and how to modify them.

πŸ“š Examples

  • πŸ“ User Registration:

    curl -X POST http://localhost:3000/api/auth/register               -H "Content-Type: application/json"               -d '{"username": "newuser", "email": "user@example.com", "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 '{"type": "weight_loss", "target": 10, "deadline": "2023-12-31"}'
  • πŸ“ 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

Deploying to Vercel

  1. Create a Vercel account (if you don't have one): https://vercel.com/
  2. Install the Vercel CLI:
    npm install -g vercel
  3. Login to Vercel:
    vercel login
  4. Initialize Vercel project:
    vercel init
  5. Choose a project name (e.g., "fitness-tracker-mvp").
  6. Deploy the application:
    vercel deploy
  7. Configure environment variables in the Vercel dashboard (https://vercel.com/dashboard).
  8. The deployment will be accessible at a unique URL provided by Vercel.

πŸ”‘ Environment Variables

  • MONGODB_URI: Connection string for your MongoDB database (found in your MongoDB cluster settings).
  • JWT_SECRET: A long, randomly generated secret key for JWT token generation.
  • NEXT_PUBLIC_API_URL: URL of your deployed API server.

πŸ“œ 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 an existing user.
    • Body: { "email": string, "password": string }
    • Response: { "token": string, "user": { "id": string, "username": string, "email": string } }
  • GET /api/users/me

    • Description: Get authenticated user data.
    • Headers: Authorization: Bearer YOUR_JWT_TOKEN
    • Response: { "id": string, "username": string, "email": string }
  • POST /api/goals

    • Description: Create a new fitness goal.
    • Headers: Authorization: Bearer YOUR_JWT_TOKEN
    • Body: { "type": string, "target": number, "deadline": date }
    • Response: { "id": string, "type": string, "target": number, "deadline": date, "progress": number }
  • GET /api/goals

    • Description: Get all goals for the authenticated user.
    • Headers: Authorization: Bearer YOUR_JWT_TOKEN
    • Response: [ { "id": string, "type": string, "target": number, "deadline": date, "progress": number } ]
  • PUT /api/goals/:goalId

    • Description: Update an existing fitness goal.
    • Headers: Authorization: Bearer YOUR_JWT_TOKEN
    • Body: { "type": string, "target": number, "deadline": date }
    • Response: { "id": string, "type": string, "target": number, "deadline": date, "progress": number }
  • DELETE /api/goals/:goalId

    • Description: Delete a fitness goal.
    • Headers: Authorization: Bearer YOUR_JWT_TOKEN
    • Response: { "message": "Goal deleted successfully" }
  • POST /api/activities

    • Description: Log a new activity.
    • Headers: Authorization: Bearer YOUR_JWT_TOKEN
    • Body: { "type": string, "date": date, "duration": number, "caloriesBurned": number, "distance": number }
    • Response: { "id": string, "type": string, "date": date, "duration": number, "caloriesBurned": number, "distance": 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
    
  3. Token expiration and refresh process: The JWT token has a limited lifetime. When it expires, the client should request a new token using a refresh token.

πŸ“ Examples

# Register a new user
curl -X POST http://localhost:3000/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..."
}

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

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

# Get authenticated user data
curl -X GET http://localhost:3000/api/users/me \
     -H "Authorization: Bearer YOUR_JWT_TOKEN"

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

# Create a new goal
curl -X POST http://localhost:3000/api/goals \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_JWT_TOKEN" \
     -d '{"type": "weight_loss", "target": 10, "deadline": "2023-12-31"}'

# Response
{
  "id": "goal123",
  "type": "weight_loss",
  "target": 10,
  "deadline": "2023-12-31",
  "progress": 0
}

πŸ“œ 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-React-Node-MVP

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