A web application for fitness enthusiasts to track their goals, monitor progress, and connect with friends
- π Overview
- π¦ Features
- π Structure
- π» Installation
- ποΈ Usage
- π Hosting
- π License
- π Authors
This repository houses the "FitTrack-smfxu7" Minimum Viable Product (MVP), designed to empower fitness enthusiasts. It leverages a modern tech stack including Next.js, React, Node.js, and Firebase Firestore for real-time data management. The MVP focuses on core features such as user authentication, goal setting, progress tracking, and social sharing to provide a motivating and engaging experience for users.
Feature | Description | |
---|---|---|
βοΈ | Architecture | The codebase employs a robust client-server architecture using Next.js for server-side rendering and React for the interactive frontend. The backend utilizes Node.js and Firebase Firestore for secure data management. |
π | Documentation | This README file provides a detailed overview of the MVP, its components, installation instructions, usage examples, and API documentation. |
π | Dependencies | The MVP relies on essential packages such as Next.js, React, Material-UI, Firebase, and React Router to create a rich and functional user experience. |
𧩠| Modularity | The project follows a modular structure with dedicated components for user authentication, goal creation, progress tracking, and social interactions, promoting maintainability and scalability. |
π§ͺ | Testing | Automated tests are implemented using Jest and React Testing Library to ensure code quality and prevent regressions. |
β‘οΈ | Performance | The application is optimized for speed and responsiveness using Next.js features like automatic code splitting, server-side rendering, and image optimization. |
π | Security | Robust security measures are implemented, including Firebase Authentication for user login, HTTPS for secure communication, and input validation to prevent vulnerabilities. |
π | Version Control | The codebase is managed using Git with a dedicated GitHub repository, ensuring proper versioning and collaboration. |
π | Integrations | The MVP integrates with popular fitness trackers and devices, allowing users to import activity data seamlessly. It also leverages browser APIs for a smooth user experience. |
πΆ | Scalability | The application is designed to handle increasing user loads and data volumes by leveraging the scalability of Firebase Firestore and cloud hosting solutions. |
fitness-tracker/
βββ package.json
βββ commands.json
βββ .env
βββ startup.sh
βββ src/
β βββ components/
β β βββ Button.tsx
β β βββ Input.tsx
β β βββ Modal.tsx
β β βββ GoalForm.tsx
β β βββ GoalList.tsx
β βββ pages/
β β βββ Home.tsx
β β βββ Dashboard.tsx
β β βββ Goals.tsx
β βββ hooks/
β β βββ useAuth.js
β βββ services/
β β βββ auth.js
β β βββ firestore.js
β βββ styles/
β βββ global.css
βββ public/
βββ index.html
βββ favicon.ico
βββ assets/
βββ images/
βββ logo.png
βββ profile-placeholder.png
- Node.js v18+
- npm 8+
- Firebase CLI:
npm install -g firebase-tools
- A Firebase project (create one at https://console.firebase.google.com)
- Clone the repository:
git clone https://github.com/coslynx/FitTrack-smfxu7.git cd FitTrack-smfxu7
- Install dependencies:
npm install
- Set up Firebase:
- Log in to your Firebase project (or create a new one):
firebase login
- Initialize Firebase in your project directory:
firebase init
- Select "Firestore" for your database.
- Create a new Firebase project or select an existing project.
- Log in to your Firebase project (or create a new one):
- Configure environment variables:
Replace the placeholders in the
cp .env.example .env
.env
file with your Firebase project details. - Start the development server:
Open your browser and navigate to http://localhost:3000 to access the Fitness Tracker MVP.
npm run dev
- Start the development server:
npm run dev
- Open your browser and navigate to http://localhost:3000.
- You can access the Fitness Tracker MVP through the browser interface.
.env
: Contains essential environment variables, including Firebase project information.package.json
: Specifies project dependencies and scripts for tasks like building and starting the development server.
- Create a Vercel account (if you don't have one) at https://vercel.com.
- Install the Vercel CLI:
npm install -g vercel
- Initialize Vercel in your project:
vercel init
- Follow the prompts to connect your project to Vercel.
- Deploy your application:
vercel deploy
NEXT_PUBLIC_FIREBASE_API_KEY
: Your Firebase API Key from your Firebase project.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN
: Your Firebase Auth Domain.NEXT_PUBLIC_FIREBASE_DATABASE_URL
: Your Firebase Database URL.NEXT_PUBLIC_FIREBASE_PROJECT_ID
: Your Firebase Project ID.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET
: Your Firebase Storage Bucket.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID
: Your Firebase Messaging Sender ID.NEXT_PUBLIC_FIREBASE_APP_ID
: Your Firebase App ID.- Important: These environment variables are set in the
.env
file. Make sure to fill them in with your actual values.
The Fitness Tracker API provides endpoints for user authentication, goal management, progress tracking, and social interactions.
-
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 an existing user.
- Body:
{ "email": string, "password": string }
- Response:
{ "id": string, "username": string, "email": string, "token": string }
-
POST /api/goals
- Description: Create a new fitness goal.
- Headers:
Authorization: Bearer TOKEN
- Body:
{ "name": string, "targetValue": number, "duration": string, "notes": string }
- Response:
{ "id": string, "name": string, "targetValue": number, "duration": string, "notes": string }
-
GET /api/goals
- Description: Get all user goals.
- Headers:
Authorization: Bearer TOKEN
- Response:
[ { "id": string, "name": string, "targetValue": number, "duration": string, "notes": string }, ... ]
-
GET /api/goals/:id
- Description: Get a specific goal by ID.
- Headers:
Authorization: Bearer TOKEN
- Response:
{ "id": string, "name": string, "targetValue": number, "duration": string, "notes": string }
-
PUT /api/goals/:id
- Description: Update a goal by ID.
- Headers:
Authorization: Bearer TOKEN
- Body:
{ "name": string, "targetValue": number, "duration": string, "notes": string }
- Response:
{ "id": string, "name": string, "targetValue": number, "duration": string, "notes": string }
-
DELETE /api/goals/:id
- Description: Delete a goal by ID.
- Headers:
Authorization: Bearer TOKEN
- Response:
{ "message": "Goal deleted successfully" }
-
POST /api/progress/:goalId
- Description: Log progress for a goal.
- Headers:
Authorization: Bearer TOKEN
- Body:
{ "value": number, "date": string }
- Response:
{ "message": "Progress logged successfully" }
- The API uses JSON Web Tokens (JWT) for authentication.
- Users must register or login to receive a JWT token.
- The JWT token should be included in the
Authorization
header for all protected API requests using the formatBearer YOUR_JWT_TOKEN
.
# Register a new user
curl -X POST http://localhost:3000/api/auth/register \
-H "Content-Type: application/json" \
-d '{"username": "fitnessuser", "email": "[email protected]", "password": "securepass123"}'
# Response
{
"id": "user123",
"username": "fitnessuser",
"email": "[email protected]",
"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 '{"name": "Weight Loss", "targetValue": 10, "duration": "2 weeks", "notes": "Lose 10 pounds in two weeks."}'
# Response
{
"id": "goal123",
"name": "Weight Loss",
"targetValue": 10,
"duration": "2 weeks",
"notes": "Lose 10 pounds in two weeks."
}
# Log progress for a goal
curl -X POST http://localhost:3000/api/progress/goal123 \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{"value": 2, "date": "2024-02-15"}'
# Response
{
"message": "Progress logged successfully"
}
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: FitTrack-smfxu7
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!