Skip to content

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

Notifications You must be signed in to change notification settings

coslynx/Fitness-Tracker-MVP-Web-Platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

28 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Fitness Tracker MVP

A fully functional web application for managing fitness goals and tracking progress.

Developed with the software and tools below.

Framework used for the Fitness Tracker MVP Frontend technologies used for the Fitness Tracker MVP Database used for the Fitness Tracker MVP Authentication system used for the Fitness Tracker MVP
git-last-commit GitHub commit activity GitHub top language

πŸ“‘ Table of Contents

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

πŸ“ Overview

The repository contains a Minimum Viable Product (MVP) called "Fitness Tracker MVP" that provides a comprehensive solution for fitness enthusiasts. Built using a modern tech stack consisting of Next.js, TypeScript, React, PostgreSQL, NextAuth.js, and Tailwind CSS, this MVP allows users to set and track fitness goals, log workouts, and view their progress.

πŸ“¦ Features

Feature Description
πŸ” Secure Authentication The MVP uses NextAuth.js to securely manage user authentication, supporting login with Google and other providers.
🎯 Goal Setting and Tracking Users can define personalized fitness goals (e.g., weight loss, muscle gain, distance running) and track progress visually through dashboards.
πŸ‹οΈ Workout Logging A user-friendly interface allows users to log their workouts, including details like type, duration, and intensity.
πŸ“Š Progress Visualization The MVP utilizes charts and graphs to provide clear and engaging visualizations of progress towards goals.
πŸ‘₯ Community Features (Future) (Planned) The MVP will incorporate social features like a community feed for sharing achievements and motivating others.

πŸ“‚ Structure

Fitness-Tracker-MVP
β”œβ”€β”€ .env
β”œβ”€β”€ .env.local
β”œβ”€β”€ commands.json
β”œβ”€β”€ startup.sh
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ app
β”‚   β”‚   β”œβ”€β”€ api
β”‚   β”‚   β”‚   β”œβ”€β”€ auth
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ [...nextauth].ts
β”‚   β”‚   β”‚   β”œβ”€β”€ goals
β”‚   β”‚   β”‚   β”‚   └── route.ts
β”‚   β”‚   β”œβ”€β”€ layout.tsx
β”‚   β”‚   β”œβ”€β”€ page.tsx
β”‚   β”‚   β”œβ”€β”€ dashboard
β”‚   β”‚   β”‚   └── page.tsx
β”‚   β”‚   β”œβ”€β”€ goals
β”‚   β”‚   β”‚   └── page.tsx
β”‚   β”œβ”€β”€ components
β”‚   β”‚   β”œβ”€β”€ Button.tsx
β”‚   β”‚   β”œβ”€β”€ Modal.tsx
β”‚   β”‚   β”œβ”€β”€ Input.tsx
β”‚   β”‚   β”œβ”€β”€ GoalForm.tsx
β”‚   β”‚   β”œβ”€β”€ GoalList.tsx
β”‚   β”‚   β”œβ”€β”€ LoginForm.tsx
β”‚   β”‚   β”œβ”€β”€ SignupForm.tsx
β”‚   β”‚   └── DashboardStats.tsx
β”‚   β”œβ”€β”€ pages
β”‚   β”‚   β”œβ”€β”€ Home.tsx
β”‚   β”‚   β”œβ”€β”€ Dashboard.tsx
β”‚   β”‚   └── Goals.tsx
β”‚   β”œβ”€β”€ hooks
β”‚   β”‚   └── useAuth.ts
β”‚   β”œβ”€β”€ services
β”‚   β”‚   β”œβ”€β”€ api.ts
β”‚   β”‚   └── auth.ts
β”‚   β”œβ”€β”€ utils
β”‚   β”‚   β”œβ”€β”€ helpers.ts
β”‚   β”‚   └── validators.ts
β”‚   └── styles
β”‚       └── global.css
└── package.json

πŸ’» Installation

πŸ”§ Prerequisites

  • Node.js v18+
  • npm 8+
  • PostgreSQL 14+

πŸš€ Setup Instructions

  1. Clone the repository:
    git clone https://github.com/coslynx/Fitness-Tracker-MVP.git
    cd Fitness-Tracker-MVP
  2. Install dependencies:
    npm install
  3. Create a .env file:
    cp .env.example .env
  4. Configure environment variables in the .env file. The following variables are required:
    • NEXT_PUBLIC_SUPABASE_URL: Your Supabase URL (e.g., https://your-project.supabase.co)
    • NEXT_PUBLIC_SUPABASE_KEY: Your Supabase Anon Key
    • NEXT_PUBLIC_GOOGLE_CLIENT_ID: Your Google Client ID
    • NEXT_PUBLIC_GOOGLE_CLIENT_SECRET: Your Google Client Secret
    • NEXT_PUBLIC_SENTRY_DSN: Your Sentry DSN (optional for error tracking)
  5. Set up your Supabase database:
    • Create a database using the instructions on the Supabase documentation.
    • Ensure the database has the following tables:
      • users (for user authentication)
      • goals (for storing user goals)
      • workouts (for logging workout data)
    • Add any additional tables as needed for your MVP.
  6. Run database migrations:
    npm run migrate
  7. (Optional) Configure Sentry for error tracking:
    • Create a Sentry project.
    • Set the NEXT_PUBLIC_SENTRY_DSN environment variable in your .env file.

πŸ—οΈ Usage

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

  1. Start the development server:
    npm run dev
  2. Access the application in your browser at http://localhost:3000.

🌐 Hosting

πŸš€ Deployment Instructions

  1. Ensure you have a Supabase project set up.
  2. Set up environment variables:
    • NEXT_PUBLIC_SUPABASE_URL: Your Supabase URL.
    • NEXT_PUBLIC_SUPABASE_KEY: Your Supabase Anon Key.
    • NEXT_PUBLIC_GOOGLE_CLIENT_ID: Your Google Client ID.
    • NEXT_PUBLIC_GOOGLE_CLIENT_SECRET: Your Google Client Secret.
    • NEXT_PUBLIC_SENTRY_DSN: Your Sentry DSN (optional).
  3. Build the application:
    npm run build
  4. Deploy to your preferred platform, such as Vercel or Netlify. You can use the next command to deploy to Vercel:
    vercel
  5. Configure the deployment platform to connect to your Supabase database.
  6. (Optional) Configure Sentry for error tracking on your production environment.

πŸ“œ API Documentation

πŸ” Endpoints

  • POST /api/auth/register
    • Description: Register a new user.
    • Body: { "name": string, "email": string, "password": string }
    • Response:
      • On success: { "id": string, "name": string, "email": string, "token": string }
      • On error: Error message.
  • POST /api/auth/login
    • Description: Login an existing user.
    • Body: { "email": string, "password": string }
    • Response:
      • On success: { "id": string, "name": string, "email": string, "token": string }
      • On error: Error message.
  • GET /api/goals
    • Description: Get all goals for the current user.
    • Headers: Authorization: Bearer YOUR_JWT_TOKEN
    • Response: An array of Goal objects.
  • POST /api/goals
    • Description: Create a new goal.
    • Headers: Authorization: Bearer YOUR_JWT_TOKEN
    • Body: { "name": string, "description": string, "target": number }
    • Response:
      • On success: The newly created Goal object.
      • On error: Error message.
  • PUT /api/goals/:id
    • Description: Update a goal.
    • Headers: Authorization: Bearer YOUR_JWT_TOKEN
    • Body: { "name": string, "description": string, "target": number }
    • Response:
      • On success: The updated Goal object.
      • On error: Error message.
  • DELETE /api/goals/:id
    • Description: Delete a goal.
    • Headers: Authorization: Bearer YOUR_JWT_TOKEN
    • Response:
      • On success: 204 No Content.
      • On error: Error message.
  • POST /api/workouts
    • Description: Log a new workout.
    • Headers: Authorization: Bearer YOUR_JWT_TOKEN
    • Body: { "type": string, "duration": number, "intensity": string, "notes": string }
    • Response:
      • On success: The newly created Workout object.
      • On error: Error message.
  • GET /api/workouts
    • Description: Get all workouts for the current user.
    • Headers: Authorization: Bearer YOUR_JWT_TOKEN
    • Response: An array of Workout objects.
  • GET /api/users/me
    • Description: Get information about the current user.
    • Headers: Authorization: Bearer YOUR_JWT_TOKEN
    • Response: The current user object.

πŸ”’ Authentication

  1. Users must register or login to receive a JWT token.
  2. Include the JWT token in the Authorization header of all API requests.

Example:

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

Response:

{
  "id": "user123",
  "name": "John Doe",
  "email": "user@example.com",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw0"
}

πŸ“ Examples

Create a new goal:

curl -X POST http://localhost:3000/api/goals \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{"name": "Lose 5kg", "description": "Lose 5kg in 12 weeks", "target": 5}'

Response:

{
  "id": "goal123",
  "name": "Lose 5kg",
  "description": "Lose 5kg in 12 weeks",
  "target": 5
}

Log a new workout:

curl -X POST http://localhost:3000/api/workouts \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{"type": "Running", "duration": 45, "intensity": "Moderate", "notes": "Ran around the park"}'

Response:

{
  "id": "workout123",
  "type": "Running",
  "duration": 45,
  "intensity": "Moderate",
  "notes": "Ran around the park"
}

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