- π 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
.envfile 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
.envfile contains environment-specific configurations, such as the MongoDB connection string and JWT secret. - The
PORTvariable 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=majorityJWT_SECRET: Secret key for JWT token generation Example:YourSuperSecretJWTKeyPORT: 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
Authorizationheader 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!