- π Overview
- π¦ Features
- π Structure
- π» Installation
- ποΈ Usage
- π Hosting
- π License
- π Authors
The repository contains a Minimum Viable Product (MVP) called "Fitness Tracker MVP" that provides a comprehensive solution for fitness enthusiasts. Built using a modern tech stack consisting of Next.js, TypeScript, React, PostgreSQL, NextAuth.js, and Tailwind CSS, this MVP allows users to set and track fitness goals, log workouts, and view their progress.
Feature | Description | |
---|---|---|
π | Secure Authentication | The MVP uses NextAuth.js to securely manage user authentication, supporting login with Google and other providers. |
π― | Goal Setting and Tracking | Users can define personalized fitness goals (e.g., weight loss, muscle gain, distance running) and track progress visually through dashboards. |
ποΈ | Workout Logging | A user-friendly interface allows users to log their workouts, including details like type, duration, and intensity. |
π | Progress Visualization | The MVP utilizes charts and graphs to provide clear and engaging visualizations of progress towards goals. |
π₯ | Community Features (Future) | (Planned) The MVP will incorporate social features like a community feed for sharing achievements and motivating others. |
Fitness-Tracker-MVP
βββ .env
βββ .env.local
βββ commands.json
βββ startup.sh
βββ src
β βββ app
β β βββ api
β β β βββ auth
β β β β βββ [...nextauth].ts
β β β βββ goals
β β β β βββ route.ts
β β βββ layout.tsx
β β βββ page.tsx
β β βββ dashboard
β β β βββ page.tsx
β β βββ goals
β β β βββ page.tsx
β βββ components
β β βββ Button.tsx
β β βββ Modal.tsx
β β βββ Input.tsx
β β βββ GoalForm.tsx
β β βββ GoalList.tsx
β β βββ LoginForm.tsx
β β βββ SignupForm.tsx
β β βββ DashboardStats.tsx
β βββ pages
β β βββ Home.tsx
β β βββ Dashboard.tsx
β β βββ Goals.tsx
β βββ hooks
β β βββ useAuth.ts
β βββ services
β β βββ api.ts
β β βββ auth.ts
β βββ utils
β β βββ helpers.ts
β β βββ validators.ts
β βββ styles
β βββ global.css
βββ package.json
- Node.js v18+
- npm 8+
- PostgreSQL 14+
- Clone the repository:
git clone https://github.com/coslynx/Fitness-Tracker-MVP.git cd Fitness-Tracker-MVP
- Install dependencies:
npm install
- Create a
.env
file:cp .env.example .env
- Configure environment variables in the
.env
file. The following variables are required:NEXT_PUBLIC_SUPABASE_URL
: Your Supabase URL (e.g.,https://your-project.supabase.co
)NEXT_PUBLIC_SUPABASE_KEY
: Your Supabase Anon KeyNEXT_PUBLIC_GOOGLE_CLIENT_ID
: Your Google Client IDNEXT_PUBLIC_GOOGLE_CLIENT_SECRET
: Your Google Client SecretNEXT_PUBLIC_SENTRY_DSN
: Your Sentry DSN (optional for error tracking)
- Set up your Supabase database:
- Create a database using the instructions on the Supabase documentation.
- Ensure the database has the following tables:
users
(for user authentication)goals
(for storing user goals)workouts
(for logging workout data)
- Add any additional tables as needed for your MVP.
- Run database migrations:
npm run migrate
- (Optional) Configure Sentry for error tracking:
- Create a Sentry project.
- Set the
NEXT_PUBLIC_SENTRY_DSN
environment variable in your.env
file.
- Start the development server:
npm run dev
- Access the application in your browser at http://localhost:3000.
- Ensure you have a Supabase project set up.
- Set up environment variables:
NEXT_PUBLIC_SUPABASE_URL
: Your Supabase URL.NEXT_PUBLIC_SUPABASE_KEY
: Your Supabase Anon Key.NEXT_PUBLIC_GOOGLE_CLIENT_ID
: Your Google Client ID.NEXT_PUBLIC_GOOGLE_CLIENT_SECRET
: Your Google Client Secret.NEXT_PUBLIC_SENTRY_DSN
: Your Sentry DSN (optional).
- Build the application:
npm run build
- Deploy to your preferred platform, such as Vercel or Netlify. You can use the
next
command to deploy to Vercel:vercel
- Configure the deployment platform to connect to your Supabase database.
- (Optional) Configure Sentry for error tracking on your production environment.
- POST /api/auth/register
- Description: Register a new user.
- Body:
{ "name": string, "email": string, "password": string }
- Response:
- On success:
{ "id": string, "name": string, "email": string, "token": string }
- On error: Error message.
- On success:
- POST /api/auth/login
- Description: Login an existing user.
- Body:
{ "email": string, "password": string }
- Response:
- On success:
{ "id": string, "name": string, "email": string, "token": string }
- On error: Error message.
- On success:
- GET /api/goals
- Description: Get all goals for the current user.
- Headers:
Authorization: Bearer YOUR_JWT_TOKEN
- Response: An array of
Goal
objects.
- POST /api/goals
- Description: Create a new goal.
- Headers:
Authorization: Bearer YOUR_JWT_TOKEN
- Body:
{ "name": string, "description": string, "target": number }
- Response:
- On success: The newly created
Goal
object. - On error: Error message.
- On success: The newly created
- PUT /api/goals/:id
- Description: Update a goal.
- Headers:
Authorization: Bearer YOUR_JWT_TOKEN
- Body:
{ "name": string, "description": string, "target": number }
- Response:
- On success: The updated
Goal
object. - On error: Error message.
- On success: The updated
- DELETE /api/goals/:id
- Description: Delete a goal.
- Headers:
Authorization: Bearer YOUR_JWT_TOKEN
- Response:
- On success:
204 No Content
. - On error: Error message.
- On success:
- POST /api/workouts
- Description: Log a new workout.
- Headers:
Authorization: Bearer YOUR_JWT_TOKEN
- Body:
{ "type": string, "duration": number, "intensity": string, "notes": string }
- Response:
- On success: The newly created
Workout
object. - On error: Error message.
- On success: The newly created
- GET /api/workouts
- Description: Get all workouts for the current user.
- Headers:
Authorization: Bearer YOUR_JWT_TOKEN
- Response: An array of
Workout
objects.
- GET /api/users/me
- Description: Get information about the current user.
- Headers:
Authorization: Bearer YOUR_JWT_TOKEN
- Response: The current user object.
- Users must register or login to receive a JWT token.
- Include the JWT token in the
Authorization
header of all API requests.
Example:
curl -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "password": "yourPassword"}'
Response:
{
"id": "user123",
"name": "John Doe",
"email": "user@example.com",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw0"
}
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": "Lose 5kg", "description": "Lose 5kg in 12 weeks", "target": 5}'
Response:
{
"id": "goal123",
"name": "Lose 5kg",
"description": "Lose 5kg in 12 weeks",
"target": 5
}
Log a new workout:
curl -X POST http://localhost:3000/api/workouts \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{"type": "Running", "duration": 45, "intensity": "Moderate", "notes": "Ran around the park"}'
Response:
{
"id": "workout123",
"type": "Running",
"duration": 45,
"intensity": "Moderate",
"notes": "Ran around the park"
}
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: Fitness Tracker MVP
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!