Author: Alston Dsouza
Fitness Tracker is a lightweight and user-friendly web application that helps users log and track their fitness workouts. The application provides an organized way to document and visualize workouts, encouraging users to maintain a consistent fitness routine.
The app includes features such as logging new workouts, viewing a detailed workout log, receiving motivational quotes, and tracking total workout hours.
Users can log workouts with the following details:
- Workout Type: Choose from a dropdown menu (e.g., Cardio, Strength Training, Yoga, etc.).
- Duration: Input the duration in minutes.
- Calories Burned: Add optional calorie details.
- Notes: Include optional notes about the workout (e.g., "Ran in the park" or "Tried a new routine").
-
A list of all submitted workouts is displayed on the main page, showing:
- Type
- Date & Time
- Duration
- Calories Burned
- Notes
-
Each workout entry can be clicked to view additional details or deleted if necessary.
- The homepage displays a random motivational fitness quote each time it is loaded to inspire users.
- Quotes are refreshed dynamically to keep the experience fresh and uplifting.
- Users can toggle between light and dark modes for better readability and user preference.
- The application calculates and displays the total number of workout hours logged by the user.
- The app depends on a running instance of MariaDB or MySQL. Without proper database configuration, it will not work.
- Currently, users cannot search for specific workouts or edit existing entries. These features could be added in future iterations.
- The app lacks a user authentication system, meaning all data is shared across all users who access the app.
- While some fields are required, there is no validation for the format of data (e.g., email validation or checking for invalid durations).
This project highlights several key technologies and concepts:
- JavaScript
- Node.js & Express.js
- EJS (Embedded JavaScript Templating)
- MariaDB & SQL
- HTML & CSS
- Search Functionality: Add the ability to search workouts by type or notes.
- Edit Workouts: Allow users to update workout details after logging them.
- Authentication: Enable user accounts for personalized workout tracking.
- Advanced Analytics: Provide insights like weekly trends or progress charts.
- Node.js installed on your machine
- MariaDB or MySQL installed and running
- Clone the repository:
git clone https://github.com/alstondsouza1/fitness-tracker.git cd fitness-tracker
-
Initialize the Project
From the project root directory, run the following command to initialize a new project:npm init
- Set the entry point to
app.js. - Use defaults for the remaining options.
- Set the entry point to
-
Install Required Dependencies
Install the necessary Node.js packages:npm install express ejs
Add any additional dependencies such as
mariadbandmethod-overrideas needed. -
Configure the database:
- Create a database called
fitness_trackerand run the SQL script provided indatabase-scripts/init.sqlto set up theworkoutstable. - Update the database connection settings in
app.jsif necessary.
- Create a database called
-
Start the application:
npx nodemon
-
Open the app in your browser:
http://localhost:3000 -
Follow the steps in Setup Instructions to complete the configuration and run the project.