A web application that allows users to track their fitness goals, set progress, and share achievements with friends.
- π Overview
- π¦ Features
- π Structure
- π» Installation
- ποΈ Usage
- π Hosting
- π License
- π Authors
The repository contains a Minimum Viable Product (MVP) called "fit-track-progress-goals" that provides a comprehensive solution for users to track their fitness goals, set progress, and share achievements with friends. The application is built using a tech stack consisting of React, JavaScript, HTML, CSS, Node.js, and Custom LLMs including Gemini and OpenAI.
| Feature | Description | |
|---|---|---|
| βοΈ | Architecture | The codebase follows a modular architectural pattern with separate directories for different functionalities, ensuring easier maintenance and scalability. The application is built using React for the frontend and Node.js for the backend, leveraging Custom LLMs, Gemini, and OpenAI for advanced features. |
| π | Documentation | The repository includes a comprehensive README file that provides an overview of the Minimum Viable Product (MVP), details on its features, dependencies, and step-by-step instructions for installation, usage, and hosting. |
| π | Dependencies | The codebase relies on various external libraries and packages such as React, axios, mongoose, and jsonwebtoken, which are essential for building the user interface, handling API requests, and managing the database. |
| π§© | Modularity | The modular structure of the application allows for easier maintenance and reusability of the code, with separate directories and files for different functionalities such as authentication, goal management, and dashboard. |
| π§ͺ | Testing | The project includes comprehensive unit tests using frameworks like Jest and React Testing Library to ensure the reliability and robustness of the codebase. |
| β‘οΈ | Performance | The performance of the system is optimized through techniques such as code splitting, memoization, and efficient data fetching and handling. The application is designed to handle increased user load and data volume. |
| π | Security | The application implements security measures such as input validation, password hashing, and secure token-based authentication to protect user data and prevent common vulnerabilities. |
| π | Version Control | The project utilizes Git for version control, with GitHub Actions workflows configured for automated build and release processes. |
| π | Integrations | The application integrates with various browser APIs and external services through HTTP requests, including features like speech recognition and synthesis. |
| πΆ | Scalability | The system is designed with scalability in mind, utilizing caching strategies and cloud-based solutions to handle increased user load and data volume. |
- src
- api
- auth
- auth.controller.js
- auth.service.js
- auth.routes.js
- goals
- goals.controller.js
- goals.service.js
- goals.routes.js
- models
- User.js
- Goal.js
- middleware
- auth.middleware.js
- error.middleware.js
- utils
- logger.js
- validator.js
- app.js
- server.js
- tests
- unit
- auth.test.js
- goals.test.js
- client
- src
- components
- common
- Button.jsx
- Input.jsx
- Modal.jsx
- layout
- Header.jsx
- Footer.jsx
- features
- auth
- LoginForm.jsx
- RegisterForm.jsx
- dashboard
- DashboardStats.jsx
- goals
- GoalList.jsx
- GoalForm.jsx
- pages
- Home.jsx
- Dashboard.jsx
- Goals.jsx
- Profile.jsx
- context
- AuthContext.jsx
- hooks
- useAuth.js
- useGoals.js
- services
- authService.js
- goalsService.js
- utils
- helpers.js
- styles
- global.css
- public
- index.html
- favicon.ico
- .env
- package.json
- README.md
- startup.sh
- commands.json
- tailwind.config.js
- babel.config.js
- jest.config.js
- Clone the repository:
git clone https://github.com/coslynx/fit-track-progress-goals.git cd fit-track-progress-goals - Install dependencies:
npm install
- Set up the database:
# Start MongoDB database docker-compose up -d mongodb # Run database migrations npm run migrate
- Configure environment variables:
cp .env.example .env # Fill in necessary environment variables (e.g., MongoDB connection string, JWT secret)
-
Start the development server:
npm run dev
-
Start the API server:
npm run api
-
Access the application:
- Web interface: http://localhost:3000
- API endpoint: http://localhost:3000/api
Tip
- The
.envfile contains the necessary environment variables for the application, such as the database connection string and JWT secret. - Modify these variables as needed to match your specific deployment setup.
Here are some examples of the MVP's core features:
-
π User Registration:
curl -X POST http://localhost:3000/api/auth/register \ -H "Content-Type: application/json" \ -d '{"name": "newuser", "email": "user@example.com", "password": "securepass123"}'
-
π Setting a Fitness Goal:
curl -X POST http://localhost:3000/api/goals \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -d '{"title": "Weight Loss", "description": "Lose 10 lbs by December 31", "dueDate": "2023-12-31"}'
-
π Logging Progress:
curl -X POST http://localhost:3000/api/progress \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -d '{"goalId": "goal_id_here", "value": 5, "date": "2023-06-15"}'
Detailed instructions for deploying the Fitness Tracking MVP to Heroku:
- Install the Heroku CLI:
npm install -g heroku
- Login to Heroku:
heroku login
- Create a new Heroku app:
heroku create fit-track-progress-goals-production
- Set up environment variables:
heroku config:set NODE_ENV=production heroku config:set DB_CONNECTION_STRING=mongodb://user:password@host:port/database heroku config:set JWT_SECRET=your-256-bit-secret
- Deploy the code:
git push heroku main
- Run database migrations (if applicable):
heroku run npm run migrate
DB_CONNECTION_STRING: Connection string for the MongoDB database Example:mongodb://user:password@host:port/databaseJWT_SECRET: Secret key for JWT token generation Example:your-256-bit-secret
-
POST /api/auth/register
- Description: Register a new user
- Body:
{ "name": string, "email": string, "password": string } - Response:
{ "token": string }
-
POST /api/auth/login
- Description: Log in a user
- Body:
{ "email": string, "password": string } - Response:
{ "token": string }
-
POST /api/goals
- Description: Create a new fitness goal
- Headers:
Authorization: Bearer TOKEN - Body:
{ "title": string, "description": string, "dueDate": date } - Response:
{ "id": string, "title": string, "description": string, "dueDate": date, "completed": boolean, "userId": string }
-
GET /api/goals
- Description: Retrieve the user's fitness goals
- Headers:
Authorization: Bearer TOKEN - Response:
[ { "id": string, "title": string, "description": string, "dueDate": date, "completed": boolean, "userId": string } ]
-
PUT /api/goals/{id}
- Description: Update an existing fitness goal
- Headers:
Authorization: Bearer TOKEN - Body:
{ "title": string, "description": string, "dueDate": date } - Response:
{ "id": string, "title": string, "description": string, "dueDate": date, "completed": boolean, "userId": string }
-
DELETE /api/goals/{id}
- Description: Delete a fitness goal
- Headers:
Authorization: Bearer TOKEN - Response:
{ "message": string }
- Register a new user or log in to receive a JWT token.
- Include the token in the
Authorizationheader for all protected routes:Authorization: Bearer YOUR_JWT_TOKEN - The token has a 1-hour expiration time. When the token expires, you can request a new token using the refresh token endpoint.
# Register a new user
curl -X POST http://localhost:3000/api/auth/register \
-H "Content-Type: application/json" \
-d '{"name": "fitnessuser", "email": "user@example.com", "password": "securepass123"}'
# Response
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
# Create a new goal
curl -X POST http://localhost:3000/api/goals \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{"title": "Weight Loss", "description": "Lose 10 lbs by December 31", "dueDate": "2023-12-31"}'
# Response
{
"id": "goal123",
"title": "Weight Loss",
"description": "Lose 10 lbs by December 31",
"dueDate": "2023-12-31",
"completed": false,
"userId": "user123"
}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: fit-track-progress-goals
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!