This is a full-stack medication tracker application built with Python (Flask) for the backend and Tailwind CSS for the frontend. The inspiration behind this application is to address the issue of individuals forgetting to complete their prescribed medication dosages.
The Medication Tracker provides users with real-time visibility into their prescription progress and allows them to track details about the prescribing doctoras well
- GitHub: Employed for version control of the project scripts.
- Environment Variables (.env): Used to store credentials for Google OAuth and database connection strings, particularly for MySQL connection.
- Flask: Chosen as the backend framework to develop the web-service project, enabling the creation of a Flask app.
- Tailwind: Employed as the frontend framework to design the web-service interface.
- Azure Database for MySQL flexible server: Selected as the project's database to integrate data seamlessly into the Flask app.
- SQLAlchemy: Utilized as the Object-Relational Mapping (ORM) tool within the Flask app, facilitating the establishment of a connection with the MySQL database and enabling data querying.
- Google OAuth: Integrated as the authorization service in the project to implement straightforward user authorization within the Flask app.
- Docker: Incorporated into the project to containerize the Flask app, streamlining deployment and ensuring consistency across different environments.
- Cloud Deployment with Azure: Utilized Microsoft Azure's App Services to deploy the Flask app to the cloud, providing an alternative method for deploying the web application.
In this project, environment variables played a crucial role in storing credentials for both Google OAuth and MySQL database connections. The .env file structure in the repository adhered to the following template:
GOOGLE_CLIENT_ID = GOOGLE_CLIENT_SECRET = DB_HOST = DB_DATABASE = DB_USERNAME = DB_PASSWORD = DB_PORT = 3306
This organized structure allowed for easy management and secure storage of sensitive information, facilitating seamless integration with the MySQL database and enabling secure communication with Google OAuth services within the project.
Clone the repository to your local machine:
-
run "npm init -y" to create a package.json file
-
run "npm i tailwindcss" to install tailwind
-
run "npx tailwindcss init" to initialize tailwind
-
Change the content section of the file such that the final tailwind.config.js looks something like this:
content: ["./app/templates/.html", "./app/static/src/.js"],
-
Create "input.css" file inside css folder under static folder and add the following:
@tailwind base; @tailwind components; @tailwind utilities;
-
Create an alias in the package.json inorder to listen to new tailwind changes i.e
"buildcss": "npx tailwindcss -i ./static/css/input.css -o ./static/css/output.css --watch"
Run "pip install -r requirements.txt"
-
Ensure Docker and Docker Compose are installed on your machine.
-
Create an .env file in the same directory as your docker-compose.yml file. Populate it with the required environment variables, including DB_USERNAME, DB_PASSWORD, DOCKER_DB_HOST, DB_NAME, etc.
-
Place the DigiCertGlobalRootCA.crt.pem file in the ./app directory.
-
Open a terminal, navigate to the directory containing your docker-compose.yml file.
-
Run the following command to build and start the services
docker-compose up --build
- Access your Flask application at http://localhost:5000. The application should be connected to the MySQL database.