https://github.com/thund3rhawk/fitness-assistant
Fitness Assistant is a Node.js and TypeScript-based application utilizing the Gemini API to provide personalized fitness plans and progress tracking and is designed to be used with Daytona.
https://github.com/thund3rhawk/fitness-assistant
daytona expressjs gemini-api nodejs typescript
Last synced: 2 months ago
JSON representation
Fitness Assistant is a Node.js and TypeScript-based application utilizing the Gemini API to provide personalized fitness plans and progress tracking and is designed to be used with Daytona.
- Host: GitHub
- URL: https://github.com/thund3rhawk/fitness-assistant
- Owner: Thund3rHawk
- License: mit
- Created: 2024-12-08T16:26:18.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-12-18T13:24:24.000Z (6 months ago)
- Last Synced: 2025-02-14T05:42:22.120Z (4 months ago)
- Topics: daytona, expressjs, gemini-api, nodejs, typescript
- Language: TypeScript
- Homepage:
- Size: 120 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fitness Assistant



## Sample TypeScript using Express.js
This project demonstrates how to build a fitness assistant application using Node.js, TypeScript, and the Gemini API, and is designed to be used with Daytona. It includes features such as user authentication, get fitness advice, and get nutrition advice.
## 🚀 Getting Started
### Open Using Daytona
1. **Install Daytona**: Follow the [Daytona installation guide](https://www.daytona.io/docs/installation/installation/).
2. **Create the Workspace**:```bash
daytona create https://github.com/Thund3rHawk/fitness-assistant.git
```3. **Set Up Environment Variables**:
Before running the application, you need to set up the environment variables. Follow these steps:
1. **Create a `.env` file** in the root directory of the project.
2. **Add the following environment variables** to the `.env` file:```plaintext
DATABASE_URL = your_mongodb_url
GEMINI_API_KEY = your_gemini_api_key
JWT_SECRET = your_jwt_secret_key
```Replace `your_mongodb_url`, `your_gemini_api_key`, and `your_jwt_secret_key` with your actual MongoDB URL, Gemini API key, and JWT secret key.
3. **Save the `.env` file**.
These environment variables are essential for the application to run correctly and securely.
4. **Start the Application**:
```bash
npm run dev
```## 🛠️ Tech Stack
The Fitness Assistant project leverages a modern and efficient tech stack to deliver a high-quality application. Below are the key technologies used:
- **Node.js**: A powerful JavaScript runtime built on Chrome's V8 engine, used for building the server-side of the application.
- **TypeScript**: A statically typed superset of JavaScript that enhances code quality and maintainability.
- **Express.js**: A minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.
- **Prisma**: An ORM (Object-Relational Mapping) tool that simplifies database interactions and ensures type safety with TypeScript.
- **MongoDB**: A NoSQL database that stores data in JSON-like documents, providing flexibility and scalability.
- **Gemini API**: An external API used to fetch fitness and nutrition data, enabling personalized advice for users.
- **Daytona**: A development environment that simplifies the process of creating, managing, and deploying applications.This combination of technologies ensures that the Fitness Assistant application is scalable, maintainable, and easy to develop.
## 📸 Screenshots
Click to view screenshots
![]()
![]()
![]()
## API Endpoints
Here are some of the key API endpoints provided by the fitness assistant application, along with sample request and response JSON:
### User Registration
Endpoint: `POST /api/v1/auth/sign-up`
**Request**:
```json
{
"name": "john_doe",
"email": "[email protected]",
"password": "securepassword123",
"age": 20,
"gender": "male",
"height": 5.7,
"weight": 60
}
```**Response**:
```json
{
"message": "SignUp Successfull"
}
```
### User Login
Endpoint: `POST /api/v1/auth/sign-in`
**Request**:
```json
{
"email": "[email protected]",
"password": "securepassword123"
}
```**Response**:
```json
{
"message": "Login successful",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
```
### Get Fitness Advice
Endpoint: `POST /api/v1/getFitnessAdvice`
**Request**:
```json
{
"email": "[email protected]"
}
```**Request Headers**:
```json
{
"Authorization": "Bearer YOUR_JWT_TOKEN"
}
```**Response**:
```json
{
"advice": "Based on your profile, we recommend a mix of cardio and strength training."
}
```
### Get Nutrition Advice
Endpoint: `POST /api/v1/getNutritionAdvice`
**Request**:
```json
{
"email": "[email protected]"
}
```**Request Headers**:
```json
{
"Authorization": "Bearer YOUR_JWT_TOKEN"
}
```**Response**:
```json
{
"advice": "We recommend a balanced diet with a focus on protein and healthy fats."
}
```
These endpoints allow users to register, log in, and receive personalized fitness and nutrition advice.
## Using Postman for API Testing
You can use Postman to test the API endpoints provided by the fitness assistant application. Follow these steps to set up Postman for testing:
1. **Install Postman**: Download and install Postman from the [official website](https://www.postman.com/downloads/).
2. **Import the API Collection**:
- Open Postman and click on the "Import" button.
- Import the provided Postman collection file (`postman_collection.json`) from the project repository.3. **Set Up Environment Variables**:
- In Postman, go to "Environments" and create a new environment.
- Add the following variables to the environment:
- `baseUrl`: `http://localhost:8080/api/v1`
- `jwtToken`: Your JWT token obtained from the sign-in route.4. **Testing the Endpoints**:
- Use the imported collection to test the various endpoints.
- Ensure you have the `jwtToken` set in the environment for authenticated routes.By using Postman, you can easily test and debug the API endpoints to ensure they are working as expected.
## ✨ Features
- **Framework**: Built using Node.js and TypeScript, ensuring a robust and scalable architecture.
- **User Authentication**: Secure user registration and login functionality.
- **Fitness Advice**: Personalized fitness recommendations based on user data.
- **Nutrition Advice**: Tailored nutrition guidance to help users meet their health goals.
- **API Integration**: Seamless integration with the Gemini API for enhanced functionality.
- **Daytona Compatibility**: Easily deployable and manageable within the Daytona environment.List of sample features (e.g. realtime chat app, standardized development environment with devcontainers)