- MLA Fitness App
A simple and interactive fitness tracking application built with multiple microservices and programming languages. This application allows users to track their exercises and monitor their progress over time.
The Activity Tracking functionality uses the MERN stack (MongoDB, Express.js, React, Node.js), the Analytics service uses Python/Flask, the Goals service uses Python/Flask, and the Authentication Microservice using Java.
- User registration for personalized tracking
- Log various types of exercises with descriptions, duration, and date
- See weekly and overall statistics
- Set and track goals
- Interactive UI with Material-UI components
- Real-time data persistence with MongoDB
docker-compose up --build
docker-compose up
docker-compose up [servicename]
docker-compose down [servicename]
-
It is recommended to use a virtual environment to avoid conflicts with other Python projects. In order to know which Python version to use for the virtual environment, check the Dockerfile in the goals directory. Once you have an environment set up and activated, run the following command inside the goals directory:
pip install -r requirements.txt
-
Then run the following command:
python -m unittest discover ./tests
- It is recommended to use a virtual environment to avoid conflicts with other Python projects. In order to know which Python version to use for the virtual environment, check the Dockerfile in the analytics directory. Once you have an environment set up and activated, run the following command inside the analytics directory:
pip install -r requirements.txt
- Then run the following command:
python -m unittest discover ./tests
The application uses a Node.js server for activity tracking. If you decide to spin up the microservices individually you will need to first make sure you are located in the activity tracking directory:
cd activity-tracking
Then you will need to run the following command first to bypass conflicting dependencies in the package.json :
npm install --legacy-peer-deps
After running this command you can start running the activity tracking unit tests by running the following command:
npm run test -- --passWithNoTests
To generate an activity tracking code coverage report, which will be available to view in the folder location activity-tracking/coverage/cobertura-coverage.xml, run the following command:
npm run test -- --coverage --coverageDirectory=./coverage --coverageReporters=cobertura
To run unit tests for the auth service you can open IntellJ and run the test by right clicking on the test folder. This will run all the tests. In order to see the coverage you can also run "Test with Coverage"
Example of test coverage so far below:
The application uses a React frontend. If you decide to spin up the microservices individually you will need to first make sure you are located in the frontend directory:
cd frontend
Then you will need to run the following command first to bypass conflicting dependencies in the package.json :
npm install --legacy-peer-deps
After running this command you can start running the frontend unit tests by running the following command:
npm run test
To generate a frontend code coverage report, which will be available to view in the folder location frontend/coverage/cobertura-coverage.xml, run the following command:
npm run test -- --coverage --coverageDirectory=./coverage --coverageReporters=cobertura
The application uses mongoDB as the database. If you decide to spin up the microservices individually, you will still need to have a mongoDB instance running. There are many ways to install mongoDB; for example, you can install it on your local machine or use docker to spin up a mongoDB container.
This instance will need to be set up with credentials that match the configuration in the application. If not, you can change the environment variables in the docker-compose file and the microservice's configuration to match your mongoDB instance.
docker run --name mongodb -d -p 27017:27017 -v mongodbdata:/data/db -e MONGO_INITDB_ROOT_USERNAME=root MONGO_INITDB_ROOT_PASSWORD=cfgmla23 mongo:latest
docker-compose up mongodb
mongosh -u root -p cfgmla23 --authenticationDatabase admin --host localhost --port 27017
cd activity-tracking
npm install
nodemon server
It is recommended that you use a Python virtual environment to avoid conflict with other Python projects. You can check which Python version is needed in the Dockerfile for each of the microservices.
cd analytics
pip install -r requirements.txt
flask run -h localhost -p 5050
cd goals
pip install -r requirements.txt
flask run -h localhost -p 8000
cd authservice
./gradlew clean build
./gradlew bootRun
cd frontend
npm install
npm start
-
Click on "Code"
-
Switch to the "Codespaces" tab
Walktrough:
sh .devcontainer/check-installation.sh
expected output:
Checking installations...
node is /usr/local/bin/node
node is installed with version: v18.16.0
npm is /usr/local/bin/npm
npm is installed with version: 9.5.1
python3 is /usr/bin/python3
python3 is installed with version: Python 3.9.2
pip3 is /usr/bin/pip3
pip3 is installed with version: pip 20.3.4 from /usr/lib/python3/dist-packages/pip (python 3.9)
gradle is /usr/bin/gradle
gradle is installed with version:
------------------------------------------------------------
Gradle 4.4.1
------------------------------------------------------------
......
Done checking installations.
if you're missing any version, please contact your course administrator.
The application is containerized using Docker and can be deployed on any platform that supports Docker containers. For AWS deployment, a GitHub Actions pipeline is configured for CI/CD.