- 📍 Overview
- 📦 Features
- 📂 Structure
- 💻 Installation
- 🏗️ Usage
- 🌐 Hosting
- 📄 API Documentation
- 🔑 License
- 👏 Authors
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.
| 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. |
├── .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
- Clone the repository:
git clone https://github.com/coslynx/fitness-tracker-mvp.git cd fitness-tracker-mvp - Install server dependencies:
cd server npm install cd ..
- Install client dependencies:
cd client npm install cd ..
- Configure environment variables:
cp .env.example .env # Edit .env to configure database connection and other settings
- Start the development server:
npm run dev
- Access the application:
- Web interface: http://localhost:3000
Tip
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)
-
📝 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.
- 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_BASE_URL=https://your-heroku-app.herokuapp.com heroku config:set MONGODB_URI=your_mongodb_connection_string
- Deploy the code:
git push heroku main
NODE_ENV: Set toproductionfor 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.
-
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 }
- Register a new user or login to receive a JWT token.
- Include the token in the
Authorizationheader for all protected routes:Authorization: Bearer YOUR_JWT_TOKEN
# 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
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: fitlog-goal-track-share
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!