This is a gym fitness application designed to track workouts and diets, helping users maintain and follow through with their fitness goals. The app utilises a sleek dashboard theme for easy navigation and interaction.
- Frontend: React.js with Vite
- Backend: Express.js with Nodemon
- Database: MongoDB in the Cloud
Before you begin, ensure you have met the following requirements:
- Docker For Docker users, install Docker by following the guide at Docker's official site.
- Node.js and npm: For Node.js users, ensure that Node.js v20 and npm latest rmare installed. They can be downloaded from nodejs.org.
Docker is the preferred method
These instructions will get your project up and running on your local machine for development and testing purposes.
-
Clone the repository
git clone git@github.com:CorruptBandit/BS3206-Advanced-Software-Development.git
Then enter the directory of the repository
-
Prepare environment variables
- Copy the
.env.template
file and rename it to.env
. - Populate the
.env
file with the necessary environment variables, for example:NODE_ENV="development" MONGO_USERNAME="University" MONGO_PASSWORD="password" CLIENT_PORT="3000" SERVER_PORT="3001" JWT_SECRET_KEY="insecure"
- Copy the
This application supports hot reloading, meaning that changes in the codebase will automatically refresh the application without needing a restart. Docker is the preferred method of running the application as it ensures a consistent environment across different platforms.
Due to WSL2 limitations, hot reloading only works through polling, meaning the webpage must be open for the hot reload to take effect, try refreshing page if changes aren't taking place
-
Non Docker Desktop users ONLY: Set UID and GID
export HOST_UID=$(id -u) export HOST_GID=$(id -g)
Do NOT use this when using Docker Desktop, this is already handled for you, for more info see the notes section
-
Build and Run the Application
docker compose up --build
-
Test the Application
docker compose run --build --rm test
-
Lint the Application
docker compose run --build --rm lint
The --build
flag is used to ensure you have the latest version of the image, remove this if you would rather perform manual builds
-
Windows ONLY: Set PowerShell as the script shell
npm config set script-shell powershell
Do NOT use this when using a Unix system
-
Install Dependencies
- Development:
npm install
- Production:
npm install --omit=dev
- Development:
-
Start the Application
- Development:
npm run dev
- Production:
npm start
- Development:
-
Test the Application
npm test
-
Lint the Application
npm run lint
Production should only be used when the system is ready for release
This gym fitness application offers several features to help users achieve their fitness goals:
-
Dashboard: Provides users with a sleek dashboard theme for easy navigation and interaction. The dashboard offers an overview of various fitness metrics and activities.
-
Calorie Tracker: Allows users to track their calorie intake and monitor their nutritional habits. Users can set calorie goals and log their daily food consumption.
-
Workout Tracker: Enables users to plan and track their workouts effectively. Users can create customised workout routines, log their exercises, and track their progress over time.
-
Admin Panel: Accessible using the email
admin@admin.admin
, the admin panel provides administrative functionalities for managing users, data, and system settings. This panel is intended for administrative purposes and allows privileged users to perform tasks such as user management, data analytics, and system configuration.
Ensure that the account with the email admin@admin.admin
has been manually created in the database to access the admin panel.
-
Theme used: Minimal Dashboard Free
-
Non-Docker Desktop environments, such as Docker running on native Linux, often need to handle user permissions more explicitly to avoid file ownership issues with volumes. This is because Docker on Linux uses the host machine's user and group IDs directly, which can lead to permission denied errors if the container's processes attempt to write to bind mounts owned by a different user. By setting
HOST_UID
andHOST_GID
to the IDs of the current user, we ensure that any files created by Docker on Linux are owned by the user, not by root or a mismatched user ID.Important: Do not use
sudo
to run the below commands as the environment variables will not work, either put the variables in the.env
or, see the official Docker documentation on how to run as a non-root user.