- ๐ Overview
- ๐ฆ Features
- ๐ Structure
- ๐ป Installation
- ๐๏ธ Usage
- ๐ Hosting
- ๐ License
- ๐ Authors
The repository contains a Minimum Viable Product (MVP) called "fitness-tracker-app" which helps users track their fitness goals and share their progress securely online, enhancing motivation and accountability. The application is built using React for the frontend, Node.js with Express for the backend and optionally utilizes MongoDB for data storage. Core features include user authentication, goal setting, progress tracking, and social sharing.
Feature | Description | |
---|---|---|
๐ | User Authentication | Secure user registration and login using bcrypt for password hashing and JWT for session management. |
๐ฏ | Goal Setting | Allows users to set specific fitness goals and track their progress. Goals are stored in the database and retrieved for display. |
๐ | Progress Tracking | Enables users to log their fitness activities and track progress toward their goals. |
๐ฃ | Social Sharing | Users can share their achievements and progress with friends, fostering motivation and accountability. |
๐ฑ | Responsive Design | The application is designed to be responsive and accessible on various devices, providing a seamless user experience. |
๐ก๏ธ | Data Security | Implements measures to protect user data and privacy, including secure storage and communication protocols. |
โ๏ธ | API Endpoints | Provides API endpoints for user authentication, goal management, and progress tracking. |
๐งฉ | Modular Codebase | The codebase follows a modular structure, making it easier to maintain, extend, and test. |
๐งช | Input Validation | Comprehensive input validation and sanitization to prevent common security vulnerabilities like XSS. |
โก๏ธ | Performance | Optimized React components and efficient API queries to deliver a smooth user experience. |
โโ src
โโ components
โโ Button.jsx
โโ Input.jsx
โโ layout
โโ Header.jsx
โโ Footer.jsx
โโ features
โโ auth
โโ LoginForm.jsx
โโ SignupForm.jsx
โโ dashboard
โโ DashboardStats.jsx
โโ goals
โโ GoalList.jsx
โโ GoalForm.jsx
โโ pages
โโ Home.jsx
โโ Dashboard.jsx
โโ Goals.jsx
โโ hooks
โโ useAuth.js
โโ context
โโ AuthContext.js
โโ services
โโ api.js
โโ auth.js
โโ utils
โโ helpers.js
โโ styles
โโ global.css
โโ public
โโ index.html
โโ favicon.ico
โโ README.md
โโ .env
โโ startup.sh
โโ commands.json
โโ package.json
-
Clone the repository:
git clone https://github.com/coslynx/fitness-tracker-app.git cd fitness-tracker-app
-
Install dependencies:
npm install
-
Configure environment variables:
cp .env.example .env
- Fill in the
.env
file with your MongoDB connection string and JWT secret:MONGODB_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret_key PORT=5000
- Fill in the
- Start the development server:
npm run dev
- Access the application:
- Web interface:
http://localhost:3000
- Web interface:
Tip
- The
.env
file contains environment-specific configurations, such as the MongoDB connection string and JWT secret. - The
PORT
variable defines the port the server will listen on (defaults to 5000 if not set).
-
๐ Register a new user:
curl -X POST http://localhost:5000/api/auth/signup \ -H "Content-Type: application/json" \ -d '{"email": "user@example.com", "password": "SecurePassword123!"}'
-
๐ Login to the application:
curl -X POST http://localhost:5000/api/auth/login \ -H "Content-Type: application/json" \ -d '{"email": "user@example.com", "password": "SecurePassword123!"}'
-
๐ Add a new fitness goal:
curl -X POST http://localhost:5000/api/goals \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <JWT_TOKEN>" \ -d '{"description": "Run 5k three times a week"}'
- Install the Heroku CLI:
npm install -g heroku
- Login to Heroku:
heroku login
- Create a new Heroku app:
heroku create fitness-tracker-app-production
- Set up environment variables:
heroku config:set MONGODB_URI=your_mongodb_connection_string heroku config:set JWT_SECRET=your_jwt_secret_key heroku config:set PORT=5000
- Deploy the code:
git push heroku main
MONGODB_URI
: Connection string for the MongoDB database Example:mongodb+srv://<username>:<password>@<cluster>.mongodb.net/<database>?retryWrites=true&w=majority
JWT_SECRET
: Secret key for JWT token generation Example:YourSuperSecretJWTKey
PORT
: Port for the Express server to listen on Example:5000
-
POST /api/auth/login
- Description: Logs in a user and returns a JWT token.
- Body:
{ "email": string, "password": string }
- Response:
{ "token": string, "user": { "_id": string, "email": string } }
-
POST /api/auth/signup
- Description: Registers a new user and returns a JWT token.
- Body:
{ "email": string, "password": string }
- Response:
{ "token": string, "user": { "_id": string, "email": string } }
-
GET /api/goals
- Description: Retrieves all goals for the authenticated user.
- Headers:
Authorization: Bearer <JWT_TOKEN>
- Response:
[ { "_id": string, "description": string, "createdAt": string, "updatedAt": string } ]
-
POST /api/goals
- Description: Creates a new goal for the authenticated user.
- Headers:
Authorization: Bearer <JWT_TOKEN>
- Body:
{ "description": string }
- Response:
{ "_id": string, "description": string, "createdAt": string, "updatedAt": string }
-
DELETE /api/goals/:id
- Description: Deletes a goal by ID for the authenticated user.
- Headers:
Authorization: Bearer <JWT_TOKEN>
- Response:
{ "message": "Goal deleted" }
- Register or login to obtain a JWT token.
- Include the token in the
Authorization
header for protected routes:Authorization: Bearer <JWT_TOKEN>
# Register a new user
curl -X POST http://localhost:5000/api/auth/signup \
-H "Content-Type: application/json" \
-d '{"email": "test@example.com", "password": "SecurePassword123!"}'
# Response
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"_id": "649e8a0a2e9c8a0012a1b2c3",
"email": "test@example.com"
}
}
# Create a new goal
curl -X POST http://localhost:5000/api/goals \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
-d '{"description": "Run a marathon"}'
# Response
{
"_id": "649e8a0a2e9c8a0012a1b2c4",
"description": "Run a marathon",
"createdAt": "2023-07-01T00:00:00.000Z",
"updatedAt": "2023-07-01T00:00:00.000Z"
}
# Delete a goal
curl -X DELETE http://localhost:5000/api/goals/649e8a0a2e9c8a0012a1b2c4 \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
# Response
{
"message": "Goal deleted"
}
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-progress-tracker-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!