- π Overview
- π¦ Features
- π Structure
- π» Installation
- ποΈ Usage
- π Hosting
- π License
- π Authors
The repository contains a Minimum Viable Product (MVP) called "fitness-tracker-goal-setter-app" that empowers fitness enthusiasts to track their progress, set achievable goals, and connect with a supportive community. Built with Next.js, React, TypeScript, and a robust backend powered by Node.js and PostgreSQL, this MVP offers a user-friendly and engaging experience.
Feature | Description | |
---|---|---|
βοΈ | Architecture | The codebase follows a modular architectural pattern with separate directories for different functionalities, ensuring easier maintenance and scalability. |
π | Documentation | The repository includes a README file that provides a detailed overview of the MVP, its dependencies, and usage instructions. |
π | Dependencies | The codebase relies on various external libraries and packages such as React, uuid, esbuild, and eslint, which are essential for building and styling the UI components, and handling external services. |
𧩠| Modularity | The modular structure allows for easier maintenance and reusability of the code, with separate directories and files for different functionalities such as background, components, and content. |
π§ͺ | Testing | Implement unit tests using frameworks like Jest or React Testing Library to ensure the reliability and robustness of the codebase. |
β‘οΈ | Performance | The performance of the system can be optimized based on factors such as the browser and hardware being used. Consider implementing performance optimizations for better efficiency. |
π | Security | Enhance security by implementing measures such as input validation, data encryption, and secure communication protocols. |
π | Version Control | Utilizes Git for version control with GitHub Actions workflow files for automated build and release processes. |
π | Integrations | Interacts with browser APIs, external services through HTTP requests, and includes integrations with speech recognition and synthesis APIs. |
πΆ | Scalability | Design the system to handle increased user load and data volume, utilizing caching strategies and cloud-based solutions for better scalability. |
fitness-tracker-goal-setter-app/
βββ .env
βββ .env.example
βββ next.config.js
βββ tailwind.config.js
βββ tsconfig.json
βββ prisma
β βββ schema.prisma
β βββ migrations
βββ public
β βββ images
βββ pages
β βββ api
β β βββ auth
β β β βββ [...nextauth].ts
β β βββ goals
β β β βββ [id].ts
β β β βββ index.ts
β β βββ progress
β β β βββ [id].ts
β β β βββ index.ts
β β βββ users
β β β βββ [id].ts
β β β βββ index.ts
β β βββ webhooks
β β βββ stripe.ts
β βββ _app.tsx
β βββ _document.tsx
β βββ index.tsx
β βββ dashboard.tsx
β βββ goals.tsx
β βββ progress.tsx
β βββ community.tsx
β βββ settings.tsx
βββ components
β βββ layout
β β βββ Header.tsx
β β βββ Footer.tsx
β β βββ Sidebar.tsx
β β βββ Layout.tsx
β βββ ui
β β βββ Button.tsx
β β βββ Card.tsx
β β βββ Modal.tsx
β β βββ Input.tsx
β β βββ Select.tsx
β β βββ Spinner.tsx
β βββ features
β βββ auth
β β βββ LoginForm.tsx
β β βββ SignupForm.tsx
β βββ goals
β β βββ GoalCard.tsx
β β βββ GoalForm.tsx
β β βββ GoalList.tsx
β βββ progress
β β βββ ProgressChart.tsx
β β βββ ProgressLog.tsx
β βββ dashboard
β β βββ DashboardStats.tsx
β β βββ RecentActivity.tsx
β βββ community
β βββ CommunityFeed.tsx
β βββ UserProfile.tsx
βββ lib
β βββ api
β β βββ client.ts
β βββ hooks
β β βββ useUser.ts
β β βββ useGoals.ts
β βββ utils
β βββ formatters.ts
β βββ validators.ts
β βββ calculations.ts
βββ styles
β βββ globals.css
β βββ theme.ts
βββ types
β βββ goal.ts
β βββ progress.ts
β βββ user.ts
βββ context
β βββ AuthContext.tsx
β βββ ThemeContext.tsx
βββ services
β βββ goalService.ts
β βββ progressService.ts
β βββ userService.ts
βββ package.json
- Node.js v18+
- npm 8+
- PostgreSQL 14+
- Docker 20.10+
- Clone the repository:
git clone https://github.com/coslynx/fitness-tracker-goal-setter-app.git cd fitness-tracker-goal-setter-app
- Install dependencies:
npm install
- Create a .env file for environment variables:
Fill in the required environment variables in the
cp .env.example .env
.env
file. - Set up the PostgreSQL database:
- Install PostgreSQL on your machine if you haven't already.
- Create a new database.
- Set the
DATABASE_URL
environment variable in your.env
file to connect to your database.
- Run database migrations:
npm run migrate
- Start the development server:
Access the application in your browser at http://localhost:3000.
npm run dev
- Start the development server:
npm run dev
- Access the application in your browser at http://localhost:3000.
next.config.js
: Configures Next.js for optimal performance and development settings.tailwind.config.js
: Customizes Tailwind CSS for the application's visual style.tsconfig.json
: Configures the TypeScript compiler for type checking and code generation..env
: Stores environment variables specific to your development and production environments.
- User Registration
curl -X POST http://localhost:3000/api/auth/register \ -H "Content-Type: application/json" \ -d '{"username": "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 '{"type": "weight_loss", "target": 10, "deadline": "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": 2, "date": "2023-06-15"}'
- Create a Vercel account and install the Vercel CLI:
npm install -g vercel
- Login to Vercel:
vercel login
- Initialize a Vercel project:
Follow the prompts to configure your project.
vercel init fitness-tracker-goal-setter-app
- Deploy to Vercel:
vercel deploy
DATABASE_URL
: Connection string for your PostgreSQL database (e.g.,postgresql://user:password@host:port/database_name
)NEXTAUTH_URL
: Your application's URL (e.g.,https://your-app.vercel.app
)NEXTAUTH_SECRET
: A random 32-character string for secure authentication (generate a unique secret usingopenssl rand -base64 32
)- [Add any other environment variables specific to your MVP]
- POST /api/auth/register
- Description: Registers a new user.
- Body:
{ "username": string, "email": string, "password": string }
- Response:
{ "id": string, "username": string, "email": string, "token": string }
- POST /api/auth/login
- Description: Logs in an existing user.
- Body:
{ "email": string, "password": string }
- Response:
{ "id": string, "username": string, "email": string, "token": string }
- GET /api/auth/session
- Description: Fetches the current user session.
- Response:
{ "user": { "id": string, "username": string, "email": string }, "expires": string }
- POST /api/goals
- Description: Creates a new fitness goal.
- Headers:
Authorization: Bearer TOKEN
- Body:
{ "type": string, "target": number, "deadline": date }
- Response:
{ "id": string, "type": string, "target": number, "deadline": date, "progress": number }
- GET /api/goals
- Description: Fetches all goals for the current user.
- Headers:
Authorization: Bearer TOKEN
- Response:
[{ "id": string, "type": string, "target": number, "deadline": date, "progress": number }]
- GET /api/goals/:id
- Description: Fetches a specific goal by its ID.
- Headers:
Authorization: Bearer TOKEN
- Response:
{ "id": string, "type": string, "target": number, "deadline": date, "progress": number }
- PUT /api/goals/:id
- Description: Updates an existing goal.
- Headers:
Authorization: Bearer TOKEN
- Body:
{ "type": string, "target": number, "deadline": date, "progress": number }
- Response:
{ "id": string, "type": string, "target": number, "deadline": date, "progress": number }
- DELETE /api/goals/:id
- Description: Deletes a goal by its ID.
- Headers:
Authorization: Bearer TOKEN
- Response:
{}
- POST /api/progress
- Description: Creates a new progress entry for a goal.
- Headers:
Authorization: Bearer TOKEN
- Body:
{ "goalId": string, "value": number, "date": date }
- Response:
{ "id": string, "goalId": string, "value": number, "date": date }
- GET /api/progress
- Description: Fetches all progress entries for the current user.
- Headers:
Authorization: Bearer TOKEN
- Response:
[{ "id": string, "goalId": string, "value": number, "date": date }]
- GET /api/progress/:id
- Description: Fetches a specific progress entry by its ID.
- Headers:
Authorization: Bearer TOKEN
- Response:
{ "id": string, "goalId": string, "value": number, "date": date }
- PUT /api/progress/:id
- Description: Updates an existing progress entry.
- Headers:
Authorization: Bearer TOKEN
- Body:
{ "goalId": string, "value": number, "date": date }
- Response:
{ "id": string, "goalId": string, "value": number, "date": date }
- DELETE /api/progress/:id
- Description: Deletes a progress entry by its ID.
- Headers:
Authorization: Bearer TOKEN
- Response:
{}
- Registration and Login: Use the
/api/auth/register
and/api/auth/login
endpoints to register a new user or log in to an existing account. Upon successful authentication, you'll receive a JWT token. - Authentication Header: Include the JWT token in the
Authorization
header for all protected API routes:Authorization: Bearer YOUR_JWT_TOKEN
- Session Management: The
Authorization
header is used to authenticate each request and ensure that only authenticated users can access protected data or resources.
# Register a new user
curl -X POST http://localhost:3000/api/auth/register \
-H "Content-Type: application/json" \
-d '{"username": "fitnessuser", "email": "user@example.com", "password": "securepass123"}'
# Login
curl -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "password": "securepass123"}'
# Fetch the current user session (after login)
curl -X GET http://localhost:3000/api/auth/session \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
# Create a new goal
curl -X POST http://localhost:3000/api/goals \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{"type": "weight_loss", "target": 10, "deadline": "2023-12-31"}'
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-goal-setter-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!