- π Overview
- π¦ Features
- π Structure
- π» Installation
- ποΈ Usage
- π Hosting
- π License
- π Authors
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.
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. |
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
- Node.js v14+
- npm 6+
- MongoDB 5.0+
- Clone the repository:
git clone https://github.com/coslynx/Fitness-Tracker-Social-Web-App.git cd Fitness-Tracker-Social-Web-App
- Install dependencies:
npm install
- Start the MongoDB database:
mongod
- Configure environment variables:
Update the
cp .env.example .env
.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
)
- Start the development server:
npm run start
- Access the application in your browser:
- Web interface: http://localhost:3000
- Install the Heroku CLI:
npm install -g heroku
- Login to Heroku:
heroku login
- Create a new Heroku app:
heroku create fitness-tracker-mvp-production
- 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
- Deploy the code:
git push heroku main
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
)
- 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 }] }] }
The Fitness Tracker MVP uses JWT (JSON Web Token) authentication for securing API endpoints.
- Register or Login to receive a JWT token.
- Include the token in the
Authorization
header for all protected API requests:Authorization: Bearer YOUR_JWT_TOKEN
# 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"
This Minimum Viable Product (MVP) is licensed under the GNU AGPLv3 license.
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
For any questions or concerns regarding this AI-generated MVP, please contact CosLynx at:
- Website: CosLynx.com
- Twitter: @CosLynxAI
Create Your Custom MVP in Minutes With CosLynxAI!